fix some rendering to use matrix stacks

This commit is contained in:
grimmauld 2020-10-07 22:32:03 +02:00
parent 482e02e5d3
commit 36a96d35e3
8 changed files with 124 additions and 65 deletions

View file

@ -5,6 +5,7 @@ import java.util.function.Supplier;
import com.mojang.blaze3d.matrix.MatrixStack; import com.mojang.blaze3d.matrix.MatrixStack;
import com.mojang.blaze3d.systems.RenderSystem; import com.mojang.blaze3d.systems.RenderSystem;
import com.simibubi.create.foundation.gui.GuiGameElement;
import mezz.jei.api.gui.drawable.IDrawable; import mezz.jei.api.gui.drawable.IDrawable;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.RenderHelper; import net.minecraft.client.renderer.RenderHelper;
@ -47,13 +48,15 @@ public class DoubleItemIcon implements IDrawable {
matrixStack.push(); matrixStack.push();
matrixStack.translate(1, 1, 0); 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.pop();
matrixStack.push(); matrixStack.push();
matrixStack.translate(10, 10, 100); matrixStack.translate(10, 10, 100);
matrixStack.scale(.5f, .5f, .5f); 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();
matrixStack.pop(); matrixStack.pop();

View file

@ -9,6 +9,7 @@ import com.simibubi.create.content.contraptions.processing.ProcessingOutput;
import com.simibubi.create.content.curiosities.tools.SandPaperPolishingRecipe; import com.simibubi.create.content.curiosities.tools.SandPaperPolishingRecipe;
import com.simibubi.create.foundation.gui.AllGuiTextures; import com.simibubi.create.foundation.gui.AllGuiTextures;
import com.simibubi.create.foundation.gui.GuiGameElement;
import mezz.jei.api.constants.VanillaTypes; import mezz.jei.api.constants.VanillaTypes;
import mezz.jei.api.gui.IRecipeLayout; import mezz.jei.api.gui.IRecipeLayout;
import mezz.jei.api.gui.ingredient.IGuiItemStackGroup; import mezz.jei.api.gui.ingredient.IGuiItemStackGroup;
@ -72,7 +73,8 @@ public class PolishingCategory extends CreateRecipeCategory<SandPaperPolishingRe
tag.putBoolean("JEI", true); tag.putBoolean("JEI", true);
ItemRenderer itemRenderer = Minecraft.getInstance().getItemRenderer(); ItemRenderer itemRenderer = Minecraft.getInstance().getItemRenderer();
matrixStack.scale(2, 2, 2); matrixStack.scale(2, 2, 2);
itemRenderer.renderItemIntoGUI(renderedSandpaper, getBackground().getWidth() / 4 - 8, 1); matrixStack.translate(getBackground().getWidth() / 4 - 8, 1, 0);
GuiGameElement.GuiItemRenderBuilder.renderItemIntoGUI(matrixStack, renderedSandpaper);
matrixStack.pop(); matrixStack.pop();
} }

View file

@ -1,13 +1,5 @@
package com.simibubi.create.content.schematics.block; package com.simibubi.create.content.schematics.block;
import static net.minecraft.util.text.TextFormatting.DARK_PURPLE;
import static net.minecraft.util.text.TextFormatting.GRAY;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Vector;
import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableList;
import com.mojang.blaze3d.matrix.MatrixStack; import com.mojang.blaze3d.matrix.MatrixStack;
import com.simibubi.create.AllBlocks; import com.simibubi.create.AllBlocks;
@ -24,18 +16,23 @@ import com.simibubi.create.foundation.item.ItemDescription.Palette;
import com.simibubi.create.foundation.item.TooltipHelper; import com.simibubi.create.foundation.item.TooltipHelper;
import com.simibubi.create.foundation.networking.AllPackets; import com.simibubi.create.foundation.networking.AllPackets;
import com.simibubi.create.foundation.utility.Lang; import com.simibubi.create.foundation.utility.Lang;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.widget.Widget; import net.minecraft.client.gui.widget.Widget;
import net.minecraft.client.renderer.Rectangle2d; import net.minecraft.client.renderer.Rectangle2d;
import net.minecraft.entity.player.PlayerInventory; import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.util.text.IFormattableTextComponent;
import net.minecraft.util.text.ITextComponent; import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.StringTextComponent; import net.minecraft.util.text.StringTextComponent;
import net.minecraft.util.text.TextFormatting; import net.minecraft.util.text.TextFormatting;
import net.minecraft.util.text.TranslationTextComponent; import net.minecraft.util.text.TranslationTextComponent;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Vector;
import static net.minecraft.util.text.TextFormatting.*;
public class SchematicannonScreen extends AbstractSimiContainerScreen<SchematicannonContainer> { public class SchematicannonScreen extends AbstractSimiContainerScreen<SchematicannonContainer> {
private static final AllGuiTextures BG_BOTTOM = AllGuiTextures.SCHEMATICANNON_BOTTOM; private static final AllGuiTextures BG_BOTTOM = AllGuiTextures.SCHEMATICANNON_BOTTOM;
@ -80,7 +77,7 @@ public class SchematicannonScreen extends AbstractSimiContainerScreen<Schematica
private Indicator showSettingsIndicator; private Indicator showSettingsIndicator;
public SchematicannonScreen(SchematicannonContainer container, PlayerInventory inventory, public SchematicannonScreen(SchematicannonContainer container, PlayerInventory inventory,
ITextComponent p_i51105_3_) { ITextComponent p_i51105_3_) {
super(container, inventory, p_i51105_3_); super(container, inventory, p_i51105_3_);
placementSettingWidgets = new ArrayList<>(); placementSettingWidgets = new ArrayList<>();
} }
@ -183,26 +180,26 @@ public class SchematicannonScreen extends AbstractSimiContainerScreen<Schematica
resetIndicator.state = State.OFF; resetIndicator.state = State.OFF;
switch (te.state) { switch (te.state) {
case PAUSED: case PAUSED:
pauseIndicator.state = State.YELLOW; pauseIndicator.state = State.YELLOW;
playButton.active = true; playButton.active = true;
pauseButton.active = false; pauseButton.active = false;
resetButton.active = true; resetButton.active = true;
break; break;
case RUNNING: case RUNNING:
playIndicator.state = State.GREEN; playIndicator.state = State.GREEN;
playButton.active = false; playButton.active = false;
pauseButton.active = true; pauseButton.active = true;
resetButton.active = true; resetButton.active = true;
break; break;
case STOPPED: case STOPPED:
resetIndicator.state = State.RED; resetIndicator.state = State.RED;
playButton.active = true; playButton.active = true;
pauseButton.active = false; pauseButton.active = false;
resetButton.active = false; resetButton.active = false;
break; break;
default: default:
break; break;
} }
handleTooltips(); handleTooltips();
@ -241,9 +238,9 @@ public class SchematicannonScreen extends AbstractSimiContainerScreen<Schematica
return; return;
boolean enabled = indicator.state == State.ON; boolean enabled = indicator.state == State.ON;
List<ITextComponent> tip = button.getToolTip(); List<ITextComponent> tip = button.getToolTip();
tip.add((enabled ? optionEnabled : optionDisabled).copy().formatted(TextFormatting.BLUE)); tip.add((enabled ? optionEnabled : optionDisabled).copy().formatted(BLUE));
tip.addAll(TooltipHelper.cutTextComponent(Lang.translate("gui.schematicannon.option." + tooltipKey + ".description"), GRAY, GRAY)); tip.addAll(TooltipHelper.cutTextComponent(Lang.translate("gui.schematicannon.option." + tooltipKey + ".description"),
GRAY, GRAY));
} }
@Override @Override
@ -257,27 +254,36 @@ public class SchematicannonScreen extends AbstractSimiContainerScreen<Schematica
renderFuelBar(matrixStack, te.fuelLevel); renderFuelBar(matrixStack, te.fuelLevel);
renderChecklistPrinterProgress(matrixStack, te.bookPrintingProgress); renderChecklistPrinterProgress(matrixStack, te.bookPrintingProgress);
if (!te.inventory.getStackInSlot(0).isEmpty()) if (!te.inventory.getStackInSlot(0)
.isEmpty())
renderBlueprintHighlight(matrixStack); renderBlueprintHighlight(matrixStack);
GuiGameElement.of(renderedItem) GuiGameElement.of(renderedItem)
.at(guiLeft + 230, guiTop + 110) .at(guiLeft + 230, guiTop + 110)
.scale(5) .scale(5)
.render(matrixStack); .render(matrixStack);
textRenderer.drawWithShadow(matrixStack, title, guiLeft + 80, guiTop + 3, 0xfefefe);
textRenderer.draw(matrixStack, title, guiLeft + 80, guiTop + 10, AllGuiTextures.FONT_COLOR); ITextComponent msg = Lang.translate("schematicannon.status." + te.statusMsg);
IFormattableTextComponent msg = Lang.translate("schematicannon.status." + te.statusMsg);
int stringWidth = textRenderer.getWidth(msg); int stringWidth = textRenderer.getWidth(msg);
if (te.missingItem != null) { if (te.missingItem != null) {
stringWidth += 15; stringWidth += 15;
itemRenderer.renderItemIntoGUI(te.missingItem, guiLeft + 150, guiTop + 46); matrixStack.push();
matrixStack.translate(guiLeft + 150, guiTop + 46, 0);
GuiGameElement.GuiItemRenderBuilder.renderItemIntoGUI(matrixStack, te.missingItem);
matrixStack.pop();
// itemRenderer.renderItemIntoGUI(te.missingItem, guiLeft + 150, guiTop + 46);
} }
textRenderer.drawWithShadow(matrixStack, msg, guiLeft + 20 + 102 - stringWidth / 2, guiTop + 50, 0xCCDDFF); textRenderer.drawWithShadow(matrixStack, msg, guiLeft + 20 + 102 - stringWidth / 2, guiTop + 50, 0xCCDDFF);
textRenderer.draw(matrixStack, playerInventory.getDisplayName(), guiLeft - 10 + 7, guiTop + 145 + 6, 0x666666); textRenderer.draw(matrixStack, playerInventory.getDisplayName(), guiLeft - 10 + 7, guiTop + 145 + 6, 0x666666);
// to see or debug the bounds of the extra area uncomment the following lines
// Rectangle2d r = extraAreas.get(0);
// fill(r.getX() + r.getWidth(), r.getY() + r.getHeight(), r.getX(), r.getY(),
// 0xd3d3d3d3);
} }
protected void renderBlueprintHighlight(MatrixStack matrixStack) { protected void renderBlueprintHighlight(MatrixStack matrixStack) {
@ -287,14 +293,16 @@ public class SchematicannonScreen extends AbstractSimiContainerScreen<Schematica
protected void renderPrintingProgress(MatrixStack matrixStack, float progress) { protected void renderPrintingProgress(MatrixStack matrixStack, float progress) {
progress = Math.min(progress, 1); progress = Math.min(progress, 1);
AllGuiTextures sprite = AllGuiTextures.SCHEMATICANNON_PROGRESS; AllGuiTextures sprite = AllGuiTextures.SCHEMATICANNON_PROGRESS;
client.getTextureManager().bindTexture(sprite.location); client.getTextureManager()
.bindTexture(sprite.location);
drawTexture(matrixStack, guiLeft + 20 + 44, guiTop + 64, sprite.startX, sprite.startY, (int) (sprite.width * progress), drawTexture(matrixStack, guiLeft + 20 + 44, guiTop + 64, sprite.startX, sprite.startY, (int) (sprite.width * progress),
sprite.height); sprite.height);
} }
protected void renderChecklistPrinterProgress(MatrixStack matrixStack, float progress) { protected void renderChecklistPrinterProgress(MatrixStack matrixStack, float progress) {
AllGuiTextures sprite = AllGuiTextures.SCHEMATICANNON_CHECKLIST_PROGRESS; AllGuiTextures sprite = AllGuiTextures.SCHEMATICANNON_CHECKLIST_PROGRESS;
client.getTextureManager().bindTexture(sprite.location); client.getTextureManager()
.bindTexture(sprite.location);
drawTexture(matrixStack, guiLeft + 20 + 154, guiTop + 20, sprite.startX, sprite.startY, (int) (sprite.width * progress), drawTexture(matrixStack, guiLeft + 20 + 154, guiTop + 20, sprite.startX, sprite.startY, (int) (sprite.width * progress),
sprite.height); sprite.height);
} }
@ -325,30 +333,29 @@ public class SchematicannonScreen extends AbstractSimiContainerScreen<Schematica
if (hoveredSlot != null && !hoveredSlot.getHasStack()) { if (hoveredSlot != null && !hoveredSlot.getHasStack()) {
if (hoveredSlot.getSlotIndex() == 0) if (hoveredSlot.getSlotIndex() == 0)
renderTooltip(matrixStack, renderTooltip(matrixStack,
TooltipHelper.cutTextComponent(Lang.translate(_slotSchematic), TextFormatting.GRAY, TextFormatting.BLUE), TooltipHelper.cutTextComponent(Lang.translate(_slotSchematic), GRAY, TextFormatting.BLUE),
mouseX, mouseY); mouseX, mouseY);
if (hoveredSlot.getSlotIndex() == 2) if (hoveredSlot.getSlotIndex() == 2)
renderTooltip(matrixStack, renderTooltip(matrixStack,
TooltipHelper.cutTextComponent(Lang.translate(_slotListPrinter), TextFormatting.GRAY, TextFormatting.BLUE), TooltipHelper.cutTextComponent(Lang.translate(_slotListPrinter), GRAY, TextFormatting.BLUE),
mouseX, mouseY); mouseX, mouseY);
if (hoveredSlot.getSlotIndex() == 4) if (hoveredSlot.getSlotIndex() == 4)
renderTooltip(matrixStack, renderTooltip(matrixStack,
TooltipHelper.cutTextComponent(Lang.translate(_slotGunpowder), TextFormatting.GRAY, TextFormatting.BLUE), TooltipHelper.cutTextComponent(Lang.translate(_slotGunpowder), GRAY, TextFormatting.BLUE),
mouseX, mouseY); mouseX, mouseY);
} }
if (te.missingItem != null) { if (te.missingItem != null) {
int missingBlockX = guiLeft + 150, missingBlockY = guiTop + 46; int missingBlockX = guiLeft + 150, missingBlockY = guiTop + 46;
if (mouseX >= missingBlockX && mouseY >= missingBlockY && mouseX <= missingBlockX + 16 if (mouseX >= missingBlockX && mouseY >= missingBlockY && mouseX <= missingBlockX + 16
&& mouseY <= missingBlockY + 16) { && mouseY <= missingBlockY + 16) {
renderTooltip(matrixStack, te.missingItem, mouseX, mouseY); renderTooltip(matrixStack, te.missingItem, mouseX, mouseY);
} }
} }
int paperX = guiLeft + 20 + 202, paperY = guiTop + 20; int paperX = guiLeft + 132, paperY = guiTop + 19;
if (mouseX >= paperX && mouseY >= paperY && mouseX <= paperX + 16 && mouseY <= paperY + 16) { if (mouseX >= paperX && mouseY >= paperY && mouseX <= paperX + 16 && mouseY <= paperY + 16)
renderTooltip(matrixStack, listPrinter, mouseX, mouseY); renderTooltip(matrixStack, listPrinter, mouseX, mouseY);
}
super.renderWindowForeground(matrixStack, mouseX, mouseY, partialTicks); super.renderWindowForeground(matrixStack, mouseX, mouseY, partialTicks);
} }
@ -362,17 +369,17 @@ public class SchematicannonScreen extends AbstractSimiContainerScreen<Schematica
if (te.hasCreativeCrate) { if (te.hasCreativeCrate) {
tooltip.add(Lang.translate(_gunpowderLevel, "" + 100)); tooltip.add(Lang.translate(_gunpowderLevel, "" + 100));
tooltip.add(new StringTextComponent("(").append( new TranslationTextComponent(AllBlocks.CREATIVE_CRATE.get() tooltip.add(new StringTextComponent("(").append(new TranslationTextComponent(AllBlocks.CREATIVE_CRATE.get()
.getTranslationKey())).append(")").formatted(DARK_PURPLE)); .getTranslationKey())).append(")").formatted(DARK_PURPLE));
return tooltip; return tooltip;
} }
float f = te.fuelLevel * 100; float f = te.fuelLevel * 100;
tooltip.add(Lang.translate(_gunpowderLevel, "" + (int) f)); tooltip.add(Lang.translate(_gunpowderLevel, "" + (int) f));
tooltip.add(Lang.translate(_shotsRemaining, "" + TextFormatting.BLUE + shotsLeft).formatted(GRAY)); tooltip.add(Lang.translate(_shotsRemaining, "" + TextFormatting.BLUE + shotsLeft).formatted(GRAY)); // fixme
if (shotsLeftWithItems != shotsLeft) if (shotsLeftWithItems != shotsLeft)
tooltip tooltip
.add(Lang.translate(_shotsRemainingWithBackup, "" + TextFormatting.BLUE + shotsLeftWithItems).formatted(GRAY)); .add(Lang.translate(_shotsRemainingWithBackup, "" + TextFormatting.BLUE + shotsLeftWithItems).formatted(GRAY)); // fixme
return tooltip; return tooltip;
} }
@ -424,3 +431,4 @@ public class SchematicannonScreen extends AbstractSimiContainerScreen<Schematica
} }
} }

View file

@ -9,6 +9,7 @@ import com.simibubi.create.CreateClient;
import com.simibubi.create.foundation.gui.AbstractSimiScreen; import com.simibubi.create.foundation.gui.AbstractSimiScreen;
import com.simibubi.create.foundation.gui.AllGuiTextures; import com.simibubi.create.foundation.gui.AllGuiTextures;
import com.simibubi.create.foundation.gui.AllIcons; import com.simibubi.create.foundation.gui.AllIcons;
import com.simibubi.create.foundation.gui.GuiGameElement;
import com.simibubi.create.foundation.gui.widgets.IconButton; import com.simibubi.create.foundation.gui.widgets.IconButton;
import com.simibubi.create.foundation.gui.widgets.Label; import com.simibubi.create.foundation.gui.widgets.Label;
import com.simibubi.create.foundation.gui.widgets.ScrollInput; import com.simibubi.create.foundation.gui.widgets.ScrollInput;
@ -154,7 +155,8 @@ public class SchematicEditScreen extends AbstractSimiScreen {
matrixStack.push(); matrixStack.push();
matrixStack.translate(guiLeft + 200, guiTop + 80, 0); matrixStack.translate(guiLeft + 200, guiTop + 80, 0);
matrixStack.scale(3, 3, 3); matrixStack.scale(3, 3, 3);
itemRenderer.renderItemIntoGUI(new ItemStack(AllItems.SCHEMATIC.get()), 0, 0); GuiGameElement.GuiItemRenderBuilder.renderItemIntoGUI(matrixStack, new ItemStack(AllItems.SCHEMATIC.get()));
// itemRenderer.renderItemIntoGUI(new ItemStack(AllItems.SCHEMATIC.get()), 0, 0);
matrixStack.pop(); matrixStack.pop();
} }

View file

@ -1,5 +1,6 @@
package com.simibubi.create.content.schematics.client; package com.simibubi.create.content.schematics.client;
import com.simibubi.create.foundation.gui.GuiGameElement;
import org.lwjgl.glfw.GLFW; import org.lwjgl.glfw.GLFW;
import com.mojang.blaze3d.matrix.MatrixStack; import com.mojang.blaze3d.matrix.MatrixStack;
@ -64,7 +65,11 @@ public class SchematicPromptScreen extends AbstractSimiScreen {
AllGuiTextures.SCHEMATIC_PROMPT.draw(ms, this, guiLeft, guiTop); AllGuiTextures.SCHEMATIC_PROMPT.draw(ms, this, guiLeft, guiTop);
textRenderer.drawWithShadow(ms, title, guiLeft + (sWidth / 2) - (textRenderer.getWidth(title) / 2), guiTop + 3, textRenderer.drawWithShadow(ms, title, guiLeft + (sWidth / 2) - (textRenderer.getWidth(title) / 2), guiTop + 3,
0xffffff); 0xffffff);
itemRenderer.renderItemIntoGUI(AllItems.SCHEMATIC.asStack(), guiLeft + 22, guiTop + 23); ms.push();
ms.translate(guiLeft + 22, guiTop + 23, 0);
GuiGameElement.GuiItemRenderBuilder.renderItemIntoGUI(ms, AllItems.SCHEMATIC.asStack());
ms.pop();
// itemRenderer.renderItemIntoGUI(AllItems.SCHEMATIC.asStack(), guiLeft + 22, guiTop + 23);
} }
@Override @Override

View file

@ -44,6 +44,10 @@ public abstract class AbstractSimiContainerScreen<T extends Container> extends C
this.ySize = height; this.ySize = height;
} }
@Override
protected void drawForeground(MatrixStack p_230451_1_, int p_230451_2_, int p_230451_3_) {
}
@Override @Override
public void render(MatrixStack matrixStack, int mouseX, int mouseY, float partialTicks) { public void render(MatrixStack matrixStack, int mouseX, int mouseY, float partialTicks) {
renderBackground(matrixStack); renderBackground(matrixStack);

View file

@ -4,6 +4,7 @@ import javax.annotation.Nonnull;
import javax.annotation.Nullable; import javax.annotation.Nullable;
import com.mojang.blaze3d.matrix.MatrixStack; 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.DestFactor;
import com.mojang.blaze3d.platform.GlStateManager.SourceFactor; import com.mojang.blaze3d.platform.GlStateManager.SourceFactor;
import com.mojang.blaze3d.systems.RenderSystem; import com.mojang.blaze3d.systems.RenderSystem;
@ -20,15 +21,13 @@ import net.minecraft.block.Blocks;
import net.minecraft.block.FireBlock; import net.minecraft.block.FireBlock;
import net.minecraft.block.FlowingFluidBlock; import net.minecraft.block.FlowingFluidBlock;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.Atlases; import net.minecraft.client.renderer.*;
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.model.IBakedModel; 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.renderer.texture.OverlayTexture;
import net.minecraft.client.world.ClientWorld; import net.minecraft.client.world.ClientWorld;
import net.minecraft.entity.LivingEntity;
import net.minecraft.fluid.Fluid; import net.minecraft.fluid.Fluid;
import net.minecraft.inventory.container.PlayerContainer; import net.minecraft.inventory.container.PlayerContainer;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
@ -291,10 +290,44 @@ public class GuiGameElement {
transformMatrix(matrixStack); transformMatrix(matrixStack);
matrixStack.scale(1, -1, 1); matrixStack.scale(1, -1, 1);
matrixStack.translate(0, 0, -75); matrixStack.translate(0, 0, -75);
Minecraft.getInstance().getItemRenderer().renderItemIntoGUI(stack, 0, 0); renderItemIntoGUI(matrixStack, stack);
cleanUpMatrix(matrixStack); 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; private static FluidRenderWorld renderWorld;

View file

@ -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 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.server.ChunkManager field_219266_t # field_219266_t
public net.minecraft.world.biome.BiomeManager field_226833_b_ # seed public net.minecraft.world.biome.BiomeManager field_226833_b_ # seed
public net.minecraft.client.renderer.ItemRenderer field_175057_n # textureManager