NaturesAura/src/main/java/de/ellpeck/naturesaura/gui/GuiEnderCrate.java

46 lines
2 KiB
Java
Raw Normal View History

2019-02-17 22:51:05 +01:00
package de.ellpeck.naturesaura.gui;
2020-09-22 03:17:02 +02:00
import com.mojang.blaze3d.matrix.MatrixStack;
2020-01-21 23:02:39 +01:00
import com.mojang.blaze3d.platform.GlStateManager;
2019-10-20 22:30:49 +02:00
import net.minecraft.client.gui.screen.inventory.ContainerScreen;
2021-12-04 15:40:09 +01:00
import net.minecraft.entity.player.Player;
2020-01-24 17:05:41 +01:00
import net.minecraft.entity.player.PlayerInventory;
2019-02-17 22:51:05 +01:00
import net.minecraft.util.ResourceLocation;
2020-01-24 17:05:41 +01:00
import net.minecraft.util.text.ITextComponent;
2019-10-20 22:30:49 +02:00
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
2019-02-17 22:51:05 +01:00
2019-10-20 22:30:49 +02:00
@OnlyIn(Dist.CLIENT)
2020-01-24 17:05:41 +01:00
public class GuiEnderCrate extends ContainerScreen<ContainerEnderCrate> {
2019-02-17 22:51:05 +01:00
private static final ResourceLocation CHEST_GUI_TEXTURE = new ResourceLocation("textures/gui/container/generic_54.png");
2021-12-04 15:40:09 +01:00
private final Player player;
2019-02-17 22:51:05 +01:00
2020-01-24 17:05:41 +01:00
public GuiEnderCrate(ContainerEnderCrate container, PlayerInventory inv, ITextComponent title) {
super(container, inv, title);
this.player = inv.player;
2019-02-17 22:51:05 +01:00
this.ySize = 114 + 3 * 18;
}
@Override
2020-09-22 03:17:02 +02:00
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);
2019-02-17 22:51:05 +01:00
}
@Override
2020-09-22 03:17:02 +02:00
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);
2019-02-17 22:51:05 +01:00
}
@Override
2020-09-22 03:17:02 +02:00
protected void drawGuiContainerBackgroundLayer(MatrixStack matrixStack, float partialTicks, int mouseX, int mouseY) {
2020-01-21 23:02:39 +01:00
GlStateManager.color4f(1.0F, 1.0F, 1.0F, 1.0F);
this.getMinecraft().getTextureManager().bindTexture(CHEST_GUI_TEXTURE);
2019-02-17 22:51:05 +01:00
int i = (this.width - this.xSize) / 2;
int j = (this.height - this.ySize) / 2;
2020-09-22 03:17:02 +02:00
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);
2019-02-17 22:51:05 +01:00
}
}