39 lines
1.5 KiB
Java
39 lines
1.5 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.gui.navigation.ScreenPosition;
|
|
import net.minecraft.client.gui.screens.recipebook.CraftingRecipeBookComponent;
|
|
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.CraftingMenu;
|
|
|
|
@Environment(EnvType.CLIENT)
|
|
public class CraftingScreen extends AbstractRecipeBookScreen<CraftingMenu> {
|
|
private static final ResourceLocation CRAFTING_TABLE_LOCATION = ResourceLocation.withDefaultNamespace("textures/gui/container/crafting_table.png");
|
|
|
|
public CraftingScreen(CraftingMenu menu, Inventory playerInventory, Component title) {
|
|
super(menu, new CraftingRecipeBookComponent(menu), playerInventory, title);
|
|
}
|
|
|
|
@Override
|
|
protected void init() {
|
|
super.init();
|
|
this.titleLabelX = 29;
|
|
}
|
|
|
|
@Override
|
|
protected ScreenPosition getRecipeBookButtonPosition() {
|
|
return new ScreenPosition(this.leftPos + 5, this.height / 2 - 49);
|
|
}
|
|
|
|
@Override
|
|
protected void renderBg(GuiGraphics guiGraphics, float partialTick, int mouseX, int mouseY) {
|
|
int i = this.leftPos;
|
|
int j = (this.height - this.imageHeight) / 2;
|
|
guiGraphics.blit(RenderType::guiTextured, CRAFTING_TABLE_LOCATION, i, j, 0.0F, 0.0F, this.imageWidth, this.imageHeight, 256, 256);
|
|
}
|
|
}
|