Tweaked rendering of crane parts a bit
This commit is contained in:
parent
0c68e19733
commit
11a5b7315a
3 changed files with 25 additions and 14 deletions
|
@ -83,7 +83,7 @@ public class ModelCraneController extends ModelBase
|
|||
setRotation(ConnectorRight, 0F, 0F, 0F);
|
||||
}
|
||||
|
||||
public void render(float scale)
|
||||
public void render(float scale, boolean connectEast, boolean connectNorth)
|
||||
{
|
||||
Base2.setRotationPoint(-6F, 12F, -6F);
|
||||
setRotation(Base2, 0F, 0F, 0F);
|
||||
|
@ -106,13 +106,19 @@ public class ModelCraneController extends ModelBase
|
|||
|
||||
Base2.render(scale);
|
||||
Base.render(scale);
|
||||
ConnectorFront.render(scale);
|
||||
Decoration1.render(scale);
|
||||
Decoration2.render(scale);
|
||||
Decoration3.render(scale);
|
||||
Decoration4.render(scale);
|
||||
ConnectorTop.render(scale);
|
||||
ConnectorRight.render(scale);
|
||||
if (connectEast)
|
||||
{
|
||||
ConnectorFront.render(scale);
|
||||
Decoration1.render(scale);
|
||||
Decoration2.render(scale);
|
||||
}
|
||||
if (connectNorth)
|
||||
{
|
||||
ConnectorRight.render(scale);
|
||||
Decoration3.render(scale);
|
||||
Decoration4.render(scale);
|
||||
}
|
||||
}
|
||||
|
||||
private void setRotation(ModelRenderer model, float x, float y, float z)
|
||||
|
|
|
@ -81,7 +81,7 @@ public class BlockRenderingHandler implements ISimpleBlockRenderingHandler
|
|||
GL11.glTranslatef(0f, 1f, 0f);
|
||||
GL11.glRotatef(180f, 0f, 0f, 1f);
|
||||
GL11.glRotatef(-90f, 0f, 1f, 0f);
|
||||
RenderCraneController.MODEL.render(0.0625f);
|
||||
RenderCraneController.MODEL.render(0.0625f, false, false);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
else if (block.blockID == AssemblyLine.blockCraneFrame.blockID)
|
||||
|
|
|
@ -10,6 +10,7 @@ import net.minecraft.tileentity.TileEntity;
|
|||
import net.minecraftforge.common.ForgeDirection;
|
||||
import assemblyline.client.model.ModelCraneController;
|
||||
import assemblyline.common.AssemblyLine;
|
||||
import assemblyline.common.machine.crane.CraneHelper;
|
||||
import assemblyline.common.machine.crane.TileEntityCraneController;
|
||||
|
||||
public class RenderCraneController extends RenderImprintable
|
||||
|
@ -24,13 +25,11 @@ public class RenderCraneController extends RenderImprintable
|
|||
if (tileEntity != null && tileEntity instanceof TileEntityCraneController)
|
||||
{
|
||||
this.bindTextureByName(AssemblyLine.TEXTURE_PATH + (((TileEntityCraneController) tileEntity).isCraneValid() ? TEXTURE_VALID : TEXTURE));
|
||||
ForgeDirection rot = ForgeDirection.getOrientation(tileEntity.worldObj.getBlockMetadata(tileEntity.xCoord, tileEntity.yCoord, tileEntity.zCoord));
|
||||
ForgeDirection front = ForgeDirection.getOrientation(tileEntity.worldObj.getBlockMetadata(tileEntity.xCoord, tileEntity.yCoord, tileEntity.zCoord));
|
||||
ForgeDirection right = CraneHelper.rotateClockwise(front);
|
||||
float angle = 0f;
|
||||
|
||||
switch (rot)
|
||||
switch (front)
|
||||
{
|
||||
default:
|
||||
break;
|
||||
case NORTH:
|
||||
{
|
||||
angle = 90f;
|
||||
|
@ -47,12 +46,18 @@ public class RenderCraneController extends RenderImprintable
|
|||
break;
|
||||
}
|
||||
}
|
||||
int tX, tY, tZ;
|
||||
tX = tileEntity.xCoord;
|
||||
tY = tileEntity.yCoord;
|
||||
tZ = tileEntity.zCoord;
|
||||
boolean connectFront = CraneHelper.canFrameConnectTo(tileEntity, tX + front.offsetX, tY, tZ + front.offsetZ, front.getOpposite());
|
||||
boolean connectRight = CraneHelper.canFrameConnectTo(tileEntity, tX + right.offsetX, tY, tZ + right.offsetZ, right.getOpposite());
|
||||
glPushMatrix();
|
||||
glTranslated(x + 0.5, y + 1.5, z + 0.5);
|
||||
glRotatef(180f, 0f, 0f, 1f);
|
||||
glRotatef(angle, 0f, 1f, 0f);
|
||||
glEnable(GL_LIGHTING);
|
||||
MODEL.render(0.0625f);
|
||||
MODEL.render(0.0625f, connectRight, connectFront);
|
||||
glPopMatrix();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue