From ecff97c2efeef15f10256e97c8eef908f1fa21f8 Mon Sep 17 00:00:00 2001 From: undergroundminer3 Date: Sun, 11 May 2014 10:10:08 -0400 Subject: [PATCH 1/2] Don't crash when I create new PipeTypes I am using reflection to "hack in" new PipeTypes for myself. (Yes, that IS possible, but very "aggressive") Don't cause an ArrayIndexOutOfBounds exception when I do that. (at least when rendering, just don't place a gate on my pipes) This is also another step towards the ability to create new PipeTypes. --- .../transport/render/PipeRendererTESR.java | 26 +++++++++---------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/common/buildcraft/transport/render/PipeRendererTESR.java b/common/buildcraft/transport/render/PipeRendererTESR.java index c6473002..60876c86 100644 --- a/common/buildcraft/transport/render/PipeRendererTESR.java +++ b/common/buildcraft/transport/render/PipeRendererTESR.java @@ -287,20 +287,18 @@ public class PipeRendererTESR extends TileEntitySpecialRenderer { renderGatesWires(pipe, x, y, z); - switch (pipe.getPipeType()) { - case ITEM: - renderSolids(pipe.pipe, x, y, z); - break; - case FLUID: - renderFluids(pipe.pipe, x, y, z); - break; - case POWER: - renderPower(pipe.pipe, x, y, z); - break; - case STRUCTURE: - // no object to render in a structure pipe; - break; - } + PipeType pipeType = pipe.getPipeType(); + + // do not use switch. we will be transitioning away from the enum + if (pipeType == PipeType.ITEM) { + renderSolids(pipe.pipe, x, y, z); + } else if (pipeType == PipeType.FLUID) { + renderFluids(pipe.pipe, x, y, z); + } else if (pipeType == PipeType.POWER) { + renderPower(pipe.pipe, x, y, z); + } /* else if (pipeType == PipeType.STRUCTURE) { + // no object to render in a structure pipe; + } */ } private void renderGatesWires(TileGenericPipe pipe, double x, double y, double z) { From 394a6cc68514e060e46b8ae589f38d04bf189820 Mon Sep 17 00:00:00 2001 From: undergroundminer3 Date: Sun, 11 May 2014 10:18:43 -0400 Subject: [PATCH 2/2] Forgot the import Add the pipetype import --- common/buildcraft/transport/render/PipeRendererTESR.java | 1 + 1 file changed, 1 insertion(+) diff --git a/common/buildcraft/transport/render/PipeRendererTESR.java b/common/buildcraft/transport/render/PipeRendererTESR.java index 60876c86..3663d339 100644 --- a/common/buildcraft/transport/render/PipeRendererTESR.java +++ b/common/buildcraft/transport/render/PipeRendererTESR.java @@ -39,6 +39,7 @@ import buildcraft.BuildCraftCore; import buildcraft.BuildCraftCore.RenderMode; import buildcraft.BuildCraftTransport; import buildcraft.api.gates.IGateExpansion; +import buildcraft.api.transport.IPipeTile.PipeType; import buildcraft.api.transport.PipeWire; import buildcraft.core.CoreConstants; import buildcraft.core.DefaultProps;