Skip to content
This repository was archived by the owner on Oct 25, 2025. It is now read-only.
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,13 @@ public GemCuttingMenu(int id, Inventory playerInv, ContainerLevelAccess access)
super(Menus.GEM_CUTTING, id, playerInv);
this.player = playerInv.player;
this.access = access;
this.addSlot(new UpdatingSlot(this.inventory, 0, 62, 45, stack -> GemItem.getGem(stack).isBound()));
this.addSlot(new UpdatingSlot(this.inventory, 0, 62, 45, stack -> stack.getCount() == 1 && GemItem.getGem(stack).isBound()));
this.addSlot(new UpdatingSlot(this.inventory, 1, 90, 64, stack -> stack.getItem() == Items.GEM_DUST));
this.addSlot(new UpdatingSlot(this.inventory, 2, 33, 64, this::matchesMainGem));
this.addSlot(new UpdatingSlot(this.inventory, 3, 62, 12, this::isValidMaterial));

this.addPlayerSlots(playerInv, 8, 98);
this.mover.registerRule((stack, slot) -> slot >= this.playerInvStart && this.inventory.getItem(0).isEmpty() && GemCuttingMenu.isValidMainGem(stack), 0, 1);
this.mover.registerRule((stack, slot) -> slot >= this.playerInvStart && this.inventory.getItem(0).isEmpty() && GemCuttingMenu.isValidMainGem(stack) && stack.getCount() == 1, 0, 1);
this.mover.registerRule((stack, slot) -> slot >= this.playerInvStart && stack.getItem() == Items.GEM_DUST, 1, 2);
this.mover.registerRule((stack, slot) -> slot >= this.playerInvStart && this.matchesMainGem(stack), 2, 3);
this.mover.registerRule((stack, slot) -> slot >= this.playerInvStart && this.isValidMaterial(stack), 3, 4);
Expand All @@ -65,6 +65,10 @@ public GemCuttingMenu(int id, Inventory playerInv, ContainerLevelAccess access)
public boolean clickMenuButton(Player player, int id) {
if (id == 0) {
ItemStack gem = this.inventory.getItem(0);
if (gem.getCount() > 1)
{
return false;
}
ItemStack left = this.inventory.getItem(1);
ItemStack bot = this.inventory.getItem(2);
ItemStack right = this.inventory.getItem(3);
Expand All @@ -84,7 +88,7 @@ public boolean clickMenuButton(Player player, int id) {

public static boolean isValidMainGem(ItemStack stack) {
GemInstance inst = GemInstance.unsocketed(stack);
return inst.isValidUnsocketed() && !inst.isMaxRarity();
return inst.isValidUnsocketed() && !inst.isMaxRarity() && stack.getCount() == 1;
}

protected boolean isValidMaterial(ItemStack stack) {
Expand Down