From cc5080d9080a5a381bcdd1228b1b4102a34a6324 Mon Sep 17 00:00:00 2001 From: "Aidan C. Brady" Date: Wed, 18 Mar 2015 07:50:17 -0400 Subject: [PATCH] Cleanup --- src/main/java/mekanism/client/render/CTM.java | 142 +++++++----------- .../recipe/inputs/AdvancedMachineInput.java | 3 + 2 files changed, 55 insertions(+), 90 deletions(-) diff --git a/src/main/java/mekanism/client/render/CTM.java b/src/main/java/mekanism/client/render/CTM.java index 8ca362695..ee2a1e6f3 100644 --- a/src/main/java/mekanism/client/render/CTM.java +++ b/src/main/java/mekanism/client/render/CTM.java @@ -8,78 +8,18 @@ import net.minecraft.block.Block; import net.minecraft.world.IBlockAccess; /** - * CTM Logic adapted from Chisel. - * Code licensed under GPLv2 + * CTM Logic adapted from Chisel. Code licensed under GPLv2 + * * @author AUTOMATIC_MAIDEN, asie, pokefenn, unpairedbracket */ public class CTM { - static int submaps[][] = { - {16, 17, 18, 19}, - {16, 9, 18, 13}, - {8, 9, 12, 13}, - {8, 17, 12, 19}, - {16, 9, 6, 15}, - {8, 17, 14, 7}, - {2, 11, 6, 15}, - {8, 9, 14, 15}, - {10, 1, 14, 15}, - {10, 11, 14, 5}, - {0, 11, 4, 15}, - {0, 1, 14, 15}, - {}, - {}, - {}, - {}, - {16, 17, 6, 7}, - {16, 9, 6, 5}, - {8, 9, 4, 5}, - {8, 17, 4, 7}, - {2, 11, 18, 13}, - {10, 3, 12, 19}, - {10, 11, 12, 13}, - {10, 3, 14, 7}, - {0, 11, 14, 15}, - {10, 11, 4, 15}, - {10, 11, 4, 5}, - {10, 1, 14, 5}, - {}, - {}, - {}, - {}, - {2, 3, 6, 7}, - {2, 1, 6, 5}, - {0, 1, 4, 5}, - {0, 3, 4, 7}, - {2, 11, 6, 5}, - {8, 9, 4, 15}, - {2, 1, 6, 15}, - {8, 9, 14, 5}, - {0, 1, 4, 15}, - {0, 1, 14, 5}, - {10, 1, 4, 15}, - {0, 11, 14, 5}, - {}, - {}, - {}, - {}, - {2, 3, 18, 19}, - {2, 1, 18, 13}, - {0, 1, 12, 13}, - {0, 3, 12, 19}, - {10, 1, 12, 13}, - {0, 3, 14, 7}, - {0, 11, 12, 13}, - {10, 3, 4, 7}, - {0, 11, 4, 5}, - {10, 1, 4, 5}, - {10, 11, 14, 15}, - {0, 1, 4, 5}, - {}, - {}, - {}, - {}, - }; + static int submaps[][] = { {16, 17, 18, 19}, {16, 9, 18, 13}, {8, 9, 12, 13}, {8, 17, 12, 19}, {16, 9, 6, 15}, {8, 17, 14, 7}, {2, 11, 6, 15}, + {8, 9, 14, 15}, {10, 1, 14, 15}, {10, 11, 14, 5}, {0, 11, 4, 15}, {0, 1, 14, 15}, {}, {}, {}, {}, {16, 17, 6, 7}, {16, 9, 6, 5}, {8, 9, 4, 5}, + {8, 17, 4, 7}, {2, 11, 18, 13}, {10, 3, 12, 19}, {10, 11, 12, 13}, {10, 3, 14, 7}, {0, 11, 14, 15}, {10, 11, 4, 15}, {10, 11, 4, 5}, + {10, 1, 14, 5}, {}, {}, {}, {}, {2, 3, 6, 7}, {2, 1, 6, 5}, {0, 1, 4, 5}, {0, 3, 4, 7}, {2, 11, 6, 5}, {8, 9, 4, 15}, {2, 1, 6, 15}, {8, 9, 14, 5}, + {0, 1, 4, 15}, {0, 1, 14, 5}, {10, 1, 4, 15}, {0, 11, 14, 5}, {}, {}, {}, {}, {2, 3, 18, 19}, {2, 1, 18, 13}, {0, 1, 12, 13}, {0, 3, 12, 19}, + {10, 1, 12, 13}, {0, 3, 14, 7}, {0, 11, 12, 13}, {10, 3, 4, 7}, {0, 11, 4, 5}, {10, 1, 4, 5}, {10, 11, 14, 15}, {0, 1, 4, 5}, {}, {}, {}, {},}; public static int[] getSubmapIndices(IBlockAccess world, int x, int y, int z, int side, HashMap> blockMetas, boolean convexConnections) { @@ -105,25 +45,29 @@ public class CTM b[1] = isConnected(world, x + 1, y, z, side, blockMetas, convexConnections); b[2] = isConnected(world, x, y, z + 1, side, blockMetas, convexConnections); b[3] = isConnected(world, x, y, z - 1, side, blockMetas, convexConnections); - } else if(side == 2) + } + else if(side == 2) { b[0] = isConnected(world, x + 1, y, z, side, blockMetas, convexConnections); b[1] = isConnected(world, x - 1, y, z, side, blockMetas, convexConnections); b[2] = isConnected(world, x, y - 1, z, side, blockMetas, convexConnections); b[3] = isConnected(world, x, y + 1, z, side, blockMetas, convexConnections); - } else if(side == 3) + } + else if(side == 3) { b[0] = isConnected(world, x - 1, y, z, side, blockMetas, convexConnections); b[1] = isConnected(world, x + 1, y, z, side, blockMetas, convexConnections); b[2] = isConnected(world, x, y - 1, z, side, blockMetas, convexConnections); b[3] = isConnected(world, x, y + 1, z, side, blockMetas, convexConnections); - } else if(side == 4) + } + else if(side == 4) { b[0] = isConnected(world, x, y, z - 1, side, blockMetas, convexConnections); b[1] = isConnected(world, x, y, z + 1, side, blockMetas, convexConnections); b[2] = isConnected(world, x, y - 1, z, side, blockMetas, convexConnections); b[3] = isConnected(world, x, y + 1, z, side, blockMetas, convexConnections); - } else if(side == 5) + } + else if(side == 5) { b[0] = isConnected(world, x, y, z + 1, side, blockMetas, convexConnections); b[1] = isConnected(world, x, y, z - 1, side, blockMetas, convexConnections); @@ -134,46 +78,60 @@ public class CTM if(b[0] & !b[1] & !b[2] & !b[3]) { texture = 3; - } else if(!b[0] & b[1] & !b[2] & !b[3]) + } + else if(!b[0] & b[1] & !b[2] & !b[3]) { texture = 1; - } else if(!b[0] & !b[1] & b[2] & !b[3]) + } + else if(!b[0] & !b[1] & b[2] & !b[3]) { texture = 16; - } else if(!b[0] & !b[1] & !b[2] & b[3]) + } + else if(!b[0] & !b[1] & !b[2] & b[3]) { texture = 48; - } else if(b[0] & b[1] & !b[2] & !b[3]) + } + else if(b[0] & b[1] & !b[2] & !b[3]) { texture = 2; - } else if(!b[0] & !b[1] & b[2] & b[3]) + } + else if(!b[0] & !b[1] & b[2] & b[3]) { texture = 32; - } else if(b[0] & !b[1] & b[2] & !b[3]) + } + else if(b[0] & !b[1] & b[2] & !b[3]) { texture = 19; - } else if(b[0] & !b[1] & !b[2] & b[3]) + } + else if(b[0] & !b[1] & !b[2] & b[3]) { texture = 51; - } else if(!b[0] & b[1] & b[2] & !b[3]) + } + else if(!b[0] & b[1] & b[2] & !b[3]) { texture = 17; - } else if(!b[0] & b[1] & !b[2] & b[3]) + } + else if(!b[0] & b[1] & !b[2] & b[3]) { texture = 49; - } else if(!b[0] & b[1] & b[2] & b[3]) + } + else if(!b[0] & b[1] & b[2] & b[3]) { texture = 33; - } else if(b[0] & !b[1] & b[2] & b[3]) + } + else if(b[0] & !b[1] & b[2] & b[3]) { texture = 35; - } else if(b[0] & b[1] & !b[2] & b[3]) + } + else if(b[0] & b[1] & !b[2] & b[3]) { texture = 50; - } else if(b[0] & b[1] & b[2] & !b[3]) + } + else if(b[0] & b[1] & b[2] & !b[3]) { texture = 18; - } else if(b[0] & b[1] & b[2] & b[3]) + } + else if(b[0] & b[1] & b[2] & b[3]) { texture = 34; } @@ -186,25 +144,29 @@ public class CTM b2[1] = !isConnected(world, x - 1, y, z + 1, side, blockMetas, convexConnections); b2[2] = !isConnected(world, x + 1, y, z - 1, side, blockMetas, convexConnections); b2[3] = !isConnected(world, x - 1, y, z - 1, side, blockMetas, convexConnections); - } else if(side == 2) + } + else if(side == 2) { b2[0] = !isConnected(world, x - 1, y - 1, z, side, blockMetas, convexConnections); b2[1] = !isConnected(world, x + 1, y - 1, z, side, blockMetas, convexConnections); b2[2] = !isConnected(world, x - 1, y + 1, z, side, blockMetas, convexConnections); b2[3] = !isConnected(world, x + 1, y + 1, z, side, blockMetas, convexConnections); - } else if(side == 3) + } + else if(side == 3) { b2[0] = !isConnected(world, x + 1, y - 1, z, side, blockMetas, convexConnections); b2[1] = !isConnected(world, x - 1, y - 1, z, side, blockMetas, convexConnections); b2[2] = !isConnected(world, x + 1, y + 1, z, side, blockMetas, convexConnections); b2[3] = !isConnected(world, x - 1, y + 1, z, side, blockMetas, convexConnections); - } else if(side == 4) + } + else if(side == 4) { b2[0] = !isConnected(world, x, y - 1, z + 1, side, blockMetas, convexConnections); b2[1] = !isConnected(world, x, y - 1, z - 1, side, blockMetas, convexConnections); b2[2] = !isConnected(world, x, y + 1, z + 1, side, blockMetas, convexConnections); b2[3] = !isConnected(world, x, y + 1, z - 1, side, blockMetas, convexConnections); - } else if(side == 5) + } + else if(side == 5) { b2[0] = !isConnected(world, x, y - 1, z - 1, side, blockMetas, convexConnections); b2[1] = !isConnected(world, x, y - 1, z + 1, side, blockMetas, convexConnections); diff --git a/src/main/java/mekanism/common/recipe/inputs/AdvancedMachineInput.java b/src/main/java/mekanism/common/recipe/inputs/AdvancedMachineInput.java index 90955e577..0be91c476 100644 --- a/src/main/java/mekanism/common/recipe/inputs/AdvancedMachineInput.java +++ b/src/main/java/mekanism/common/recipe/inputs/AdvancedMachineInput.java @@ -47,8 +47,10 @@ public class AdvancedMachineInput extends MachineInput { inventory[index] = StackUtils.subtract(inventory[index], itemStack); } + return true; } + return false; } @@ -59,6 +61,7 @@ public class AdvancedMachineInput extends MachineInput gasTank.draw(amountToUse, deplete); return true; } + return false; }