37 lines
1.4 KiB
Java
37 lines
1.4 KiB
Java
package net.minecraft.client.gui.screens.inventory;
|
|
|
|
import net.fabricmc.api.EnvType;
|
|
import net.fabricmc.api.Environment;
|
|
import net.minecraft.client.gui.GuiGraphics;
|
|
import net.minecraft.client.renderer.RenderType;
|
|
import net.minecraft.network.chat.Component;
|
|
import net.minecraft.resources.ResourceLocation;
|
|
import net.minecraft.world.entity.player.Inventory;
|
|
import net.minecraft.world.inventory.HopperMenu;
|
|
|
|
@Environment(EnvType.CLIENT)
|
|
public class HopperScreen extends AbstractContainerScreen<HopperMenu> {
|
|
/**
|
|
* The ResourceLocation containing the gui texture for the hopper
|
|
*/
|
|
private static final ResourceLocation HOPPER_LOCATION = ResourceLocation.withDefaultNamespace("textures/gui/container/hopper.png");
|
|
|
|
public HopperScreen(HopperMenu menu, Inventory playerInventory, Component title) {
|
|
super(menu, playerInventory, title);
|
|
this.imageHeight = 133;
|
|
this.inventoryLabelY = this.imageHeight - 94;
|
|
}
|
|
|
|
@Override
|
|
public void render(GuiGraphics guiGraphics, int mouseX, int mouseY, float 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(RenderType::guiTextured, HOPPER_LOCATION, i, j, 0.0F, 0.0F, this.imageWidth, this.imageHeight, 256, 256);
|
|
}
|
|
}
|