From d640951f2d72c5c88a0a7b8ee3ae90e45ef42cf7 Mon Sep 17 00:00:00 2001 From: Agaricus Date: Wed, 9 Jan 2013 19:35:06 -0800 Subject: [PATCH] Log coordinates of invalid pipes Based on Maeyanie's fix for the old BC2 Bukkit port: https://github.com/Maeyanie/BuildCraft/commit/7dac7f9c2afec2b1f2935458a7bda6838b9b893c Add more feedback to the 'invalid pipe' loading errors. --- common/buildcraft/transport/ItemPipe.java | 5 +++++ common/buildcraft/transport/TileGenericPipe.java | 6 +++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/common/buildcraft/transport/ItemPipe.java b/common/buildcraft/transport/ItemPipe.java index 513803d3..173bb362 100644 --- a/common/buildcraft/transport/ItemPipe.java +++ b/common/buildcraft/transport/ItemPipe.java @@ -17,6 +17,7 @@ import net.minecraft.world.World; import buildcraft.BuildCraftTransport; import buildcraft.core.IItemPipe; import buildcraft.core.ItemBuildCraft; +import buildcraft.BuildCraftCore; public class ItemPipe extends ItemBuildCraft implements IItemPipe { @@ -67,6 +68,10 @@ public class ItemPipe extends ItemBuildCraft implements IItemPipe { if (entityplayer.canCurrentToolHarvestBlock(i, j, k) && world.canPlaceEntityOnSide(blockID, i, j, k, false, side, entityplayer)) { Pipe pipe = BlockGenericPipe.createPipe(itemID); + if (pipe == null) { + BuildCraftCore.bcLog.warning("Pipe failed to create during placement at "+i+","+j+","+k); + return true; + } if (BlockGenericPipe.placePipe(pipe, world, i, j, k, blockID, 0)) { Block.blocksList[blockID].onBlockPlacedBy(world, i, j, k, entityplayer); diff --git a/common/buildcraft/transport/TileGenericPipe.java b/common/buildcraft/transport/TileGenericPipe.java index af3acd16..fa16ff41 100644 --- a/common/buildcraft/transport/TileGenericPipe.java +++ b/common/buildcraft/transport/TileGenericPipe.java @@ -122,7 +122,9 @@ public class TileGenericPipe extends TileEntity implements IPowerReceptor, ITank if (pipe != null) { pipe.readFromNBT(nbttagcompound); - } + } else { + BuildCraftCore.bcLog.warning("Pipe failed to load from NBT at "+xCoord+","+yCoord+","+zCoord); + } for (int i = 0; i < ForgeDirection.VALID_DIRECTIONS.length; i++) { facadeBlocks[i] = nbttagcompound.getInteger("facadeBlocks[" + i + "]"); @@ -292,6 +294,8 @@ public class TileGenericPipe extends TileEntity implements IPowerReceptor, ITank if (pipe != null) { pipe.initialize(); + } else { + BuildCraftCore.bcLog.warning("Pipe failed to initialize pipe at "+xCoord+","+yCoord+","+zCoord); } initialized = true;