Skip to content

Commit

Permalink
Fix IndexOutOfBoundsException (mc???)
Browse files Browse the repository at this point in the history
  • Loading branch information
Fesaa committed Jan 2, 2024
1 parent 2983e84 commit fc4de31
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,12 @@ private void handleInventoryMouseClick(int $$0, int $$1, int $$2, ClickType $$3,
cubepanion$addon = Cubepanion.get();
}
AbstractContainerMenu inv = $$4.containerMenu;
Slot slot = inv.getSlot($$1);
Slot slot;
try {
slot = inv.getSlot($$1);
} catch (IndexOutOfBoundsException e) {
return;
}
ItemStack itemStack = slot.getItem();
if ((itemStack.is(ItemTags.TOOLS) || itemStack.is(Items.BOW)
|| itemStack.getItem() instanceof ArmorItem)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,12 @@ private void handleInventoryMouseClick(int $$0, int $$1, int $$2, ClickType $$3,
cubepanion$addon = Cubepanion.get();
}
AbstractContainerMenu inv = $$4.containerMenu;
Slot slot = inv.getSlot($$1);
Slot slot;
try {
slot = inv.getSlot($$1);
} catch (IndexOutOfBoundsException e) {
return;
}
ItemStack itemStack = slot.getItem();
if ((itemStack.is(ItemTags.TOOLS) || itemStack.is(Items.BOW)
|| itemStack.getItem() instanceof ArmorItem)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,12 @@ private void handleInventoryMouseClick(int $$0, int $$1, int $$2, ClickType $$3,
cubepanion$addon = Cubepanion.get();
}
AbstractContainerMenu inv = $$4.containerMenu;
Slot slot = inv.getSlot($$1);
Slot slot;
try {
slot = inv.getSlot($$1);
} catch (IndexOutOfBoundsException e) {
return;
}
ItemStack itemStack = slot.getItem();
if ((itemStack.is(ItemTags.TOOLS) || itemStack.is(Items.BOW)
|| itemStack.getItem() instanceof ArmorItem)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,12 @@ private void handleInventoryMouseClick(int $$0, int $$1, int $$2, ClickType $$3,
cubepanion$addon = Cubepanion.get();
}
AbstractContainerMenu inv = $$4.containerMenu;
Slot slot = inv.getSlot($$1);
Slot slot;
try {
slot = inv.getSlot($$1);
} catch (IndexOutOfBoundsException e) {
return;
}
ItemStack itemStack = slot.getItem();
if ((itemStack.is(ItemTags.TOOLS) || itemStack.is(Items.BOW)
|| itemStack.getItem() instanceof ArmorItem)
Expand Down

0 comments on commit fc4de31

Please sign in to comment.