Skip to content

Commit d242166

Browse files
authored
Merge pull request #33 from leumasme/master
Fix crash with CombatHotbar
2 parents a2fbe0c + b1b5644 commit d242166

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

src/main/java/shukaro/warptheory/handlers/warpevents/WarpInventoryScramble.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,12 @@ public WarpInventoryScramble(int minWarp) {
1818
super("inventoryscramble", minWarp);
1919
}
2020

21+
@Override
22+
public boolean canDo(World world, EntityPlayer player) {
23+
// Combat Hotbar slots are not in the main inventory.
24+
return player.inventory.currentItem < player.inventory.mainInventory.length;
25+
}
26+
2127
@Override
2228
public boolean doEvent(World world, EntityPlayer player) {
2329
if (world.isRemote) return true;

src/main/java/shukaro/warptheory/handlers/warpevents/WarpInventorySwap.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,8 @@ public boolean doEvent(World world, EntityPlayer player) {
3333
}
3434
}
3535

36-
boolean canSwapHandItem = player.inventory.getCurrentItem() != null && !emptySlots.isEmpty();
36+
boolean canSwapHandItem = player.inventory.getCurrentItem() != null && !emptySlots.isEmpty()
37+
&& player.inventory.currentItem < player.inventory.mainInventory.length;
3738
boolean canSwapInventory = !fullSlots.isEmpty();
3839
if (canSwapHandItem && canSwapInventory) {
3940
// Pick one of the two to do.

0 commit comments

Comments
 (0)