diff options
author | Eryk Ruta <70776766+kingstefan26@users.noreply.github.com> | 2022-11-04 15:03:46 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-11-04 23:03:46 +0900 |
commit | 923e39f3c1d739cf86fa98d179e6521ade71bdec (patch) | |
tree | 260955124d4412387be52a2b0fdd13535f293b37 /src | |
parent | 292fbd05e13271ca3ad99ebe00ae4302e04848f3 (diff) | |
download | Skyblock-Dungeons-Guide-923e39f3c1d739cf86fa98d179e6521ade71bdec.tar.gz Skyblock-Dungeons-Guide-923e39f3c1d739cf86fa98d179e6521ade71bdec.tar.bz2 Skyblock-Dungeons-Guide-923e39f3c1d739cf86fa98d179e6521ade71bdec.zip |
fix null pointer when opening mimic chest (#72)
Diffstat (limited to 'src')
-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) { |