package de.ellpeck.naturesaura.gui; import com.mojang.blaze3d.matrix.MatrixStack; import com.mojang.blaze3d.platform.GlStateManager; import net.minecraft.client.gui.screen.inventory.ContainerScreen; import net.minecraft.entity.player.Player; import net.minecraft.entity.player.PlayerInventory; import net.minecraft.util.ResourceLocation; import net.minecraft.util.text.ITextComponent; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; @OnlyIn(Dist.CLIENT) public class GuiEnderCrate extends ContainerScreen { private static final ResourceLocation CHEST_GUI_TEXTURE = new ResourceLocation("textures/gui/container/generic_54.png"); private final Player player; public GuiEnderCrate(ContainerEnderCrate container, PlayerInventory inv, ITextComponent title) { super(container, inv, title); this.player = inv.player; this.ySize = 114 + 3 * 18; } @Override public void render(MatrixStack matrixStack, int mouseX, int mouseY, float partialTicks) { this.renderBackground(matrixStack); super.render(matrixStack, mouseX, mouseY, partialTicks); this.func_230459_a_(matrixStack, mouseX, mouseY); } @Override protected void drawGuiContainerForegroundLayer(MatrixStack matrixStack, int mouseX, int mouseY) { this.font.drawString(matrixStack, this.title.getString(), 8, 6, 4210752); this.font.drawString(matrixStack, this.player.inventory.getDisplayName().getString(), 8, this.ySize - 96 + 2, 4210752); } @Override protected void drawGuiContainerBackgroundLayer(MatrixStack matrixStack, float partialTicks, int mouseX, int mouseY) { GlStateManager.color4f(1.0F, 1.0F, 1.0F, 1.0F); this.getMinecraft().getTextureManager().bindTexture(CHEST_GUI_TEXTURE); int i = (this.width - this.xSize) / 2; int j = (this.height - this.ySize) / 2; this.blit(matrixStack, i, j, 0, 0, this.xSize, 3 * 18 + 17); this.blit(matrixStack, i, j + 3 * 18 + 17, 0, 126, this.xSize, 96); } }