crank rotation test
This commit is contained in:
@@ -6,6 +6,7 @@ import org.lwjgl.opengl.GL13;
|
||||
|
||||
import cpw.mods.fml.client.FMLClientHandler;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
@@ -16,14 +17,16 @@ import nmd.primal.energy.block.ModBlocks;
|
||||
import nmd.primal.energy.tileents.TileEntCrank;
|
||||
|
||||
public class RenderCrank extends TileEntitySpecialRenderer {
|
||||
|
||||
|
||||
public int i = 0;
|
||||
public int a = 0;
|
||||
public static final ResourceLocation MODEL = new ResourceLocation("energy:models/Crank.obj");
|
||||
public static final ResourceLocation TEXTURE = new ResourceLocation("energy:models/Crank.png");
|
||||
private IModelCustom model = AdvancedModelLoader.loadModel(MODEL);
|
||||
|
||||
@Override
|
||||
public void renderTileEntityAt(TileEntity tileEnt, double x, double y, double z, float scale) {
|
||||
|
||||
|
||||
GL11.glPushMatrix();
|
||||
|
||||
GL11.glTranslatef((float) x, (float) y, (float) z);
|
||||
@@ -33,11 +36,8 @@ public class RenderCrank extends TileEntitySpecialRenderer {
|
||||
GL11.glRotatef(180, 0.0f, 0.0f, 1.0f);
|
||||
GL11.glTranslatef(-1.0f, -1.0f, -0.0f);
|
||||
}
|
||||
if(tile.getBlockMetadata()==1){
|
||||
//GL11.glRotatef(180, 0.0f, 0.0f, 1.0f);
|
||||
//GL11.glTranslatef(-1.0f, -1.0f, -0.0f);
|
||||
//GL11.glRotated(45, 0, 1.0f, 0);
|
||||
}
|
||||
|
||||
|
||||
if(tile.getBlockMetadata()==2){
|
||||
GL11.glRotatef(-90, 1.0f, 0.0f, 0.0f);
|
||||
GL11.glTranslatef(0.0f, -1.0f, 0.0f);
|
||||
@@ -57,7 +57,7 @@ public class RenderCrank extends TileEntitySpecialRenderer {
|
||||
renderBlock(tile, tileEnt.getWorldObj(), tileEnt.xCoord,tileEnt.yCoord, tileEnt.zCoord, ModBlocks.crankBlock);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
|
||||
public void renderBlock(TileEntCrank tl, World world, int x, int y,int z, Block block) {
|
||||
|
||||
GL11.glPushMatrix();
|
||||
@@ -67,6 +67,27 @@ public class RenderCrank extends TileEntitySpecialRenderer {
|
||||
|
||||
GL11.glTranslatef(1.0F, 0.48F, 1.0F);
|
||||
|
||||
if(tl.getBlockMetadata()==1){
|
||||
//System.out.println((float)6.2832*(180F / (float)Math.PI));
|
||||
//for(int a=0; a<3600; a = a+10){
|
||||
|
||||
GL11.glRotatef(i, 0.0F, 1.0F, 0.0F);
|
||||
|
||||
|
||||
//}
|
||||
|
||||
//GL11.glRotatef((((180F / (float)Math.PI))), 0.0F, 1.0F, 0.0F);
|
||||
//(float)Minecraft.getSystemTime()
|
||||
}
|
||||
a++;
|
||||
if(a==5){
|
||||
i=i+2;
|
||||
a=0;
|
||||
}
|
||||
if(i==360){
|
||||
i=0;
|
||||
}
|
||||
//
|
||||
|
||||
FMLClientHandler.instance().getClient().renderEngine.bindTexture(TEXTURE);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user