package lv.enes.mc.eris_alchemy.client; import lv.enes.mc.eris_alchemy.menu.ChestLikeMenu; import net.minecraft.client.gui.GuiGraphics; 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; public abstract class ChestLikeScreen extends AbstractContainerScreen { public ChestLikeScreen(M menu, Inventory inventory, Component title) { super(menu, inventory, title); imageWidth = getTextureWidth(); imageHeight = getTextureHeight(); } protected abstract ResourceLocation getTexture(); protected abstract int getTextureWidth(); protected abstract int getTextureHeight(); protected boolean shouldRenderLabels() { return true; } @Override public void render(GuiGraphics graphics, int mouseX, int mouseY, float delta) { renderBackground(graphics); super.render(graphics, mouseX, mouseY, delta); renderTooltip(graphics, mouseX, mouseY); } @Override protected void renderBg(GuiGraphics graphics, float delta, int mouseX, int mouseY) { int x = (width - imageWidth) / 2; int y = (height - imageHeight) / 2; graphics.blit(getTexture(), x, y, 0, 0, imageWidth, imageHeight); } @Override protected void renderLabels(GuiGraphics graphics, int mouseX, int mouseY) { if (shouldRenderLabels()) { super.renderLabels(graphics, mouseX, mouseY); } } }