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

42 lines
1.7 KiB
Java
Raw Normal View History

2019-02-17 22:51:05 +01:00
package de.ellpeck.naturesaura.gui;
2023-07-08 12:32:27 +02:00
import net.minecraft.client.gui.GuiGraphics;
2021-12-08 00:31:29 +01:00
import net.minecraft.client.gui.screens.inventory.AbstractContainerScreen;
import net.minecraft.network.chat.Component;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.entity.player.Inventory;
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)
2021-12-08 00:31:29 +01:00
public class GuiEnderCrate extends AbstractContainerScreen<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-08 00:31:29 +01:00
public GuiEnderCrate(ContainerEnderCrate container, Inventory inv, Component title) {
2020-01-24 17:05:41 +01:00
super(container, inv, title);
2021-12-08 00:31:29 +01:00
this.imageHeight = 114 + 3 * 18;
2019-02-17 22:51:05 +01:00
}
@Override
2023-07-08 12:32:27 +02:00
public void render(GuiGraphics graphics, int mouseX, int mouseY, float partialTicks) {
this.renderBackground(graphics);
super.render(graphics, mouseX, mouseY, partialTicks);
this.renderTooltip(graphics, mouseX, mouseY);
2019-02-17 22:51:05 +01:00
}
@Override
2023-07-08 12:32:27 +02:00
protected void renderLabels(GuiGraphics graphics, int mouseX, int mouseY) {
graphics.drawString(this.font, this.title.getString(), 8, 6, 4210752);
graphics.drawString(this.font, this.playerInventoryTitle, 8, this.imageHeight - 96 + 2, 4210752);
2019-02-17 22:51:05 +01:00
}
@Override
2023-07-08 12:32:27 +02:00
protected void renderBg(GuiGraphics graphics, float partialTicks, int mouseX, int mouseY) {
2021-12-15 16:30:22 +01:00
var i = (this.width - this.imageWidth) / 2;
var j = (this.height - this.imageHeight) / 2;
2023-07-08 12:32:27 +02:00
graphics.blit(GuiEnderCrate.CHEST_GUI_TEXTURE, i, j, 0, 0, this.imageWidth, 3 * 18 + 17);
graphics.blit(GuiEnderCrate.CHEST_GUI_TEXTURE, i, j + 3 * 18 + 17, 0, 126, this.imageWidth, 96);
2019-02-17 22:51:05 +01:00
}
2023-07-08 12:32:27 +02:00
}