superb-warfare/src/main/java/com/atsuishio/superbwarfare/client/screens/SuperbItemInterfaceScreen.java
2025-06-22 01:55:48 +08:00

37 lines
1.6 KiB
Java

package com.atsuishio.superbwarfare.client.screens;
import com.atsuishio.superbwarfare.menu.SuperbItemInterfaceMenu;
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;
import net.neoforged.api.distmarker.Dist;
import net.neoforged.api.distmarker.OnlyIn;
import org.jetbrains.annotations.NotNull;
@OnlyIn(Dist.CLIENT)
public class SuperbItemInterfaceScreen extends AbstractContainerScreen<SuperbItemInterfaceMenu> {
private static final ResourceLocation HOPPER_LOCATION = ResourceLocation.withDefaultNamespace("textures/gui/container/hopper.png");
public SuperbItemInterfaceScreen(SuperbItemInterfaceMenu menu, Inventory playerInventory, Component title) {
super(menu, playerInventory, title);
this.imageHeight = 133;
this.inventoryLabelY = this.imageHeight - 94;
}
@Override
public void render(@NotNull GuiGraphics guiGraphics, int mouseX, int mouseY, float partialTick) {
this.renderBackground(guiGraphics, mouseX, mouseY, partialTick);
super.render(guiGraphics, mouseX, mouseY, partialTick);
this.renderTooltip(guiGraphics, mouseX, mouseY);
}
@Override
protected void renderBg(GuiGraphics guiGraphics, float partialTick, int mouseX, int mouseY) {
int i = (this.width - this.imageWidth) / 2;
int j = (this.height - this.imageHeight) / 2;
guiGraphics.blit(HOPPER_LOCATION, i, j, 0, 0, this.imageWidth, this.imageHeight);
}
}