Fix compile error

This commit is contained in:
zontreck 2024-01-14 19:20:53 -07:00
parent 66a7c382cd
commit 2e0dce868b
2 changed files with 12 additions and 1 deletions

View file

@ -83,6 +83,7 @@ public class ChestGUI
return this;
}
buttons.add(button);
button.withContainer(container);
container.setStackInSlot(button.getSlotNum(), button.buildIcon());
return this;
@ -113,6 +114,7 @@ public class ChestGUI
ItemStack remStack = new ItemStack(ModItems.CHESTGUI_REM.get(), 1);
ChestGUIButton rem = new ChestGUIButton(remStack, onRemove, new Vector2i(2, 3));
rem.withContainer(container);
removeBtn = rem;
@ -124,6 +126,7 @@ public class ChestGUI
ItemStack resStack = new ItemStack(ModItems.CHESTGUI_RESET.get(), 1);
ChestGUIButton rem = new ChestGUIButton(resStack, onReset, new Vector2i(2, 4));
rem.withContainer(container);
resetBtn = rem;
@ -137,6 +140,7 @@ public class ChestGUI
ItemStack remStack = new ItemStack(ModItems.CHESTGUI_ADD.get(), 1);
ChestGUIButton rem = new ChestGUIButton(remStack, onAdd, new Vector2i(2, 5));
rem.withContainer(container);
addBtn = rem;

View file

@ -28,6 +28,7 @@ public class ChestGUIButton
*/
private Vector2i position;
private ItemStack built;
private ItemStackHandler container;
/**
* Sets the name of the ChestGUI Button (Item Name)
@ -102,6 +103,12 @@ public class ChestGUIButton
return st;
}
protected ChestGUIButton withContainer(ItemStackHandler handler)
{
this.container=handler;
return this;
}
/**
* Adds a line to the Lore (Tooltip) of the button
* @param line The line to add
@ -147,6 +154,6 @@ public class ChestGUIButton
public void clicked()
{
callback.run(built);
callback.run(built, container);
}
}