From badde101ceb6b66d084f2697245843de8e94d74c Mon Sep 17 00:00:00 2001 From: Graham Hughes Date: Mon, 13 Apr 2015 18:26:50 -0700 Subject: [PATCH 1/2] Prevent NPE if block is not a tile entity. --- .../jaquadro/minecraft/storagedrawers/block/BlockDrawers.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/com/jaquadro/minecraft/storagedrawers/block/BlockDrawers.java b/src/com/jaquadro/minecraft/storagedrawers/block/BlockDrawers.java index fa1c813aa..ddf5aff64 100644 --- a/src/com/jaquadro/minecraft/storagedrawers/block/BlockDrawers.java +++ b/src/com/jaquadro/minecraft/storagedrawers/block/BlockDrawers.java @@ -342,7 +342,8 @@ public boolean isSideSolid (IBlockAccess world, int x, int y, int z, ForgeDirect return false; } - if (side.ordinal() != getTileEntity(world, x, y, z).getDirection()) + if (getTileEntity(world, x, y, z) == null) return true; + if (side.ordinal() != getTileEntity(world, x, y, z).getDirection()) return true; return false; From 0a07a348226843098d94badb9b2a171117233c83 Mon Sep 17 00:00:00 2001 From: Graham Hughes Date: Mon, 13 Apr 2015 18:27:25 -0700 Subject: [PATCH 2/2] Add failsafe depth limiter. The original code can fail sometimes in cases like two drawer controllers next to one another. --- .../storagedrawers/block/tile/TileEntityController.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/com/jaquadro/minecraft/storagedrawers/block/tile/TileEntityController.java b/src/com/jaquadro/minecraft/storagedrawers/block/tile/TileEntityController.java index 43b13877d..32b17ae73 100644 --- a/src/com/jaquadro/minecraft/storagedrawers/block/tile/TileEntityController.java +++ b/src/com/jaquadro/minecraft/storagedrawers/block/tile/TileEntityController.java @@ -208,6 +208,7 @@ private void populateNode (int x, int y, int z, int depth) { TileEntity te = worldObj.getTileEntity(x, y, z); if (te == null || !(te instanceof IDrawerGroup)) return; + if (depth > DEPTH_LIMIT) return; //if (te instanceof TileEntityController && depth < DEPTH_LIMIT) { // populateNeighborNodes(x, y, z, depth + 1);