From 8294df1aa36eb7c58ac8af8454c91607cc7001a7 Mon Sep 17 00:00:00 2001 From: abel1502 Date: Tue, 8 Jul 2025 22:39:15 +0300 Subject: [PATCH 1/4] Extend RBMK crane reach forward Enables close-to-real-life reactor hall replicas, with the storage columns being located further in the reactor hall than the reactor itself --- .../com/hbm/tileentity/machine/rbmk/TileEntityCraneConsole.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/hbm/tileentity/machine/rbmk/TileEntityCraneConsole.java b/src/main/java/com/hbm/tileentity/machine/rbmk/TileEntityCraneConsole.java index 120efd4f5..dca789607 100644 --- a/src/main/java/com/hbm/tileentity/machine/rbmk/TileEntityCraneConsole.java +++ b/src/main/java/com/hbm/tileentity/machine/rbmk/TileEntityCraneConsole.java @@ -275,7 +275,7 @@ public class TileEntityCraneConsole extends TileEntityLoadedBase implements Simp this.centerY = y + RBMKDials.getColumnHeight(worldObj) + 1; this.centerZ = z; - this.spanF = 7; + this.spanF = 16; this.spanB = 7; this.spanL = 7; this.spanR = 7; From 097b2bb12c7742ff59d8e453eabc03d9b2f18ae3 Mon Sep 17 00:00:00 2001 From: abel1502 Date: Wed, 9 Jul 2025 00:22:59 +0300 Subject: [PATCH 2/4] Fix RBMK crane girder rendering with unequal spans --- .../render/tileentity/RenderCraneConsole.java | 35 +++++++++---------- 1 file changed, 16 insertions(+), 19 deletions(-) diff --git a/src/main/java/com/hbm/render/tileentity/RenderCraneConsole.java b/src/main/java/com/hbm/render/tileentity/RenderCraneConsole.java index f25ef7f0e..8ebf386a9 100644 --- a/src/main/java/com/hbm/render/tileentity/RenderCraneConsole.java +++ b/src/main/java/com/hbm/render/tileentity/RenderCraneConsole.java @@ -22,12 +22,14 @@ public class RenderCraneConsole extends TileEntitySpecialRenderer { GL11.glDisable(GL11.GL_CULL_FACE); GL11.glEnable(GL11.GL_LIGHTING); + int teFacing = 0; switch(te.getBlockMetadata() - BlockDummyable.offset) { - case 2: GL11.glRotatef(90, 0F, 1F, 0F); break; - case 4: GL11.glRotatef(180, 0F, 1F, 0F); break; - case 3: GL11.glRotatef(270, 0F, 1F, 0F); break; - case 5: GL11.glRotatef(0, 0F, 1F, 0F); break; + case 2: teFacing = 90; break; + case 4: teFacing = 180; break; + case 3: teFacing = 270; break; + case 5: teFacing = 0; break; } + GL11.glRotatef(teFacing, 0F, 1F, 0F); TileEntityCraneConsole console = (TileEntityCraneConsole) te; @@ -99,12 +101,7 @@ public class RenderCraneConsole extends TileEntitySpecialRenderer { double cranePosZ = (-te.zCoord + console.centerZ); GL11.glTranslated(cranePosX, cranePosY, cranePosZ); - switch(te.getBlockMetadata() - BlockDummyable.offset) { - case 2: GL11.glRotatef(90, 0F, 1F, 0F); break; - case 4: GL11.glRotatef(180, 0F, 1F, 0F); break; - case 3: GL11.glRotatef(270, 0F, 1F, 0F); break; - case 5: GL11.glRotatef(0, 0F, 1F, 0F); break; - } + GL11.glRotatef(teFacing, 0F, 1F, 0F); double posX = (console.lastPosFront + (console.posFront - console.lastPosFront) * interp); double posZ = (console.lastPosLeft + (console.posLeft - console.lastPosLeft) * interp); @@ -116,22 +113,22 @@ public class RenderCraneConsole extends TileEntitySpecialRenderer { GL11.glPushMatrix(); int girderSpan = 0; GL11.glRotatef(-craneRotationOffset, 0F, 1F, 0F); - switch(craneRotationOffset) { + switch((craneRotationOffset + teFacing) % 360) { case 0: - girderSpan = console.spanL + console.spanR + 1; - GL11.glTranslated(posX - console.spanL, 0, 0); + girderSpan = console.spanF + console.spanB + 1; + GL11.glTranslated(posX + console.spanB, 0, 0); break; case 90: - girderSpan = console.spanF + console.spanB + 1; - GL11.glTranslated(0, 0, -posZ + console.spanB); + girderSpan = console.spanL + console.spanR + 1; + GL11.glTranslated(0, 0, -posZ - console.spanR); break; case 180: - girderSpan = console.spanL + console.spanR + 1; - GL11.glTranslated(posX + console.spanR, 0, 0); + girderSpan = console.spanF + console.spanB + 1; + GL11.glTranslated(posX - console.spanF, 0, 0); break; case 270: - girderSpan = console.spanF + console.spanB + 1; - GL11.glTranslated(0, 0, -posZ - console.spanF); + girderSpan = console.spanL + console.spanR + 1; + GL11.glTranslated(0, 0, -posZ + console.spanL); break; } GL11.glRotatef(craneRotationOffset, 0F, 1F, 0F); From d8080835f854d8cbbc204d1449245859e2849ebf Mon Sep 17 00:00:00 2001 From: abel1502 Date: Wed, 9 Jul 2025 00:53:14 +0300 Subject: [PATCH 3/4] Detect room bounds when linking RBMK crane --- .../render/tileentity/RenderCraneConsole.java | 10 ++++---- .../machine/rbmk/TileEntityCraneConsole.java | 24 +++++++++++++++---- 2 files changed, 25 insertions(+), 9 deletions(-) diff --git a/src/main/java/com/hbm/render/tileentity/RenderCraneConsole.java b/src/main/java/com/hbm/render/tileentity/RenderCraneConsole.java index 8ebf386a9..3cb8e1f35 100644 --- a/src/main/java/com/hbm/render/tileentity/RenderCraneConsole.java +++ b/src/main/java/com/hbm/render/tileentity/RenderCraneConsole.java @@ -116,26 +116,26 @@ public class RenderCraneConsole extends TileEntitySpecialRenderer { switch((craneRotationOffset + teFacing) % 360) { case 0: girderSpan = console.spanF + console.spanB + 1; - GL11.glTranslated(posX + console.spanB, 0, 0); + GL11.glTranslated(posX - console.spanB, 0, 0); break; case 90: girderSpan = console.spanL + console.spanR + 1; - GL11.glTranslated(0, 0, -posZ - console.spanR); + GL11.glTranslated(0, 0, -posZ + console.spanR); break; case 180: girderSpan = console.spanF + console.spanB + 1; - GL11.glTranslated(posX - console.spanF, 0, 0); + GL11.glTranslated(posX + console.spanF, 0, 0); break; case 270: girderSpan = console.spanL + console.spanR + 1; - GL11.glTranslated(0, 0, -posZ + console.spanL); + GL11.glTranslated(0, 0, -posZ - console.spanL); break; } GL11.glRotatef(craneRotationOffset, 0F, 1F, 0F); for(int i = 0; i < girderSpan; i++) { ResourceManager.rbmk_crane.renderPart("Girder"); - GL11.glTranslated(1, 0, 0); + GL11.glTranslated(-1, 0, 0); } GL11.glPopMatrix(); diff --git a/src/main/java/com/hbm/tileentity/machine/rbmk/TileEntityCraneConsole.java b/src/main/java/com/hbm/tileentity/machine/rbmk/TileEntityCraneConsole.java index dca789607..74ce6ec07 100644 --- a/src/main/java/com/hbm/tileentity/machine/rbmk/TileEntityCraneConsole.java +++ b/src/main/java/com/hbm/tileentity/machine/rbmk/TileEntityCraneConsole.java @@ -275,10 +275,16 @@ public class TileEntityCraneConsole extends TileEntityLoadedBase implements Simp this.centerY = y + RBMKDials.getColumnHeight(worldObj) + 1; this.centerZ = z; - this.spanF = 16; - this.spanB = 7; - this.spanL = 7; - this.spanR = 7; + int girderY = centerY + 6; + + ForgeDirection dir = ForgeDirection.getOrientation(this.getBlockMetadata() - BlockDummyable.offset); + this.spanF = this.findRoomExtent(x, girderY, z, dir, 0); + dir = dir.getRotation(ForgeDirection.UP); + this.spanR = this.findRoomExtent(x, girderY, z, dir, 0); + dir = dir.getRotation(ForgeDirection.UP); + this.spanB = this.findRoomExtent(x, girderY, z, dir, 0); + dir = dir.getRotation(ForgeDirection.UP); + this.spanL = this.findRoomExtent(x, girderY, z, dir, 0); this.height = 7; @@ -287,6 +293,16 @@ public class TileEntityCraneConsole extends TileEntityLoadedBase implements Simp this.markDirty(); } + private int findRoomExtent(int x, int y, int z, ForgeDirection dir, int def) { + for (int i = 1; i < 32; i++) { + if (!worldObj.isAirBlock(x + dir.offsetX * i, y, z + dir.offsetZ * i)) { + return i - 1; + } + } + + return def; + } + public void cycleCraneRotation() { this.craneRotationOffset = (this.craneRotationOffset + 90) % 360; } From 19fd4791705c945df04b41b6b8f7fbc9afa9c54d Mon Sep 17 00:00:00 2001 From: abel1502 Date: Wed, 9 Jul 2025 01:48:51 +0300 Subject: [PATCH 4/4] Fix stuff --- .../render/tileentity/RenderCraneConsole.java | 10 +++++----- .../machine/rbmk/TileEntityCraneConsole.java | 16 ++++++++-------- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/main/java/com/hbm/render/tileentity/RenderCraneConsole.java b/src/main/java/com/hbm/render/tileentity/RenderCraneConsole.java index 3cb8e1f35..87fc5309e 100644 --- a/src/main/java/com/hbm/render/tileentity/RenderCraneConsole.java +++ b/src/main/java/com/hbm/render/tileentity/RenderCraneConsole.java @@ -113,22 +113,22 @@ public class RenderCraneConsole extends TileEntitySpecialRenderer { GL11.glPushMatrix(); int girderSpan = 0; GL11.glRotatef(-craneRotationOffset, 0F, 1F, 0F); - switch((craneRotationOffset + teFacing) % 360) { + switch(craneRotationOffset) { case 0: girderSpan = console.spanF + console.spanB + 1; - GL11.glTranslated(posX - console.spanB, 0, 0); + GL11.glTranslated(posX + console.spanB, 0, 0); break; case 90: girderSpan = console.spanL + console.spanR + 1; - GL11.glTranslated(0, 0, -posZ + console.spanR); + GL11.glTranslated(0, 0, -posZ - console.spanR); break; case 180: girderSpan = console.spanF + console.spanB + 1; - GL11.glTranslated(posX + console.spanF, 0, 0); + GL11.glTranslated(posX - console.spanF, 0, 0); break; case 270: girderSpan = console.spanL + console.spanR + 1; - GL11.glTranslated(0, 0, -posZ - console.spanL); + GL11.glTranslated(0, 0, -posZ + console.spanL); break; } GL11.glRotatef(craneRotationOffset, 0F, 1F, 0F); diff --git a/src/main/java/com/hbm/tileentity/machine/rbmk/TileEntityCraneConsole.java b/src/main/java/com/hbm/tileentity/machine/rbmk/TileEntityCraneConsole.java index 74ce6ec07..2c3b4ebb4 100644 --- a/src/main/java/com/hbm/tileentity/machine/rbmk/TileEntityCraneConsole.java +++ b/src/main/java/com/hbm/tileentity/machine/rbmk/TileEntityCraneConsole.java @@ -277,14 +277,14 @@ public class TileEntityCraneConsole extends TileEntityLoadedBase implements Simp int girderY = centerY + 6; - ForgeDirection dir = ForgeDirection.getOrientation(this.getBlockMetadata() - BlockDummyable.offset); - this.spanF = this.findRoomExtent(x, girderY, z, dir, 0); + ForgeDirection dir = ForgeDirection.getOrientation(this.getBlockMetadata() - BlockDummyable.offset).getOpposite(); + this.spanF = this.findRoomExtent(x, girderY, z, dir, 16); dir = dir.getRotation(ForgeDirection.UP); - this.spanR = this.findRoomExtent(x, girderY, z, dir, 0); + this.spanR = this.findRoomExtent(x, girderY, z, dir, 16); dir = dir.getRotation(ForgeDirection.UP); - this.spanB = this.findRoomExtent(x, girderY, z, dir, 0); + this.spanB = this.findRoomExtent(x, girderY, z, dir, 16); dir = dir.getRotation(ForgeDirection.UP); - this.spanL = this.findRoomExtent(x, girderY, z, dir, 0); + this.spanL = this.findRoomExtent(x, girderY, z, dir, 16); this.height = 7; @@ -293,14 +293,14 @@ public class TileEntityCraneConsole extends TileEntityLoadedBase implements Simp this.markDirty(); } - private int findRoomExtent(int x, int y, int z, ForgeDirection dir, int def) { - for (int i = 1; i < 32; i++) { + private int findRoomExtent(int x, int y, int z, ForgeDirection dir, int max) { + for (int i = 1; i < max; i++) { if (!worldObj.isAirBlock(x + dir.offsetX * i, y, z + dir.offsetZ * i)) { return i - 1; } } - return def; + return max; } public void cycleCraneRotation() {