mirror of
https://github.com/HbmMods/Hbm-s-Nuclear-Tech-GIT.git
synced 2026-02-23 14:30:51 +00:00
Detect room bounds when linking RBMK crane
This commit is contained in:
parent
097b2bb12c
commit
d8080835f8
@ -116,26 +116,26 @@ public class RenderCraneConsole extends TileEntitySpecialRenderer {
|
|||||||
switch((craneRotationOffset + teFacing) % 360) {
|
switch((craneRotationOffset + teFacing) % 360) {
|
||||||
case 0:
|
case 0:
|
||||||
girderSpan = console.spanF + console.spanB + 1;
|
girderSpan = console.spanF + console.spanB + 1;
|
||||||
GL11.glTranslated(posX + console.spanB, 0, 0);
|
GL11.glTranslated(posX - console.spanB, 0, 0);
|
||||||
break;
|
break;
|
||||||
case 90:
|
case 90:
|
||||||
girderSpan = console.spanL + console.spanR + 1;
|
girderSpan = console.spanL + console.spanR + 1;
|
||||||
GL11.glTranslated(0, 0, -posZ - console.spanR);
|
GL11.glTranslated(0, 0, -posZ + console.spanR);
|
||||||
break;
|
break;
|
||||||
case 180:
|
case 180:
|
||||||
girderSpan = console.spanF + console.spanB + 1;
|
girderSpan = console.spanF + console.spanB + 1;
|
||||||
GL11.glTranslated(posX - console.spanF, 0, 0);
|
GL11.glTranslated(posX + console.spanF, 0, 0);
|
||||||
break;
|
break;
|
||||||
case 270:
|
case 270:
|
||||||
girderSpan = console.spanL + console.spanR + 1;
|
girderSpan = console.spanL + console.spanR + 1;
|
||||||
GL11.glTranslated(0, 0, -posZ + console.spanL);
|
GL11.glTranslated(0, 0, -posZ - console.spanL);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
GL11.glRotatef(craneRotationOffset, 0F, 1F, 0F);
|
GL11.glRotatef(craneRotationOffset, 0F, 1F, 0F);
|
||||||
|
|
||||||
for(int i = 0; i < girderSpan; i++) {
|
for(int i = 0; i < girderSpan; i++) {
|
||||||
ResourceManager.rbmk_crane.renderPart("Girder");
|
ResourceManager.rbmk_crane.renderPart("Girder");
|
||||||
GL11.glTranslated(1, 0, 0);
|
GL11.glTranslated(-1, 0, 0);
|
||||||
}
|
}
|
||||||
GL11.glPopMatrix();
|
GL11.glPopMatrix();
|
||||||
|
|
||||||
|
|||||||
@ -275,10 +275,16 @@ public class TileEntityCraneConsole extends TileEntityLoadedBase implements Simp
|
|||||||
this.centerY = y + RBMKDials.getColumnHeight(worldObj) + 1;
|
this.centerY = y + RBMKDials.getColumnHeight(worldObj) + 1;
|
||||||
this.centerZ = z;
|
this.centerZ = z;
|
||||||
|
|
||||||
this.spanF = 16;
|
int girderY = centerY + 6;
|
||||||
this.spanB = 7;
|
|
||||||
this.spanL = 7;
|
ForgeDirection dir = ForgeDirection.getOrientation(this.getBlockMetadata() - BlockDummyable.offset);
|
||||||
this.spanR = 7;
|
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;
|
this.height = 7;
|
||||||
|
|
||||||
@ -287,6 +293,16 @@ public class TileEntityCraneConsole extends TileEntityLoadedBase implements Simp
|
|||||||
this.markDirty();
|
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() {
|
public void cycleCraneRotation() {
|
||||||
this.craneRotationOffset = (this.craneRotationOffset + 90) % 360;
|
this.craneRotationOffset = (this.craneRotationOffset + 90) % 360;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user