diff --git a/changelog b/changelog index c06d71eef..7ec181e52 100644 --- a/changelog +++ b/changelog @@ -19,8 +19,14 @@ * All legacy pixel gauges have been replaced with smooth ones (watz, ZIRNOX, CCGT) making them more accurate * Updated the diesel generator's GUI * The diesel gen now also has an in-GUI button for turning it on and off like the industrial combustion engine +* MS-ESv1.1 `split` instruction now supports variable substitution +* Multiblocks now display a wireframe preview of how much space they take up + * This preview is green if it can be placed and red if it can not + * On some machines, this preview might not be perfect, but the check on whether it can be placed should always be accurate + * This makes it easier to anticipate how much space a machine takes up, as well as lining up large parts like fusion reactor components which were notoriously hard to place down right ## Fixed * Fixed held block being placed when not sneaking when opening the cable diode's GUI * Fixed an issue where the diesel generator's fuel capacity is the original 4,000mB instead of the intended new 16,000mB - * This means that explosive barrels and universal barrels can now be loaded into the diesel generator \ No newline at end of file + * This means that explosive barrels and universal barrels can now be loaded into the diesel generator +* Fixed RoR terminal's `set` command not working \ No newline at end of file diff --git a/src/main/java/com/hbm/blocks/BlockDummyable.java b/src/main/java/com/hbm/blocks/BlockDummyable.java index e128f8e95..1dacf9c01 100644 --- a/src/main/java/com/hbm/blocks/BlockDummyable.java +++ b/src/main/java/com/hbm/blocks/BlockDummyable.java @@ -603,13 +603,17 @@ public abstract class BlockDummyable extends BlockContainer implements ICustomBl } public int[][] getAllDimensions() { - return new int[][] { getDimensions() }; + return new int[][] { getDimensions() }; } - + + public double[][] getAABBExtras() { + return new double[0][0]; + } + @SideOnly(Side.CLIENT) public void drawPlacementHighlight(EntityPlayer player, float interp) { MovingObjectPosition mop = EntityDamageUtil.getMouseOver(player, 5.0D); - + if(mop != null && mop.typeOfHit == mop.typeOfHit.BLOCK) { double dX = player.lastTickPosX + (player.posX - player.lastTickPosX) * (double) interp; double dY = player.lastTickPosY + (player.posY - player.lastTickPosY) * (double) interp; @@ -619,13 +623,13 @@ public abstract class BlockDummyable extends BlockContainer implements ICustomBl int o = -getOffset(); int pY = mop.blockY + getHeightOffset(); - //Orientation + // Orientation ForgeDirection facing = ForgeDirection.NORTH; if(i == 0) facing = ForgeDirection.getOrientation(2); if(i == 1) facing = ForgeDirection.getOrientation(5); if(i == 2) facing = ForgeDirection.getOrientation(3); if(i == 3) facing = ForgeDirection.getOrientation(4); - + facing = getDirModified(facing); double originX = mop.blockX + facing.offsetX * o; @@ -638,32 +642,36 @@ public abstract class BlockDummyable extends BlockContainer implements ICustomBl GL11.glPushMatrix(); GL11.glDisable(GL11.GL_LIGHTING); GL11.glDisable(GL11.GL_TEXTURE_2D); - OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 240F, 240F); - GL11.glLineWidth(2.0F); - GL11.glDepthMask(false); + OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 240F, 240F); + GL11.glLineWidth(2.0F); + GL11.glDepthMask(false); tess.startDrawing(GL11.GL_LINES); tess.setBrightness(240); - if (canPlace) { + if(canPlace) { tess.setColorRGBA(0, 255, 0, 255); } else { tess.setColorRGBA(255, 0, 0, 255); } - //Gets the list of different dimensions that each XLmultiblock has, and generates the list of blocks that needs to be highlighted. - //Each XL multiblock has the getAllDimensions overridden in its own class. Each NEEDS it or it will show the incorect shape. + // Gets the list of different dimensions that each XLmultiblock has, + // and generates the list of blocks that needs to be highlighted. + // Each XL multiblock has the getAllDimensions overridden in its own + // class. Each NEEDS it or it will show the incorect shape. List blocks = new java.util.ArrayList<>(); Set set = new java.util.HashSet<>(); for(int[] dims : getAllDimensions()) { - //Some of the multiblocks have offsets for the placements, so this allows for the ones that dont need it to have a bunch of 0s at the end. + // Some of the multiblocks have offsets for the placements, so + // this allows for the ones that dont need it to have a bunch of + // 0s at the end. int offFwd = dims.length > 6 ? dims[6] : 0; - int offUp = dims.length > 7 ? dims[7] : 0; + int offUp = dims.length > 7 ? dims[7] : 0; int offLat = dims.length > 8 ? dims[8] : 0; int worldOffX; int worldOffY; int worldOffZ; - + worldOffY = offUp; worldOffX = facing.offsetX * offFwd + facing.getRotation(ForgeDirection.UP).offsetX * offLat; worldOffZ = facing.offsetZ * offFwd + facing.getRotation(ForgeDirection.UP).offsetZ * offLat; @@ -672,27 +680,24 @@ public abstract class BlockDummyable extends BlockContainer implements ICustomBl for(int bx = -rot[4] + worldOffX; bx <= rot[5] + worldOffX; bx++) { for(int by = -rot[1] + worldOffY; by <= rot[0] + worldOffY; by++) { for(int bz = -rot[2] + worldOffZ; bz <= rot[3] + worldOffZ; bz++) { - BlockPos bp = new BlockPos( - MathHelper.floor_double(originX) + bx, - MathHelper.floor_double(originY) + by, - MathHelper.floor_double(originZ) + bz - ); + BlockPos bp = new BlockPos(MathHelper.floor_double(originX) + bx, MathHelper.floor_double(originY) + by, MathHelper.floor_double(originZ) + bz); blocks.add(bp); set.add(bp); } } - + } } - //This looks for the blocks nearby and draws lines between the vertexes to make different shaped boxes. - //Most of this was taken from Mellow (Thanks mellow) -Wolf - for(BlockPos pos : blocks) { - boolean px = set.contains(pos.add(1, 0, 0)); - boolean nx = set.contains(pos.add(-1, 0, 0)); - boolean ppy = set.contains(pos.add(0, 1, 0)); - boolean ny = set.contains(pos.add(0, -1, 0)); - boolean ppz = set.contains(pos.add(0, 0, 1)); - boolean nz = set.contains(pos.add(0, 0, -1)); + // This looks for the blocks nearby and draws lines between the + // vertexes to make different shaped boxes. + // Most of this was taken from Mellow (Thanks mellow) -Wolf + for(BlockPos pos : blocks) { + boolean px = set.contains(pos.add(1, 0, 0)); + boolean nx = set.contains(pos.add(-1, 0, 0)); + boolean ppy = set.contains(pos.add(0, 1, 0)); + boolean ny = set.contains(pos.add(0, -1, 0)); + boolean ppz = set.contains(pos.add(0, 0, 1)); + boolean nz = set.contains(pos.add(0, 0, -1)); double minX = pos.getX() - dX; double maxX = pos.getX() + 1 - dX; @@ -701,44 +706,155 @@ public abstract class BlockDummyable extends BlockContainer implements ICustomBl double minZ = pos.getZ() - dZ; double maxZ = pos.getZ() + 1 - dZ; - if(!ppy) { - if(!nx) { tess.addVertex(minX, maxY, minZ); tess.addVertex(minX, maxY, maxZ); } - if(!ppz) { tess.addVertex(minX, maxY, maxZ); tess.addVertex(maxX, maxY, maxZ); } - if(!px) { tess.addVertex(maxX, maxY, maxZ); tess.addVertex(maxX, maxY, minZ); } - if(!nz) { tess.addVertex(maxX, maxY, minZ); tess.addVertex(minX, maxY, minZ); } - } - if(!ny) { - if(!nx) { tess.addVertex(minX, minY, minZ); tess.addVertex(minX, minY, maxZ); } - if(!ppz) { tess.addVertex(minX, minY, maxZ); tess.addVertex(maxX, minY, maxZ); } - if(!px) { tess.addVertex(maxX, minY, maxZ); tess.addVertex(maxX, minY, minZ); } - if(!nz) { tess.addVertex(maxX, minY, minZ); tess.addVertex(minX, minY, minZ); } - } - if(!nz) { - if(!nx) { tess.addVertex(minX, minY, minZ); tess.addVertex(minX, maxY, minZ); } - if(!ppy) { tess.addVertex(minX, maxY, minZ); tess.addVertex(maxX, maxY, minZ); } - if(!px) { tess.addVertex(maxX, maxY, minZ); tess.addVertex(maxX, minY, minZ); } - if(!ny) { tess.addVertex(maxX, minY, minZ); tess.addVertex(minX, minY, minZ); } - } - if(!ppz) { - if(!nx) { tess.addVertex(minX, minY, maxZ); tess.addVertex(minX, maxY, maxZ); } - if(!ppy) { tess.addVertex(minX, maxY, maxZ); tess.addVertex(maxX, maxY, maxZ); } - if(!px) { tess.addVertex(maxX, maxY, maxZ); tess.addVertex(maxX, minY, maxZ); } - if(!ny) { tess.addVertex(maxX, minY, maxZ); tess.addVertex(minX, minY, maxZ); } - } - if(!nx) { - if(!nz) { tess.addVertex(minX, minY, minZ); tess.addVertex(minX, maxY, minZ); } - if(!ppy) { tess.addVertex(minX, maxY, minZ); tess.addVertex(minX, maxY, maxZ); } - if(!ppz) { tess.addVertex(minX, maxY, maxZ); tess.addVertex(minX, minY, maxZ); } - if(!ny) { tess.addVertex(minX, minY, maxZ); tess.addVertex(minX, minY, minZ); } - } - if(!px) { - if(!nz) { tess.addVertex(maxX, minY, minZ); tess.addVertex(maxX, maxY, minZ); } - if(!ppy) { tess.addVertex(maxX, maxY, minZ); tess.addVertex(maxX, maxY, maxZ); } - if(!ppz) { tess.addVertex(maxX, maxY, maxZ); tess.addVertex(maxX, minY, maxZ); } - if(!ny) { tess.addVertex(maxX, minY, maxZ); tess.addVertex(maxX, minY, minZ); } - } - } - + if(!ppy) { + if(!nx) { + tess.addVertex(minX, maxY, minZ); + tess.addVertex(minX, maxY, maxZ); + } + if(!ppz) { + tess.addVertex(minX, maxY, maxZ); + tess.addVertex(maxX, maxY, maxZ); + } + if(!px) { + tess.addVertex(maxX, maxY, maxZ); + tess.addVertex(maxX, maxY, minZ); + } + if(!nz) { + tess.addVertex(maxX, maxY, minZ); + tess.addVertex(minX, maxY, minZ); + } + } + if(!ny) { + if(!nx) { + tess.addVertex(minX, minY, minZ); + tess.addVertex(minX, minY, maxZ); + } + if(!ppz) { + tess.addVertex(minX, minY, maxZ); + tess.addVertex(maxX, minY, maxZ); + } + if(!px) { + tess.addVertex(maxX, minY, maxZ); + tess.addVertex(maxX, minY, minZ); + } + if(!nz) { + tess.addVertex(maxX, minY, minZ); + tess.addVertex(minX, minY, minZ); + } + } + if(!nz) { + if(!nx) { + tess.addVertex(minX, minY, minZ); + tess.addVertex(minX, maxY, minZ); + } + if(!ppy) { + tess.addVertex(minX, maxY, minZ); + tess.addVertex(maxX, maxY, minZ); + } + if(!px) { + tess.addVertex(maxX, maxY, minZ); + tess.addVertex(maxX, minY, minZ); + } + if(!ny) { + tess.addVertex(maxX, minY, minZ); + tess.addVertex(minX, minY, minZ); + } + } + if(!ppz) { + if(!nx) { + tess.addVertex(minX, minY, maxZ); + tess.addVertex(minX, maxY, maxZ); + } + if(!ppy) { + tess.addVertex(minX, maxY, maxZ); + tess.addVertex(maxX, maxY, maxZ); + } + if(!px) { + tess.addVertex(maxX, maxY, maxZ); + tess.addVertex(maxX, minY, maxZ); + } + if(!ny) { + tess.addVertex(maxX, minY, maxZ); + tess.addVertex(minX, minY, maxZ); + } + } + if(!nx) { + if(!nz) { + tess.addVertex(minX, minY, minZ); + tess.addVertex(minX, maxY, minZ); + } + if(!ppy) { + tess.addVertex(minX, maxY, minZ); + tess.addVertex(minX, maxY, maxZ); + } + if(!ppz) { + tess.addVertex(minX, maxY, maxZ); + tess.addVertex(minX, minY, maxZ); + } + if(!ny) { + tess.addVertex(minX, minY, maxZ); + tess.addVertex(minX, minY, minZ); + } + } + if(!px) { + if(!nz) { + tess.addVertex(maxX, minY, minZ); + tess.addVertex(maxX, maxY, minZ); + } + if(!ppy) { + tess.addVertex(maxX, maxY, minZ); + tess.addVertex(maxX, maxY, maxZ); + } + if(!ppz) { + tess.addVertex(maxX, maxY, maxZ); + tess.addVertex(maxX, minY, maxZ); + } + if(!ny) { + tess.addVertex(maxX, minY, maxZ); + tess.addVertex(maxX, minY, minZ); + } + } + } + + tess.setColorRGBA(0, 0, 255, 255); + + // boo-yeah + for(double[] extra : this.getAABBExtras()) { + ForgeDirection rot = facing.getRotation(ForgeDirection.UP); + double cX = MathHelper.floor_double(originX) - dX + 0.5; + double cY = MathHelper.floor_double(originY) - dY; + double cZ = MathHelper.floor_double(originZ) - dZ + 0.5; + + double upr = extra[0]; + double lwr = extra[1]; + double fwd = extra[2]; + double bwd = extra[3]; + double lft = extra[4]; + double rgt = extra[5]; + + double x0 = cX + fwd * facing.offsetX + lft * rot.offsetX; + double x1 = cX + bwd * facing.offsetX + rgt * rot.offsetX; + double y0 = cY + lwr; + double y1 = cY + upr; + double z0 = cZ + fwd * facing.offsetZ + lft * rot.offsetZ; + double z1 = cZ + bwd * facing.offsetZ + rgt * rot.offsetZ; + + tess.addVertex(x0, y0, z0); tess.addVertex(x0, y0, z1); + tess.addVertex(x1, y0, z0); tess.addVertex(x1, y0, z1); + tess.addVertex(x0, y0, z0); tess.addVertex(x1, y0, z0); + tess.addVertex(x0, y0, z1); tess.addVertex(x1, y0, z1); + + tess.addVertex(x0, y1, z0); tess.addVertex(x0, y1, z1); + tess.addVertex(x1, y1, z0); tess.addVertex(x1, y1, z1); + tess.addVertex(x0, y1, z0); tess.addVertex(x1, y1, z0); + tess.addVertex(x0, y1, z1); tess.addVertex(x1, y1, z1); + + tess.addVertex(x0, y0, z0); tess.addVertex(x0, y1, z0); + tess.addVertex(x1, y0, z0); tess.addVertex(x1, y1, z0); + tess.addVertex(x0, y0, z1); tess.addVertex(x0, y1, z1); + tess.addVertex(x1, y0, z1); tess.addVertex(x1, y1, z1); + } + tess.draw(); tess.setTranslation(0, 0, 0); diff --git a/src/main/java/com/hbm/blocks/machine/fusion/MachineFusionBoiler.java b/src/main/java/com/hbm/blocks/machine/fusion/MachineFusionBoiler.java index 7e61a254d..38426d68a 100644 --- a/src/main/java/com/hbm/blocks/machine/fusion/MachineFusionBoiler.java +++ b/src/main/java/com/hbm/blocks/machine/fusion/MachineFusionBoiler.java @@ -44,6 +44,13 @@ public class MachineFusionBoiler extends BlockDummyable implements ILookOverlay, return 4; } + @Override + public double[][] getAABBExtras() { + return new double[][] { + {1.5, 3.5, -4.5, -4.5, 1, -1} + }; + } + @Override public boolean checkRequirement(World world, int x, int y, int z, ForgeDirection dir, int o) { return super.checkRequirement(world, x, y, z, dir, o); diff --git a/src/main/java/com/hbm/blocks/machine/fusion/MachineFusionBreeder.java b/src/main/java/com/hbm/blocks/machine/fusion/MachineFusionBreeder.java index d86c1f6bd..e16e9a468 100644 --- a/src/main/java/com/hbm/blocks/machine/fusion/MachineFusionBreeder.java +++ b/src/main/java/com/hbm/blocks/machine/fusion/MachineFusionBreeder.java @@ -36,6 +36,13 @@ public class MachineFusionBreeder extends BlockDummyable implements ITooltipProv public int getOffset() { return 2; } + + @Override + public double[][] getAABBExtras() { + return new double[][] { + {1.5, 3.5, -2.5, -2.5, 1, -1} + }; + } @Override public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) { diff --git a/src/main/java/com/hbm/blocks/machine/fusion/MachineFusionCollector.java b/src/main/java/com/hbm/blocks/machine/fusion/MachineFusionCollector.java index 2c7b92ebc..f8ff9fe50 100644 --- a/src/main/java/com/hbm/blocks/machine/fusion/MachineFusionCollector.java +++ b/src/main/java/com/hbm/blocks/machine/fusion/MachineFusionCollector.java @@ -35,6 +35,13 @@ public class MachineFusionCollector extends BlockDummyable implements ITooltipPr return 1; } + @Override + public double[][] getAABBExtras() { + return new double[][] { + {1.5, 3.5, -2.5, -2.5, 1, -1} + }; + } + @Override public boolean checkRequirement(World world, int x, int y, int z, ForgeDirection dir, int o) { return super.checkRequirement(world, x, y, z, dir, o); diff --git a/src/main/java/com/hbm/blocks/machine/fusion/MachineFusionCoupler.java b/src/main/java/com/hbm/blocks/machine/fusion/MachineFusionCoupler.java index e9ddafbe1..fcfa2b5b4 100644 --- a/src/main/java/com/hbm/blocks/machine/fusion/MachineFusionCoupler.java +++ b/src/main/java/com/hbm/blocks/machine/fusion/MachineFusionCoupler.java @@ -34,6 +34,14 @@ public class MachineFusionCoupler extends BlockDummyable implements ITooltipProv return 0; } + @Override + public double[][] getAABBExtras() { + return new double[][] { + {1.5, 3.5, 1, -1, 1.5, 1.5}, + {1.5, 3.5, 1, -1, -1.5, -1.5} + }; + } + @Override public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean ext) { addStandardInfo(stack, player, list, ext); diff --git a/src/main/java/com/hbm/blocks/machine/fusion/MachineFusionKlystron.java b/src/main/java/com/hbm/blocks/machine/fusion/MachineFusionKlystron.java index db8df5641..b186de59a 100644 --- a/src/main/java/com/hbm/blocks/machine/fusion/MachineFusionKlystron.java +++ b/src/main/java/com/hbm/blocks/machine/fusion/MachineFusionKlystron.java @@ -42,6 +42,14 @@ public class MachineFusionKlystron extends BlockDummyable implements ITooltipPro new int[] { 4, -3, 4, 3, 1, 1 }, }; } + + @Override + public double[][] getAABBExtras() { + return new double[][] { + {1.5, 3.5, -4.5, -4.5, 1, -1} + }; + } + @Override public boolean checkRequirement(World world, int x, int y, int z, ForgeDirection dir, int o) { return super.checkRequirement(world, x, y, z, dir, o) && diff --git a/src/main/java/com/hbm/blocks/machine/fusion/MachineFusionKlystronCreative.java b/src/main/java/com/hbm/blocks/machine/fusion/MachineFusionKlystronCreative.java index 198f49f88..28cba05a4 100644 --- a/src/main/java/com/hbm/blocks/machine/fusion/MachineFusionKlystronCreative.java +++ b/src/main/java/com/hbm/blocks/machine/fusion/MachineFusionKlystronCreative.java @@ -35,6 +35,14 @@ public class MachineFusionKlystronCreative extends BlockDummyable implements ITo new int[] { 4, -3, 4, 3, 1, 1 }, }; } + + @Override + public double[][] getAABBExtras() { + return new double[][] { + {1.5, 3.5, -4.5, -4.5, 1, -1} + }; + } + @Override public boolean checkRequirement(World world, int x, int y, int z, ForgeDirection dir, int o) { return super.checkRequirement(world, x, y, z, dir, o) && diff --git a/src/main/java/com/hbm/blocks/machine/fusion/MachineFusionMHDT.java b/src/main/java/com/hbm/blocks/machine/fusion/MachineFusionMHDT.java index 64dd13fec..952abfb17 100644 --- a/src/main/java/com/hbm/blocks/machine/fusion/MachineFusionMHDT.java +++ b/src/main/java/com/hbm/blocks/machine/fusion/MachineFusionMHDT.java @@ -44,6 +44,7 @@ public class MachineFusionMHDT extends BlockDummyable implements ILookOverlay, I public int getOffset() { return 7; } + @Override public int[][] getAllDimensions() { return new int[][] { @@ -55,6 +56,14 @@ public class MachineFusionMHDT extends BlockDummyable implements ILookOverlay, I new int[] { 1, 0, 0, 1, 3, 3, 3, 0, 0 }, }; } + + @Override + public double[][] getAABBExtras() { + return new double[][] { + {1.5, 3.5, -6.5, -6.5, 1, -1} + }; + } + @Override public boolean checkRequirement(World world, int x, int y, int z, ForgeDirection dir, int o) { return super.checkRequirement(world, x, y, z, dir, o) && diff --git a/src/main/java/com/hbm/blocks/machine/fusion/MachineFusionPlasmaForge.java b/src/main/java/com/hbm/blocks/machine/fusion/MachineFusionPlasmaForge.java index 7f06b7840..aa365a6f4 100644 --- a/src/main/java/com/hbm/blocks/machine/fusion/MachineFusionPlasmaForge.java +++ b/src/main/java/com/hbm/blocks/machine/fusion/MachineFusionPlasmaForge.java @@ -47,6 +47,14 @@ public class MachineFusionPlasmaForge extends BlockDummyable { }; } + @Override + public double[][] getAABBExtras() { + return new double[][] { + {1.5, 3.5, 1, -1, 5.5, 5.5}, + {1.5, 3.5, 1, -1, -5.5, -5.5} + }; + } + @Override public boolean checkRequirement(World world, int x, int y, int z, ForgeDirection dir, int o) { return super.checkRequirement(world, x, y, z, dir, o) && diff --git a/src/main/java/com/hbm/blocks/machine/fusion/MachineFusionTorus.java b/src/main/java/com/hbm/blocks/machine/fusion/MachineFusionTorus.java index 578e23738..d557e8886 100644 --- a/src/main/java/com/hbm/blocks/machine/fusion/MachineFusionTorus.java +++ b/src/main/java/com/hbm/blocks/machine/fusion/MachineFusionTorus.java @@ -97,6 +97,27 @@ public class MachineFusionTorus extends BlockDummyable implements ITooltipProvid public int getOffset() { return 7; } + + @Override + public int[][] getAllDimensions() { + return new int[][] { + new int[] { 4, 0, 7, 7, 3, 3 }, + new int[] { 4, 0, 6, 6, 4, 4 }, + new int[] { 4, 0, 5, 5, 5, 5 }, + new int[] { 4, 0, 4, 4, 6, 6 }, + new int[] { 4, 0, 3, 3, 7, 7 }, + }; + } + + @Override + public double[][] getAABBExtras() { + return new double[][] { + {3.5, 1.5, 7.5, 7.5, 1, -1}, + {3.5, 1.5, -7.5, -7.5, 1, -1}, + {3.5, 1.5, 1, -1, 7.5, 7.5}, + {3.5, 1.5, 1, -1, -7.5, -7.5}, + }; + } @Override public boolean checkRequirement(World world, int x, int y, int z, ForgeDirection dir, int o) { diff --git a/src/main/java/com/hbm/handler/MultiblockHandlerXR.java b/src/main/java/com/hbm/handler/MultiblockHandlerXR.java index 80ed65dc5..7f054d8c7 100644 --- a/src/main/java/com/hbm/handler/MultiblockHandlerXR.java +++ b/src/main/java/com/hbm/handler/MultiblockHandlerXR.java @@ -128,11 +128,8 @@ public class MultiblockHandlerXR { public static int[] rotate(int[] dim, ForgeDirection dir) { - if(dim == null) - return null; - - if(dir == ForgeDirection.SOUTH) - return dim; + if(dim == null) return null; + if(dir == ForgeDirection.SOUTH) return dim; if(dir == ForgeDirection.NORTH) { // U D N S W E @@ -151,5 +148,27 @@ public class MultiblockHandlerXR { return dim; } - + + public static double[] rotateDouble(double[] dim, ForgeDirection dir) { + + if(dim == null) return null; + if(dir == ForgeDirection.SOUTH) return dim; + + if(dir == ForgeDirection.NORTH) { + // U D N S W E + return new double[] { dim[0], dim[1], dim[3], dim[2], dim[5], dim[4] }; + } + + if(dir == ForgeDirection.EAST) { + // U D N S W E + return new double[] { dim[0], dim[1], dim[5], dim[4], dim[2], dim[3] }; + } + + if(dir == ForgeDirection.WEST) { + // U D N S W E + return new double[] { dim[0], dim[1], dim[4], dim[5], dim[3], dim[2] }; + } + + return dim; + } }