diff options
-rwxr-xr-x | src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonSecret.java | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonSecret.java b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonSecret.java index d806b7c5..48ec30f6 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonSecret.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonSecret.java @@ -58,10 +58,14 @@ public class DungeonSecret implements DungeonMechanic { IBlockState blockState = DungeonsGuide.getDungeonsGuide().getBlockCache().getBlockState(pos); if (blockState.getBlock() == Blocks.chest || blockState.getBlock() == Blocks.trapped_chest) { TileEntityChest chest = (TileEntityChest) dungeonRoom.getContext().getWorld().getTileEntity(pos); - if (chest.numPlayersUsing > 0) { - dungeonRoom.getRoomContext().put("c-" + pos.toString(), 2); + if(chest != null){ + if (chest.numPlayersUsing > 0) { + dungeonRoom.getRoomContext().put("c-" + pos.toString(), 2); + } else { + dungeonRoom.getRoomContext().put("c-" + pos.toString(), 1); + } } else { - dungeonRoom.getRoomContext().put("c-" + pos.toString(), 1); + System.out.println("Expected TileEntityChest at " + pos + " to not be null"); } } } else if (secretType == SecretType.ESSENCE) { |