Animated the conveyor belts
To do: animate manipulators
This commit is contained in:
parent
790fbb3e9c
commit
b55ca97831
4 changed files with 28 additions and 3 deletions
Binary file not shown.
Before Width: | Height: | Size: 791 B |
|
@ -34,7 +34,7 @@ public class BlockRenderingHandler implements ISimpleBlockRenderingHandler
|
|||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef((float) 0.0F, (float) 1.5F, (float) 0.0F);
|
||||
GL11.glRotatef(180f, 0f, 0f, 1f);
|
||||
GL11.glBindTexture(GL11.GL_TEXTURE_2D, FMLClientHandler.instance().getClient().renderEngine.getTexture(AssemblyLine.TEXTURE_PATH + "BeltTexture.png"));
|
||||
GL11.glBindTexture(GL11.GL_TEXTURE_2D, FMLClientHandler.instance().getClient().renderEngine.getTexture(AssemblyLine.TEXTURE_PATH + "belt/frame0.png"));
|
||||
modelConveyorBelt.render(0.0625F, 0, false, false, false);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
|
|
@ -27,7 +27,10 @@ public class RenderConveyorBelt extends TileEntitySpecialRenderer
|
|||
GL11.glTranslatef((float) x + 0.5F, (float) y + 1.5F, (float) z + 0.5F);
|
||||
GL11.glRotatef(180f, 0f, 0f, 1f);
|
||||
|
||||
this.bindTextureByName(AssemblyLine.TEXTURE_PATH + "BeltTexture.png");
|
||||
int frame = tileEntity.getAnimationFrame();
|
||||
|
||||
this.bindTextureByName(AssemblyLine.TEXTURE_PATH + "belt/frame" + frame + ".png"); //belt/frame0.png through belt/frame13.png
|
||||
//System.out.println(AssemblyLine.TEXTURE_PATH + "belt/frame" + frame + ".png");
|
||||
|
||||
switch (face)
|
||||
{
|
||||
|
|
|
@ -30,6 +30,8 @@ public class TileEntityConveyorBelt extends TileEntityAssemblyNetwork implements
|
|||
NONE, UP, DOWN
|
||||
}
|
||||
|
||||
public static final int NUM_FRAMES = 13;
|
||||
|
||||
/**
|
||||
* Joules required to run this thing.
|
||||
*/
|
||||
|
@ -37,6 +39,7 @@ public class TileEntityConveyorBelt extends TileEntityAssemblyNetwork implements
|
|||
public final float maxSpeed = 0.1f;
|
||||
|
||||
public float wheelRotation = 0;
|
||||
public int animFrame = 0; //this is from 0 to 15
|
||||
private SlantType slantType = SlantType.NONE;
|
||||
|
||||
public TileEntityConveyorBelt()
|
||||
|
@ -113,10 +116,15 @@ public class TileEntityConveyorBelt extends TileEntityAssemblyNetwork implements
|
|||
|
||||
if (this.isRunning())
|
||||
{
|
||||
this.wheelRotation += 2;
|
||||
this.wheelRotation += 40;
|
||||
|
||||
if (this.wheelRotation > 360)
|
||||
this.wheelRotation = 0;
|
||||
|
||||
float wheelRotPct = wheelRotation / 360f;
|
||||
animFrame = (int) (wheelRotPct * NUM_FRAMES); //sync the animation
|
||||
if (animFrame < 0) animFrame = 0;
|
||||
if (animFrame > NUM_FRAMES) animFrame = NUM_FRAMES;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -245,6 +253,20 @@ public class TileEntityConveyorBelt extends TileEntityAssemblyNetwork implements
|
|||
return worldObj.getEntitiesWithinAABB(Entity.class, bounds);
|
||||
}
|
||||
|
||||
public int getAnimationFrame()
|
||||
{
|
||||
TileEntity te = null;
|
||||
te = worldObj.getBlockTileEntity(xCoord - 1, yCoord, zCoord);
|
||||
if (te != null)
|
||||
if (te instanceof TileEntityConveyorBelt)
|
||||
return ((TileEntityConveyorBelt) te).getAnimationFrame();
|
||||
te = worldObj.getBlockTileEntity(xCoord, yCoord, zCoord - 1);
|
||||
if (te != null)
|
||||
if (te instanceof TileEntityConveyorBelt)
|
||||
return ((TileEntityConveyorBelt) te).getAnimationFrame();
|
||||
return animFrame;
|
||||
}
|
||||
|
||||
/**
|
||||
* NBT Data
|
||||
*/
|
||||
|
|
Loading…
Reference in a new issue