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
* 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
* Fixed RoR terminal's `set` command not working

View File

@ -603,7 +603,11 @@ 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)
@ -619,7 +623,7 @@ 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);
@ -638,27 +642,31 @@ 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<BlockPos> blocks = new java.util.ArrayList<>();
Set<BlockPos> 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;
@ -672,11 +680,7 @@ 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);
}
@ -684,15 +688,16 @@ public abstract class BlockDummyable extends BlockContainer implements ICustomBl
}
}
//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,43 +706,154 @@ 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);

View File

@ -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);

View File

@ -37,6 +37,13 @@ public class MachineFusionBreeder extends BlockDummyable implements ITooltipProv
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) {
return super.standardOpenBehavior(world, x, y, z, player, 0);

View File

@ -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);

View File

@ -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);

View File

@ -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) &&

View File

@ -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) &&

View File

@ -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) &&

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

View File

@ -98,6 +98,27 @@ public class MachineFusionTorus extends BlockDummyable implements ITooltipProvid
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) {

View File

@ -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
@ -152,4 +149,26 @@ 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;
}
}