mirror of
https://github.com/HbmMods/Hbm-s-Nuclear-Tech-GIT.git
synced 2026-01-25 10:32:49 +00:00
Merge pull request #2267 from abel1502/abel-rbmk-crane-span
RBMK crane improvement
This commit is contained in:
commit
0e92a96b2a
@ -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);
|
||||
@ -118,27 +115,27 @@ public class RenderCraneConsole extends TileEntitySpecialRenderer {
|
||||
GL11.glRotatef(-craneRotationOffset, 0F, 1F, 0F);
|
||||
switch(craneRotationOffset) {
|
||||
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);
|
||||
|
||||
for(int i = 0; i < girderSpan; i++) {
|
||||
ResourceManager.rbmk_crane.renderPart("Girder");
|
||||
GL11.glTranslated(1, 0, 0);
|
||||
GL11.glTranslated(-1, 0, 0);
|
||||
}
|
||||
GL11.glPopMatrix();
|
||||
|
||||
|
||||
@ -275,10 +275,16 @@ public class TileEntityCraneConsole extends TileEntityLoadedBase implements Simp
|
||||
this.centerY = y + RBMKDials.getColumnHeight(worldObj) + 1;
|
||||
this.centerZ = z;
|
||||
|
||||
this.spanF = 7;
|
||||
this.spanB = 7;
|
||||
this.spanL = 7;
|
||||
this.spanR = 7;
|
||||
int girderY = centerY + 6;
|
||||
|
||||
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, 16);
|
||||
dir = dir.getRotation(ForgeDirection.UP);
|
||||
this.spanB = this.findRoomExtent(x, girderY, z, dir, 16);
|
||||
dir = dir.getRotation(ForgeDirection.UP);
|
||||
this.spanL = this.findRoomExtent(x, girderY, z, dir, 16);
|
||||
|
||||
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 max) {
|
||||
for (int i = 1; i < max; i++) {
|
||||
if (!worldObj.isAirBlock(x + dir.offsetX * i, y, z + dir.offsetZ * i)) {
|
||||
return i - 1;
|
||||
}
|
||||
}
|
||||
|
||||
return max;
|
||||
}
|
||||
|
||||
public void cycleCraneRotation() {
|
||||
this.craneRotationOffset = (this.craneRotationOffset + 90) % 360;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user