diff --git a/src/main/java/com/simibubi/create/compat/jei/DoubleItemIcon.java b/src/main/java/com/simibubi/create/compat/jei/DoubleItemIcon.java index 9850a2db1..a8ac25d4f 100644 --- a/src/main/java/com/simibubi/create/compat/jei/DoubleItemIcon.java +++ b/src/main/java/com/simibubi/create/compat/jei/DoubleItemIcon.java @@ -5,6 +5,7 @@ import java.util.function.Supplier; import com.mojang.blaze3d.matrix.MatrixStack; import com.mojang.blaze3d.systems.RenderSystem; +import com.simibubi.create.foundation.gui.GuiGameElement; import mezz.jei.api.gui.drawable.IDrawable; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.RenderHelper; @@ -47,13 +48,15 @@ public class DoubleItemIcon implements IDrawable { matrixStack.push(); matrixStack.translate(1, 1, 0); - Minecraft.getInstance().getItemRenderer().renderItemIntoGUI(primaryStack, 0, 0); + GuiGameElement.GuiItemRenderBuilder.renderItemIntoGUI(matrixStack, primaryStack); + // Minecraft.getInstance().getItemRenderer().renderItemIntoGUI(primaryStack, 0, 0); matrixStack.pop(); matrixStack.push(); matrixStack.translate(10, 10, 100); matrixStack.scale(.5f, .5f, .5f); - Minecraft.getInstance().getItemRenderer().renderItemIntoGUI(secondaryStack, 0, 0); + GuiGameElement.GuiItemRenderBuilder.renderItemIntoGUI(matrixStack, secondaryStack); + // Minecraft.getInstance().getItemRenderer().renderItemIntoGUI(secondaryStack, 0, 0); matrixStack.pop(); matrixStack.pop(); diff --git a/src/main/java/com/simibubi/create/compat/jei/category/PolishingCategory.java b/src/main/java/com/simibubi/create/compat/jei/category/PolishingCategory.java index ea5f09a35..84cdaca01 100644 --- a/src/main/java/com/simibubi/create/compat/jei/category/PolishingCategory.java +++ b/src/main/java/com/simibubi/create/compat/jei/category/PolishingCategory.java @@ -9,6 +9,7 @@ import com.simibubi.create.content.contraptions.processing.ProcessingOutput; import com.simibubi.create.content.curiosities.tools.SandPaperPolishingRecipe; import com.simibubi.create.foundation.gui.AllGuiTextures; +import com.simibubi.create.foundation.gui.GuiGameElement; import mezz.jei.api.constants.VanillaTypes; import mezz.jei.api.gui.IRecipeLayout; import mezz.jei.api.gui.ingredient.IGuiItemStackGroup; @@ -72,7 +73,8 @@ public class PolishingCategory extends CreateRecipeCategory { private static final AllGuiTextures BG_BOTTOM = AllGuiTextures.SCHEMATICANNON_BOTTOM; @@ -80,7 +77,7 @@ public class SchematicannonScreen extends AbstractSimiContainerScreen(); } @@ -183,26 +180,26 @@ public class SchematicannonScreen extends AbstractSimiContainerScreen tip = button.getToolTip(); - tip.add((enabled ? optionEnabled : optionDisabled).copy().formatted(TextFormatting.BLUE)); - tip.addAll(TooltipHelper.cutTextComponent(Lang.translate("gui.schematicannon.option." + tooltipKey + ".description"), GRAY, GRAY)); - + tip.add((enabled ? optionEnabled : optionDisabled).copy().formatted(BLUE)); + tip.addAll(TooltipHelper.cutTextComponent(Lang.translate("gui.schematicannon.option." + tooltipKey + ".description"), + GRAY, GRAY)); } @Override @@ -257,27 +254,36 @@ public class SchematicannonScreen extends AbstractSimiContainerScreen= missingBlockX && mouseY >= missingBlockY && mouseX <= missingBlockX + 16 - && mouseY <= missingBlockY + 16) { + && mouseY <= missingBlockY + 16) { renderTooltip(matrixStack, te.missingItem, mouseX, mouseY); } } - int paperX = guiLeft + 20 + 202, paperY = guiTop + 20; - if (mouseX >= paperX && mouseY >= paperY && mouseX <= paperX + 16 && mouseY <= paperY + 16) { + int paperX = guiLeft + 132, paperY = guiTop + 19; + if (mouseX >= paperX && mouseY >= paperY && mouseX <= paperX + 16 && mouseY <= paperY + 16) renderTooltip(matrixStack, listPrinter, mouseX, mouseY); - } super.renderWindowForeground(matrixStack, mouseX, mouseY, partialTicks); } @@ -362,17 +369,17 @@ public class SchematicannonScreen extends AbstractSimiContainerScreen extends C this.ySize = height; } + @Override + protected void drawForeground(MatrixStack p_230451_1_, int p_230451_2_, int p_230451_3_) { + } + @Override public void render(MatrixStack matrixStack, int mouseX, int mouseY, float partialTicks) { renderBackground(matrixStack); diff --git a/src/main/java/com/simibubi/create/foundation/gui/GuiGameElement.java b/src/main/java/com/simibubi/create/foundation/gui/GuiGameElement.java index 653f29c37..e80fd94a7 100644 --- a/src/main/java/com/simibubi/create/foundation/gui/GuiGameElement.java +++ b/src/main/java/com/simibubi/create/foundation/gui/GuiGameElement.java @@ -4,6 +4,7 @@ import javax.annotation.Nonnull; import javax.annotation.Nullable; import com.mojang.blaze3d.matrix.MatrixStack; +import com.mojang.blaze3d.platform.GlStateManager; import com.mojang.blaze3d.platform.GlStateManager.DestFactor; import com.mojang.blaze3d.platform.GlStateManager.SourceFactor; import com.mojang.blaze3d.systems.RenderSystem; @@ -20,15 +21,13 @@ import net.minecraft.block.Blocks; import net.minecraft.block.FireBlock; import net.minecraft.block.FlowingFluidBlock; import net.minecraft.client.Minecraft; -import net.minecraft.client.renderer.Atlases; -import net.minecraft.client.renderer.BlockRendererDispatcher; -import net.minecraft.client.renderer.IRenderTypeBuffer; -import net.minecraft.client.renderer.RenderHelper; -import net.minecraft.client.renderer.RenderType; -import net.minecraft.client.renderer.RenderTypeLookup; +import net.minecraft.client.renderer.*; import net.minecraft.client.renderer.model.IBakedModel; +import net.minecraft.client.renderer.model.ItemCameraTransforms; +import net.minecraft.client.renderer.texture.AtlasTexture; import net.minecraft.client.renderer.texture.OverlayTexture; import net.minecraft.client.world.ClientWorld; +import net.minecraft.entity.LivingEntity; import net.minecraft.fluid.Fluid; import net.minecraft.inventory.container.PlayerContainer; import net.minecraft.item.ItemStack; @@ -291,10 +290,44 @@ public class GuiGameElement { transformMatrix(matrixStack); matrixStack.scale(1, -1, 1); matrixStack.translate(0, 0, -75); - Minecraft.getInstance().getItemRenderer().renderItemIntoGUI(stack, 0, 0); + renderItemIntoGUI(matrixStack, stack); cleanUpMatrix(matrixStack); } + public static void renderItemIntoGUI(MatrixStack matrixStack, ItemStack stack) { + ItemRenderer renderer = Minecraft.getInstance().getItemRenderer(); + IBakedModel bakedModel = renderer.getItemModelWithOverrides(stack, null, null); + matrixStack.push(); + renderer.textureManager.bindTexture(AtlasTexture.LOCATION_BLOCKS_TEXTURE); + renderer.textureManager.getTexture(AtlasTexture.LOCATION_BLOCKS_TEXTURE).setBlurMipmapDirect(false, false); + RenderSystem.enableRescaleNormal(); + RenderSystem.enableAlphaTest(); + RenderSystem.defaultAlphaFunc(); + RenderSystem.enableBlend(); + RenderSystem.blendFunc(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA); + RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F); + matrixStack.translate((float)0, (float)0, 100.0F + renderer.zLevel); + matrixStack.translate(8.0F, 8.0F, 0.0F); + matrixStack.scale(1.0F, -1.0F, 1.0F); + matrixStack.scale(16.0F, 16.0F, 16.0F); + IRenderTypeBuffer.Impl irendertypebuffer$impl = Minecraft.getInstance().getBufferBuilders().getEntityVertexConsumers(); + boolean flag = !bakedModel.isSideLit(); + if (flag) { + RenderHelper.disableGuiDepthLighting(); + } + + renderer.renderItem(stack, ItemCameraTransforms.TransformType.GUI, false, matrixStack, irendertypebuffer$impl, 15728880, OverlayTexture.DEFAULT_UV, bakedModel); + irendertypebuffer$impl.draw(); + RenderSystem.enableDepthTest(); + if (flag) { + RenderHelper.enableGuiDepthLighting(); + } + + RenderSystem.disableAlphaTest(); + RenderSystem.disableRescaleNormal(); + matrixStack.pop(); + } + } private static FluidRenderWorld renderWorld; diff --git a/src/main/resources/META-INF/accesstransformer.cfg b/src/main/resources/META-INF/accesstransformer.cfg index d43e0b627..ce91145a3 100644 --- a/src/main/resources/META-INF/accesstransformer.cfg +++ b/src/main/resources/META-INF/accesstransformer.cfg @@ -19,3 +19,5 @@ public net.minecraft.client.gui.FontRenderer func_238419_a_(Lnet/minecraft/util/ protected net.minecraft.entity.Entity func_226266_a_(Lnet/minecraft/entity/Entity;Lnet/minecraft/entity/Entity$IMoveCallback;)V # updatePassengerPosition public net.minecraft.world.server.ChunkManager field_219266_t # field_219266_t public net.minecraft.world.biome.BiomeManager field_226833_b_ # seed + +public net.minecraft.client.renderer.ItemRenderer field_175057_n # textureManager