fusion reactor port markers on place preview

This commit is contained in:
HbmMods 2026-07-23 12:53:16 +02:00
parent 6ac520467b
commit 9ab159d9b6
12 changed files with 298 additions and 74 deletions

View File

@ -19,8 +19,14 @@
* All legacy pixel gauges have been replaced with smooth ones (watz, ZIRNOX, CCGT) making them more accurate * All legacy pixel gauges have been replaced with smooth ones (watz, ZIRNOX, CCGT) making them more accurate
* Updated the diesel generator's GUI * 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 * 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
* Fixed held block being placed when not sneaking when opening the cable diode's GUI * 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 * 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 * This means that explosive barrels and universal barrels can now be loaded into the diesel generator
* Fixed RoR terminal's `set` command not working

View File

@ -603,13 +603,17 @@ public abstract class BlockDummyable extends BlockContainer implements ICustomBl
} }
public int[][] getAllDimensions() { public int[][] getAllDimensions() {
return new int[][] { getDimensions() }; return new int[][] { getDimensions() };
} }
public double[][] getAABBExtras() {
return new double[0][0];
}
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public void drawPlacementHighlight(EntityPlayer player, float interp) { public void drawPlacementHighlight(EntityPlayer player, float interp) {
MovingObjectPosition mop = EntityDamageUtil.getMouseOver(player, 5.0D); MovingObjectPosition mop = EntityDamageUtil.getMouseOver(player, 5.0D);
if(mop != null && mop.typeOfHit == mop.typeOfHit.BLOCK) { if(mop != null && mop.typeOfHit == mop.typeOfHit.BLOCK) {
double dX = player.lastTickPosX + (player.posX - player.lastTickPosX) * (double) interp; double dX = player.lastTickPosX + (player.posX - player.lastTickPosX) * (double) interp;
double dY = player.lastTickPosY + (player.posY - player.lastTickPosY) * (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 o = -getOffset();
int pY = mop.blockY + getHeightOffset(); int pY = mop.blockY + getHeightOffset();
//Orientation // Orientation
ForgeDirection facing = ForgeDirection.NORTH; ForgeDirection facing = ForgeDirection.NORTH;
if(i == 0) facing = ForgeDirection.getOrientation(2); if(i == 0) facing = ForgeDirection.getOrientation(2);
if(i == 1) facing = ForgeDirection.getOrientation(5); if(i == 1) facing = ForgeDirection.getOrientation(5);
if(i == 2) facing = ForgeDirection.getOrientation(3); if(i == 2) facing = ForgeDirection.getOrientation(3);
if(i == 3) facing = ForgeDirection.getOrientation(4); if(i == 3) facing = ForgeDirection.getOrientation(4);
facing = getDirModified(facing); facing = getDirModified(facing);
double originX = mop.blockX + facing.offsetX * o; double originX = mop.blockX + facing.offsetX * o;
@ -638,32 +642,36 @@ public abstract class BlockDummyable extends BlockContainer implements ICustomBl
GL11.glPushMatrix(); GL11.glPushMatrix();
GL11.glDisable(GL11.GL_LIGHTING); GL11.glDisable(GL11.GL_LIGHTING);
GL11.glDisable(GL11.GL_TEXTURE_2D); GL11.glDisable(GL11.GL_TEXTURE_2D);
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 240F, 240F); OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 240F, 240F);
GL11.glLineWidth(2.0F); GL11.glLineWidth(2.0F);
GL11.glDepthMask(false); GL11.glDepthMask(false);
tess.startDrawing(GL11.GL_LINES); tess.startDrawing(GL11.GL_LINES);
tess.setBrightness(240); tess.setBrightness(240);
if (canPlace) { if(canPlace) {
tess.setColorRGBA(0, 255, 0, 255); tess.setColorRGBA(0, 255, 0, 255);
} else { } else {
tess.setColorRGBA(255, 0, 0, 255); 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. // Gets the list of different dimensions that each XLmultiblock has,
//Each XL multiblock has the getAllDimensions overridden in its own class. Each NEEDS it or it will show the incorect shape. // 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<BlockPos> blocks = new java.util.ArrayList<>(); List<BlockPos> blocks = new java.util.ArrayList<>();
Set<BlockPos> set = new java.util.HashSet<>(); Set<BlockPos> set = new java.util.HashSet<>();
for(int[] dims : getAllDimensions()) { 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 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 offLat = dims.length > 8 ? dims[8] : 0;
int worldOffX; int worldOffX;
int worldOffY; int worldOffY;
int worldOffZ; int worldOffZ;
worldOffY = offUp; worldOffY = offUp;
worldOffX = facing.offsetX * offFwd + facing.getRotation(ForgeDirection.UP).offsetX * offLat; worldOffX = facing.offsetX * offFwd + facing.getRotation(ForgeDirection.UP).offsetX * offLat;
worldOffZ = facing.offsetZ * offFwd + facing.getRotation(ForgeDirection.UP).offsetZ * 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 bx = -rot[4] + worldOffX; bx <= rot[5] + worldOffX; bx++) {
for(int by = -rot[1] + worldOffY; by <= rot[0] + worldOffY; by++) { for(int by = -rot[1] + worldOffY; by <= rot[0] + worldOffY; by++) {
for(int bz = -rot[2] + worldOffZ; bz <= rot[3] + worldOffZ; bz++) { for(int bz = -rot[2] + worldOffZ; bz <= rot[3] + worldOffZ; bz++) {
BlockPos bp = new BlockPos( BlockPos bp = new BlockPos(MathHelper.floor_double(originX) + bx, MathHelper.floor_double(originY) + by, MathHelper.floor_double(originZ) + bz);
MathHelper.floor_double(originX) + bx,
MathHelper.floor_double(originY) + by,
MathHelper.floor_double(originZ) + bz
);
blocks.add(bp); blocks.add(bp);
set.add(bp); set.add(bp);
} }
} }
} }
} }
//This looks for the blocks nearby and draws lines between the vertexes to make different shaped boxes. // This looks for the blocks nearby and draws lines between the
//Most of this was taken from Mellow (Thanks mellow) -Wolf // vertexes to make different shaped boxes.
for(BlockPos pos : blocks) { // Most of this was taken from Mellow (Thanks mellow) -Wolf
boolean px = set.contains(pos.add(1, 0, 0)); for(BlockPos pos : blocks) {
boolean nx = set.contains(pos.add(-1, 0, 0)); boolean px = set.contains(pos.add(1, 0, 0));
boolean ppy = set.contains(pos.add(0, 1, 0)); boolean nx = set.contains(pos.add(-1, 0, 0));
boolean ny = set.contains(pos.add(0, -1, 0)); boolean ppy = set.contains(pos.add(0, 1, 0));
boolean ppz = set.contains(pos.add(0, 0, 1)); boolean ny = set.contains(pos.add(0, -1, 0));
boolean nz = set.contains(pos.add(0, 0, -1)); boolean ppz = set.contains(pos.add(0, 0, 1));
boolean nz = set.contains(pos.add(0, 0, -1));
double minX = pos.getX() - dX; double minX = pos.getX() - dX;
double maxX = pos.getX() + 1 - 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 minZ = pos.getZ() - dZ;
double maxZ = pos.getZ() + 1 - dZ; double maxZ = pos.getZ() + 1 - dZ;
if(!ppy) { if(!ppy) {
if(!nx) { tess.addVertex(minX, maxY, minZ); tess.addVertex(minX, maxY, maxZ); } if(!nx) {
if(!ppz) { tess.addVertex(minX, maxY, maxZ); tess.addVertex(maxX, maxY, maxZ); } tess.addVertex(minX, maxY, minZ);
if(!px) { tess.addVertex(maxX, maxY, maxZ); tess.addVertex(maxX, maxY, minZ); } tess.addVertex(minX, maxY, maxZ);
if(!nz) { tess.addVertex(maxX, maxY, minZ); tess.addVertex(minX, maxY, minZ); } }
} if(!ppz) {
if(!ny) { tess.addVertex(minX, maxY, maxZ);
if(!nx) { tess.addVertex(minX, minY, minZ); tess.addVertex(minX, minY, maxZ); } tess.addVertex(maxX, maxY, 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(!px) {
if(!nz) { tess.addVertex(maxX, minY, minZ); tess.addVertex(minX, minY, minZ); } tess.addVertex(maxX, maxY, maxZ);
} tess.addVertex(maxX, maxY, minZ);
if(!nz) { }
if(!nx) { tess.addVertex(minX, minY, minZ); tess.addVertex(minX, maxY, minZ); } if(!nz) {
if(!ppy) { tess.addVertex(minX, maxY, minZ); tess.addVertex(maxX, maxY, minZ); } tess.addVertex(maxX, maxY, minZ);
if(!px) { tess.addVertex(maxX, maxY, minZ); tess.addVertex(maxX, minY, minZ); } tess.addVertex(minX, maxY, minZ);
if(!ny) { tess.addVertex(maxX, minY, minZ); tess.addVertex(minX, minY, minZ); } }
} }
if(!ppz) { if(!ny) {
if(!nx) { tess.addVertex(minX, minY, maxZ); tess.addVertex(minX, maxY, maxZ); } if(!nx) {
if(!ppy) { tess.addVertex(minX, maxY, maxZ); tess.addVertex(maxX, maxY, maxZ); } tess.addVertex(minX, minY, minZ);
if(!px) { tess.addVertex(maxX, maxY, maxZ); tess.addVertex(maxX, minY, maxZ); } tess.addVertex(minX, minY, maxZ);
if(!ny) { tess.addVertex(maxX, minY, maxZ); tess.addVertex(minX, minY, maxZ); } }
} if(!ppz) {
if(!nx) { tess.addVertex(minX, minY, maxZ);
if(!nz) { tess.addVertex(minX, minY, minZ); tess.addVertex(minX, maxY, minZ); } tess.addVertex(maxX, minY, maxZ);
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(!px) {
if(!ny) { tess.addVertex(minX, minY, maxZ); tess.addVertex(minX, minY, minZ); } tess.addVertex(maxX, minY, maxZ);
} tess.addVertex(maxX, minY, minZ);
if(!px) { }
if(!nz) { tess.addVertex(maxX, minY, minZ); tess.addVertex(maxX, maxY, minZ); } if(!nz) {
if(!ppy) { tess.addVertex(maxX, maxY, minZ); tess.addVertex(maxX, maxY, maxZ); } tess.addVertex(maxX, minY, minZ);
if(!ppz) { tess.addVertex(maxX, maxY, maxZ); tess.addVertex(maxX, minY, maxZ); } tess.addVertex(minX, minY, minZ);
if(!ny) { tess.addVertex(maxX, minY, maxZ); tess.addVertex(maxX, 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.draw();
tess.setTranslation(0, 0, 0); tess.setTranslation(0, 0, 0);

View File

@ -44,6 +44,13 @@ public class MachineFusionBoiler extends BlockDummyable implements ILookOverlay,
return 4; return 4;
} }
@Override
public double[][] getAABBExtras() {
return new double[][] {
{1.5, 3.5, -4.5, -4.5, 1, -1}
};
}
@Override @Override
public boolean checkRequirement(World world, int x, int y, int z, ForgeDirection dir, int o) { public boolean checkRequirement(World world, int x, int y, int z, ForgeDirection dir, int o) {
return super.checkRequirement(world, x, y, z, dir, o); return super.checkRequirement(world, x, y, z, dir, o);

View File

@ -36,6 +36,13 @@ public class MachineFusionBreeder extends BlockDummyable implements ITooltipProv
public int getOffset() { public int getOffset() {
return 2; return 2;
} }
@Override
public double[][] getAABBExtras() {
return new double[][] {
{1.5, 3.5, -2.5, -2.5, 1, -1}
};
}
@Override @Override
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) { public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) {

View File

@ -35,6 +35,13 @@ public class MachineFusionCollector extends BlockDummyable implements ITooltipPr
return 1; return 1;
} }
@Override
public double[][] getAABBExtras() {
return new double[][] {
{1.5, 3.5, -2.5, -2.5, 1, -1}
};
}
@Override @Override
public boolean checkRequirement(World world, int x, int y, int z, ForgeDirection dir, int o) { public boolean checkRequirement(World world, int x, int y, int z, ForgeDirection dir, int o) {
return super.checkRequirement(world, x, y, z, dir, o); return super.checkRequirement(world, x, y, z, dir, o);

View File

@ -34,6 +34,14 @@ public class MachineFusionCoupler extends BlockDummyable implements ITooltipProv
return 0; 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 @Override
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean ext) { public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean ext) {
addStandardInfo(stack, player, list, ext); addStandardInfo(stack, player, list, ext);

View File

@ -42,6 +42,14 @@ public class MachineFusionKlystron extends BlockDummyable implements ITooltipPro
new int[] { 4, -3, 4, 3, 1, 1 }, 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 @Override
public boolean checkRequirement(World world, int x, int y, int z, ForgeDirection dir, int o) { public boolean checkRequirement(World world, int x, int y, int z, ForgeDirection dir, int o) {
return super.checkRequirement(world, x, y, z, dir, o) && return super.checkRequirement(world, x, y, z, dir, o) &&

View File

@ -35,6 +35,14 @@ public class MachineFusionKlystronCreative extends BlockDummyable implements ITo
new int[] { 4, -3, 4, 3, 1, 1 }, 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 @Override
public boolean checkRequirement(World world, int x, int y, int z, ForgeDirection dir, int o) { public boolean checkRequirement(World world, int x, int y, int z, ForgeDirection dir, int o) {
return super.checkRequirement(world, x, y, z, dir, o) && return super.checkRequirement(world, x, y, z, dir, o) &&

View File

@ -44,6 +44,7 @@ public class MachineFusionMHDT extends BlockDummyable implements ILookOverlay, I
public int getOffset() { public int getOffset() {
return 7; return 7;
} }
@Override @Override
public int[][] getAllDimensions() { public int[][] getAllDimensions() {
return new int[][] { 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 }, 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 @Override
public boolean checkRequirement(World world, int x, int y, int z, ForgeDirection dir, int o) { public boolean checkRequirement(World world, int x, int y, int z, ForgeDirection dir, int o) {
return super.checkRequirement(world, x, y, z, dir, o) && return super.checkRequirement(world, x, y, z, dir, o) &&

View File

@ -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 @Override
public boolean checkRequirement(World world, int x, int y, int z, ForgeDirection dir, int o) { public boolean checkRequirement(World world, int x, int y, int z, ForgeDirection dir, int o) {
return super.checkRequirement(world, x, y, z, dir, o) && return super.checkRequirement(world, x, y, z, dir, o) &&

View File

@ -97,6 +97,27 @@ public class MachineFusionTorus extends BlockDummyable implements ITooltipProvid
public int getOffset() { public int getOffset() {
return 7; 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 @Override
public boolean checkRequirement(World world, int x, int y, int z, ForgeDirection dir, int o) { public boolean checkRequirement(World world, int x, int y, int z, ForgeDirection dir, int o) {

View File

@ -128,11 +128,8 @@ public class MultiblockHandlerXR {
public static int[] rotate(int[] dim, ForgeDirection dir) { public static int[] rotate(int[] dim, ForgeDirection dir) {
if(dim == null) if(dim == null) return null;
return null; if(dir == ForgeDirection.SOUTH) return dim;
if(dir == ForgeDirection.SOUTH)
return dim;
if(dir == ForgeDirection.NORTH) { if(dir == ForgeDirection.NORTH) {
// U D N S W E // U D N S W E
@ -151,5 +148,27 @@ public class MultiblockHandlerXR {
return dim; 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;
}
} }