New Anvil Recipe System

This commit is contained in:
Kam committed 2025-02-10 02:44:28 -05:00
1 parent 9cda5503ed
commit 48dd7bedea
15 files changed
+592 -221

No files matched your search

@@ -9,11 +9,14 @@ import net.minecraft.client.gui.GuiButton;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.StatCollector;
import noppes.npcs.client.CustomNpcResourceListener;
import noppes.npcs.client.NoppesUtil;
import noppes.npcs.client.gui.util.*;
import noppes.npcs.constants.EnumGuiType;
import noppes.npcs.containers.ContainerManageRecipes;
import noppes.npcs.controllers.data.RecipeAnvil;
import noppes.npcs.controllers.data.RecipeCarpentry;
import noppes.npcs.entity.EntityNPCInterface;
import org.lwjgl.opengl.GL11;
@@ -23,9 +26,10 @@ import java.util.HashMap;
import java.util.List;
import java.util.Vector;
public class GuiNpcManageRecipes extends GuiContainerNPCInterface2 implements IScrollData, IGuiData, ICustomScrollListener,ITextfieldListener{
private GuiCustomScroll scroll;
private HashMap<String,Integer> data = new HashMap<String,Integer>();
public class GuiNpcManageRecipes extends GuiContainerNPCInterface2 implements IScrollData, IGuiData, ICustomScrollListener, ITextfieldListener, ISubGuiListener {
public static int tab = 1;
public GuiCustomScroll scroll;
public HashMap<String,Integer> data = new HashMap<String,Integer>();
private ContainerManageRecipes container;
private String selected = null;
private ResourceLocation slot;
@@ -39,6 +43,7 @@ public class GuiNpcManageRecipes extends GuiContainerNPCInterface2 implements IS
setBackground("inventorymenu.png");
slot = getResource("slot.png");
ySize = 200;
tab = 1;
}
@Override
@@ -47,49 +52,91 @@ public class GuiNpcManageRecipes extends GuiContainerNPCInterface2 implements IS
if(scroll == null)
scroll = new GuiCustomScroll(this,0,0);
scroll.setSize(130, 180);
scroll.guiLeft = guiLeft + 172;
scroll.guiTop = guiTop + 8;
scroll.setSize(130, 150);
scroll.guiLeft = guiLeft + 280;
scroll.guiTop = guiTop + 38;
addScroll(scroll);
this.addButton(new GuiNpcButton(0,guiLeft + 306, guiTop + 10, 84, 20, "menu.global"));
this.addButton(new GuiNpcButton(1,guiLeft + 306, guiTop + 32, 84, 20, "tile.npcCarpentyBench.name"));
this.getButton(0).setEnabled(container.width == 4);
this.getButton(1).setEnabled(container.width == 3);
int y = guiTop + 10;
this.addButton(new GuiNpcButton(3,guiLeft + 306, guiTop + 60, 84, 20, "gui.add"));
this.addButton(new GuiNpcButton(4,guiLeft + 306, guiTop + 82, 84, 20, "gui.remove"));
this.addButton(new GuiButtonBiDirectional(0,guiLeft + 280, y, 130, 20, new String[]{"menu.global", "tile.npcCarpentyBench.name", "tile.anvil.name"}, tab));
this.addLabel(new GuiNpcLabel(0, "gui.ignoreDamage", guiLeft + 86, guiTop + 32));
this.addButton(new GuiNpcButtonYesNo(5,guiLeft + 114, guiTop + 40, 50, 20, container.recipe.ignoreDamage));
y+= 106;
this.addLabel(new GuiNpcLabel(1, "gui.ignoreNBT", guiLeft + 86, guiTop + 82));
this.addButton(new GuiNpcButtonYesNo(6,guiLeft + 114, guiTop + 90, 50, 20, container.recipe.ignoreNBT));
this.addButton(new GuiNpcButton(3,guiLeft + 226, y += 22, 50, 20, "gui.add"));
this.addButton(new GuiNpcButton(4,guiLeft + 226, y += 22, 50, 20, "gui.remove"));
this.addButton(new GuiNpcButton(10,guiLeft + 226, y += 30, 50, 20, "gui.copy"));
this.addTextField(new GuiNpcTextField(0, this, fontRendererObj, guiLeft + 8, guiTop + 8, 160, 20, container.recipe.name));
this.getTextField(0).enabled = false;
this.getButton(5).setEnabled(false);
this.getButton(6).setEnabled(false);
if (container.width != 1) {
int buttonPos = guiTop + 72;
this.addLabel(new GuiNpcLabel(0, "gui.ignoreDamage", guiLeft + 131, buttonPos));
this.addButton(new GuiNpcButtonYesNo(5, guiLeft + 235, buttonPos - 5, 40, 20, container.recipe.ignoreDamage));
this.addLabel(new GuiNpcLabel(1, "gui.ignoreNBT", guiLeft + 131, buttonPos += 22));
this.addButton(new GuiNpcButtonYesNo(6, guiLeft + 235, buttonPos - 5, 40, 20, container.recipe.ignoreNBT));
this.getButton(5).setEnabled(false);
this.getButton(6).setEnabled(false);
this.addTextField(new GuiNpcTextField(55, this, fontRendererObj, guiLeft + 172, guiTop + 8 + 3 + 180, 130, 20, search));
this.addTextField(new GuiNpcTextField(0, this, fontRendererObj, guiLeft + 8, guiTop + 8, 160, 20, container.recipe.name));
this.getTextField(0).enabled = false;
} else {
int buttonPos = guiTop + 50;
this.addLabel(new GuiNpcLabel(0, "gui.ignoreMatDamage", guiLeft + 131, buttonPos));
this.addButton(new GuiNpcButtonYesNo(7, guiLeft + 235, buttonPos - 5, 40, 20, container.recipeAnvil.ignoreRepairMaterialDamage));
this.addLabel(new GuiNpcLabel(1, "gui.ignoreMatNBT", guiLeft + 131, buttonPos += 22));
this.addButton(new GuiNpcButtonYesNo(8, guiLeft + 235, buttonPos - 5, 40, 20, container.recipeAnvil.ignoreRepairMaterialNBT));
this.addLabel(new GuiNpcLabel(11, "gui.repairPercent", guiLeft + 8, buttonPos));
this.addTextField(new GuiNpcTextField(1, this, fontRendererObj, guiLeft + 90, buttonPos - 5, 35, 20, container.recipeAnvil.getRepairPercentage() + ""));
this.getTextField(1).floatsOnly = true;
this.getTextField(1).setMinMaxDefaultFloat(1, 100, container.recipeAnvil.getRepairPercentage());
this.getTextField(1).enabled = false;
this.addLabel(new GuiNpcLabel(2, "gui.ignoreItemNBT", guiLeft + 131, buttonPos += 22));
this.addButton(new GuiNpcButtonYesNo(9, guiLeft + 235, buttonPos - 5, 40, 20, container.recipeAnvil.ignoreRepairItemNBT));
this.addLabel(new GuiNpcLabel(12, "gui.xpCost", guiLeft + 8, buttonPos));
this.addTextField(new GuiNpcTextField(2, this, fontRendererObj, guiLeft + 70, buttonPos - 5, 55, 20, container.recipeAnvil.getXpCost() + ""));
this.getTextField(2).integersOnly = true;
this.getTextField(2).setMinMaxDefault(0, Integer.MAX_VALUE, container.recipeAnvil.getXpCost());
this.getTextField(2).enabled = false;
this.getButton(7).setEnabled(false);
this.getButton(8).setEnabled(false);
this.getButton(9).setEnabled(false);
this.addTextField(new GuiNpcTextField(0, this, fontRendererObj, guiLeft + 8, guiTop + 8, 160, 20, container.recipeAnvil.name));
this.getTextField(0).enabled = false;
}
this.addTextField(new GuiNpcTextField(55, this, fontRendererObj, guiLeft + 280, guiTop + 8 + 3 + 180, 130, 20, search));
}
@Override
protected void actionPerformed(GuiButton guibutton){
GuiNpcButton button = (GuiNpcButton) guibutton;
if(button.id == 0){
getTextField(55).setText("");
search = "";
scroll.clear();
save();
NoppesUtil.requestOpenGUI(EnumGuiType.ManageRecipes,3,0,0);
}
if(button.id == 1){
getTextField(55).setText("");
search = "";
scroll.clear();
save();
NoppesUtil.requestOpenGUI(EnumGuiType.ManageRecipes,4,0,0);
GuiButtonBiDirectional buttonBiDirectional = (GuiButtonBiDirectional) button;
tab = buttonBiDirectional.getValue();
if(tab == 0){
getTextField(55).setText("");
search = "";
scroll.clear();
save();
NoppesUtil.requestOpenGUI(EnumGuiType.ManageRecipes,3,0,0);
} else if (tab == 1){
getTextField(55).setText("");
search = "";
scroll.clear();
save();
NoppesUtil.requestOpenGUI(EnumGuiType.ManageRecipes,4,0,0);
} else {
getTextField(55).setText("");
search = "";
scroll.clear();
save();
NoppesUtil.requestOpenGUI(EnumGuiType.ManageRecipes,1,0,0);
}
}
if(button.id == 3){
save();
@@ -97,13 +144,21 @@ public class GuiNpcManageRecipes extends GuiContainerNPCInterface2 implements IS
String name = "New";
while(data.containsKey(name))
name += "_";
RecipeCarpentry recipe = new RecipeCarpentry(name);
recipe.isGlobal = container.width == 3;
PacketClient.sendClient(new RecipeSavePacket(recipe.writeNBT()));
if(container.width == 1){
RecipeAnvil recipe = new RecipeAnvil();
recipe.name = name;
PacketClient.sendClient(new RecipeSavePacket(recipe.writeNBT()));
}
else {
RecipeCarpentry recipe = new RecipeCarpentry(name);
recipe.isGlobal = container.width == 3;
PacketClient.sendClient(new RecipeSavePacket(recipe.writeNBT()));
}
}
if(button.id == 4){
if(data.containsKey(scroll.getSelected())){
PacketClient.sendClient(new RecipeRemovePacket(data.get(scroll.getSelected())));
PacketClient.sendClient(new RecipeRemovePacket(data.get(scroll.getSelected()), container.width == 1));
scroll.clear();
}
}
@@ -113,6 +168,15 @@ public class GuiNpcManageRecipes extends GuiContainerNPCInterface2 implements IS
if(button.id == 6){
container.recipe.ignoreNBT = button.getValue() == 1;
}
if (button.id == 7) {
container.recipeAnvil.ignoreRepairMaterialDamage = button.getValue() == 1;
}
if (button.id == 8) {
container.recipeAnvil.ignoreRepairMaterialNBT = button.getValue() == 1;
}
if (button.id == 9) {
container.recipeAnvil.ignoreRepairItemNBT = button.getValue() == 1;
}
}
@Override
@@ -142,18 +206,49 @@ public class GuiNpcManageRecipes extends GuiContainerNPCInterface2 implements IS
return list;
}
@Override
public void setGuiData(NBTTagCompound compound) {
RecipeCarpentry recipe = RecipeCarpentry.read(compound);
getTextField(0).setText(recipe.name);
container.setRecipe(recipe);
this.getTextField(0).enabled = true;
this.getButton(5).setEnabled(true);
this.getButton(5).setDisplay(recipe.ignoreDamage?1:0);
this.getButton(6).setEnabled(true);
this.getButton(6).setDisplay(recipe.ignoreNBT?1:0);
setSelected(recipe.name);
}
@Override
public void setGuiData(NBTTagCompound compound) {
if (compound.hasKey("IsAnvil")) {
RecipeAnvil recipe = RecipeAnvil.read(compound);
getTextField(0).setText(recipe.name);
getTextField(1).setText(recipe.getRepairPercentage() + "");
getTextField(2).setText(recipe.getXpCost() + "");
container.setRecipe(recipe);
setSelected(recipe.name);
getTextField(0).enabled = true;
getTextField(1).enabled = true;
getTextField(2).enabled = true;
container.width = 1;
GuiNpcButtonYesNo btnMatDamage = (GuiNpcButtonYesNo)this.getButton(7);
GuiNpcButtonYesNo btnMatNBT = (GuiNpcButtonYesNo)this.getButton(8);
GuiNpcButtonYesNo btnItemNBT = (GuiNpcButtonYesNo)this.getButton(9);
if (btnMatDamage != null) {
btnMatDamage.setDisplay(recipe.ignoreRepairMaterialDamage ? 1 : 0);
btnMatDamage.setEnabled(true);
}
if (btnMatNBT != null) {
btnMatNBT.setDisplay(recipe.ignoreRepairMaterialNBT ? 1 : 0);
btnMatNBT.setEnabled(true);
}
if (btnItemNBT != null) {
btnItemNBT.setDisplay(recipe.ignoreRepairItemNBT ? 1 : 0);
btnItemNBT.setEnabled(true);
}
} else {
RecipeCarpentry recipe = RecipeCarpentry.read(compound);
getTextField(0).setText(recipe.name);
container.setRecipe(recipe);
this.getTextField(0).enabled = true;
this.getButton(5).setEnabled(true);
this.getButton(5).setDisplay(recipe.ignoreDamage ? 1 : 0);
this.getButton(6).setEnabled(true);
this.getButton(6).setDisplay(recipe.ignoreNBT ? 1 : 0);
setSelected(recipe.name);
}
}
@Override
protected void drawGuiContainerBackgroundLayer(float f, int x, int y){
@@ -166,16 +261,29 @@ public class GuiNpcManageRecipes extends GuiContainerNPCInterface2 implements IS
drawTexturedModalRect(guiLeft + i*18 + 7, guiTop + j*18 + 34, 0, 0, 18, 18);
}
}
drawTexturedModalRect(guiLeft + 86, guiTop + 60, 0, 0, 18, 18);
if(container.width == 1){
drawTexturedModalRect(guiLeft + 101, guiTop + 34, 0, 0, 18, 18);
this.fontRendererObj.drawString(StatCollector.translateToLocal("gui.material"), guiLeft + 28, guiTop + 38, CustomNpcResourceListener.DefaultTextColor);
} else {
drawTexturedModalRect(guiLeft + 86, guiTop + 60, 0, 0, 18, 18);
}
}
@Override
public void setData(Vector<String> list, HashMap<String, Integer> data) {
String name = scroll.getSelected();
this.data = data;
scroll.setList(getSearchList());
this.getTextField(0).enabled = name != null;
this.getTextField(0).enabled = name != null;
this.getButton(5).setEnabled(name != null);
if(container.width == 1){
this.getButton(7).setEnabled(name != null);
this.getButton(8).setEnabled(name != null);
this.getButton(9).setEnabled(name != null);
} else {
this.getButton(5).setEnabled(name != null);
this.getButton(6).setEnabled(name != null);
}
if(name != null)
scroll.setSelected(name);
@@ -191,7 +299,11 @@ public class GuiNpcManageRecipes extends GuiContainerNPCInterface2 implements IS
public void customScrollClicked(int i, int j, int k, GuiCustomScroll guiCustomScroll) {
save();
selected = scroll.getSelected();
PacketClient.sendClient(new RecipeGetPacket(data.get(selected)));
if(container.width == 1){
PacketClient.sendClient(new RecipeGetPacket(data.get(selected), true));
} else {
PacketClient.sendClient(new RecipeGetPacket(data.get(selected), false));
}
}
@Override
@@ -199,7 +311,11 @@ public class GuiNpcManageRecipes extends GuiContainerNPCInterface2 implements IS
GuiNpcTextField.unfocus();
if(selected != null && data.containsKey(selected)){
container.saveRecipe();
PacketClient.sendClient(new RecipeSavePacket(container.recipe.writeNBT()));
if(container.width == 1){
PacketClient.sendClient(new RecipeSavePacket(container.recipeAnvil.writeNBT()));
} else {
PacketClient.sendClient(new RecipeSavePacket(container.recipe.writeNBT()));
}
}
}
@@ -208,13 +324,39 @@ public class GuiNpcManageRecipes extends GuiContainerNPCInterface2 implements IS
if(guiNpcTextField.id == 0){
String name = guiNpcTextField.getText();
if(!name.isEmpty() && !data.containsKey(name)){
String old = container.recipe.name;
data.remove(container.recipe.name);
container.recipe.name = name;
data.put(container.recipe.name, container.recipe.id);
selected = name;
scroll.replace(old,container.recipe.name);
if(container.width == 1){
String old = container.recipeAnvil.name;
data.remove(container.recipeAnvil.name);
container.recipeAnvil.name = name;
data.put(container.recipeAnvil.name, container.recipeAnvil.id);
selected = name;
scroll.replace(old,container.recipeAnvil.name);
} else {
String old = container.recipe.name;
data.remove(container.recipe.name);
container.recipe.name = name;
data.put(container.recipe.name, container.recipe.id);
selected = name;
scroll.replace(old,container.recipe.name);
}
}
}
if(guiNpcTextField.id == 1){
float percent = guiNpcTextField.getFloat();
if(container.width == 1){
container.recipeAnvil.repairPercentage = percent;
}
}
if(guiNpcTextField.id == 2){
int xpCost = guiNpcTextField.getInteger();
if(container.width == 1){
container.recipeAnvil.xpCost = xpCost;
}
}
}
@Override
public void subGuiClosed(SubGuiInterface subgui){
}
}
@@ -3,6 +3,7 @@ package noppes.npcs.client.gui.player;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import noppes.npcs.client.CustomNpcResourceListener;
@@ -109,6 +110,28 @@ public class GuiAnvilRecipes extends GuiNPCInterface {
updateButton();
}
private static class ItemOverlayData {
public final int x, y;
public final ItemStack item;
public ItemOverlayData(int x, int y, ItemStack item) {
this.x = x;
this.y = y;
this.item = item;
}
}
private static class TextOverlayData {
public final int x, y, width, height;
public final String text;
public TextOverlayData(int x, int y, int width, int height, String text) {
this.x = x;
this.y = y;
this.width = width;
this.height = height;
this.text = text;
}
}
@Override
public void drawScreen(int mouseX, int mouseY, float partialTicks) {
super.drawScreen(mouseX, mouseY, partialTicks);
@@ -117,22 +140,25 @@ public class GuiAnvilRecipes extends GuiNPCInterface {
lblPage.label = (page + 1) + "/" + MathHelper.ceiling_float_int(recipes.size() / 8.0F);
lblPage.x = guiLeft + (xSize - Minecraft.getMinecraft().fontRenderer.getStringWidth(lblPage.label)) / 2;
// Determine which recipes to show.
int recipesPerPage = 8;
int startIndex = page * recipesPerPage;
int endIndex = Math.min(recipes.size(), startIndex + recipesPerPage);
// Set base positions: first column X and first row Y.
// Base positions relative to guiLeft and guiTop.
int baseX = guiLeft + 4;
int baseY = guiTop + 28; // first row Y = 28
int baseY = guiTop + 28; // first row = guiTop + 28
int colSpacing = 124; // horizontal spacing between columns
int rowSpacing = 35; // vertical spacing so row1 becomes 28+35 = 63
int rowSpacing = 35; // vertical spacing so row1 = guiTop + 28 + 35
// Create lists to collect overlay data.
List<ItemOverlayData> itemOverlays = new ArrayList<ItemOverlayData>();
List<TextOverlayData> textOverlays = new ArrayList<TextOverlayData>();
for (int i = startIndex; i < endIndex; i++) {
RecipeAnvil recipe = recipes.get(i);
int localIndex = i - startIndex; // 0 to 7
int col = localIndex / 4; // 0 for left column, 1 for right column
int row = localIndex % 4; // 0 to 3
int col = localIndex / 4; // 0 for left column, 1 for right column
int row = localIndex % 4; // rows 0..3
int slotX = baseX + col * colSpacing;
int slotY = baseY + row * rowSpacing;
@@ -147,59 +173,91 @@ public class GuiAnvilRecipes extends GuiNPCInterface {
// Draw the item-to-repair at 50% durability.
ItemStack toRepair = recipe.itemToRepair;
ItemStack halfItem = null;
if (toRepair != null) {
ItemStack halfItem = toRepair.copy();
halfItem = toRepair.copy();
if (halfItem.isItemStackDamageable()) {
int halfDamage = halfItem.getMaxDamage() / 2;
halfItem.setItemDamage(halfDamage);
}
drawItem(halfItem, slotX + 1, slotY + 1, mouseX, mouseY);
// Instead of drawing overlay immediately, add to list.
if (func_146978_c((slotX+1) - guiLeft, (slotY+1) - guiTop, 16, 16, mouseX, mouseY)) {
itemOverlays.add(new ItemOverlayData(slotX+1, slotY+1, halfItem));
}
}
// Draw the repair material.
ItemStack material = recipe.repairMaterial;
if (material != null) {
drawItem(material, slotX + 23, slotY + 1, mouseX, mouseY);
if (func_146978_c((slotX+23) - guiLeft, (slotY+1) - guiTop, 16, 16, mouseX, mouseY)) {
itemOverlays.add(new ItemOverlayData(slotX+23, slotY+1, material));
}
}
// Draw the output item fully repaired (damage = 0).
// For first column, output X = guiLeft+103; second column, output X = guiLeft+229.
int outputX = (col == 0) ? (guiLeft + 103) : (guiLeft + 229);
ItemStack fullOutput = null;
if (recipe.itemToRepair != null) {
ItemStack fullOutput = recipe.itemToRepair.copy();
fullOutput = recipe.itemToRepair.copy();
if (fullOutput.isItemStackDamageable()) {
fullOutput.setItemDamage(0);
}
drawItem(fullOutput, outputX, slotY, mouseX, mouseY);
if (func_146978_c(outputX - guiLeft, slotY - guiTop, 16, 16, mouseX, mouseY)) {
itemOverlays.add(new ItemOverlayData(outputX, slotY, fullOutput));
}
}
// Draw the percentage text.
// We want the "middle right" for the first column to be at 68.
// So for column 0, centerX is fixed at 68; for column 1, centerX is 68 + colSpacing.
int percentCenterX = (col == 0) ? (guiLeft + 57) : (guiLeft + 57 + colSpacing);
String percentText = Math.round(recipe.getRepairPercentage()) + "%";
int textWidth = fontRendererObj.getStringWidth(percentText);
int centerX = (col == 0) ? guiLeft + 57 : (guiLeft + 57 + colSpacing);
int textX = centerX - (textWidth / 2);
int textY = slotY + 4 + row;
fontRendererObj.drawString(percentText, textX, textY, CustomNpcResourceListener.DefaultTextColor);
int percentWidth = fontRendererObj.getStringWidth(percentText);
int percentTextX = percentCenterX - (percentWidth / 2);
int percentTextY = slotY + 4 + row;
fontRendererObj.drawString(percentText, percentTextX, percentTextY, CustomNpcResourceListener.DefaultTextColor);
// Add text overlay for percentage with the full unrounded value.
if (func_146978_c(percentTextX - guiLeft, percentTextY - guiTop, percentWidth, fontRendererObj.FONT_HEIGHT, mouseX, mouseY)) {
textOverlays.add(new TextOverlayData(percentTextX, percentTextY, percentWidth, fontRendererObj.FONT_HEIGHT, String.valueOf(recipe.getRepairPercentage())));
}
// Draw XP cost with scaling.
String xpCostStr = formatXpCost(recipe.getXpCost());
int digitCount = xpCostStr.length();
// Scale factor: for 1 digit = 1.0, for 2 digits = 0.9, for 3 digits = 0.8.
float xpScale = 1.0F - 0.1F * (digitCount - 1);
// Get raw text width.
int rawTextWidth = fontRendererObj.getStringWidth(xpCostStr);
int scaledTextWidth = (int)(rawTextWidth * xpScale);
int xpCenterX = (col == 0) ? (guiLeft + 76) : (guiLeft + 78 + colSpacing);
int xpTextX = xpCenterX - (scaledTextWidth / 2);
int xpTextY = slotY - 4 + row; // adjust as needed
int xpCenterX = (col == 0) ? (guiLeft + 76) : (guiLeft + 76 + colSpacing);
int xpTextX = xpCenterX - (scaledTextWidth / 2) + col;
int xpTextY = slotY - 4 + row;
GL11.glPushMatrix();
GL11.glTranslatef(xpTextX, xpTextY, 0);
GL11.glScalef(xpScale, xpScale, 1.0F);
fontRendererObj.drawString(xpCostStr, 0, 0, 0x4ac26a);
GL11.glPopMatrix();
// Add text overlay for XP cost with the full (unformatted) number.
int xpBoxWidth = scaledTextWidth;
int xpBoxHeight = fontRendererObj.FONT_HEIGHT;
if (func_146978_c(xpTextX - guiLeft, xpTextY - guiTop, xpBoxWidth, xpBoxHeight, mouseX, mouseY)) {
textOverlays.add(new TextOverlayData(xpTextX, xpTextY, xpBoxWidth, xpBoxHeight, String.valueOf(recipe.getXpCost())));
}
}
for (ItemOverlayData iod : itemOverlays) {
this.renderToolTip(iod.item, mouseX, mouseY);
}
for (TextOverlayData tod : textOverlays) {
this.drawHoveringText(java.util.Arrays.asList(tod.text), mouseX, mouseY, this.fontRendererObj);
}
}
protected boolean func_146978_c(int p_146978_1_, int p_146978_2_, int p_146978_3_, int p_146978_4_, int p_146978_5_, int p_146978_6_) {
int k1 = this.guiLeft;
int l1 = this.guiTop;
p_146978_5_ -= k1;
p_146978_6_ -= l1;
return p_146978_5_ >= p_146978_1_ - 1 && p_146978_5_ < p_146978_1_ + p_146978_3_ + 1 && p_146978_6_ >= p_146978_2_ - 1 && p_146978_6_ < p_146978_2_ + p_146978_4_ + 1;
}
private String formatXpCost(int xp) {