Finished multimeter model render

This commit is contained in:
Calclavia 2013-08-05 12:33:09 -04:00
parent b7e391ce89
commit 8dbef429f5
3 changed files with 98 additions and 108 deletions

View file

@ -183,11 +183,11 @@ public class ResonantInduction
metadata.modId = ID; metadata.modId = ID;
metadata.name = NAME; metadata.name = NAME;
metadata.description = "Resonant Induction is a Minecraft mod focusing on the manipulation of electricity and wireless technology. Ever wanted blazing electrical shocks flying off your evil lairs? You've came to the right place!"; metadata.description = "Resonant Induction is a Minecraft mod focusing on the manipulation of electricity and wireless technology. Ever wanted blazing electrical shocks flying off your evil lairs? You've came to the right place!";
metadata.url = "http://universalelectricity.com"; metadata.url = "http://universalelectricity.com/resonant-induction";
metadata.version = VERSION + BUILD_VERSION; metadata.version = VERSION + BUILD_VERSION;
metadata.authorList = Arrays.asList(new String[] { "Calclavia", "Aidancbrady" }); metadata.authorList = Arrays.asList(new String[] { "Calclavia", "Aidancbrady" });
metadata.logoFile = "/"; metadata.logoFile = "/";
metadata.credits = "Thanks to Archadia for the assets."; metadata.credits = "Thanks to Archadia for the awesome assets!";
metadata.autogenerated = true; metadata.autogenerated = true;
} }

View file

@ -35,7 +35,7 @@ public class BlockMultimeter extends BlockBase implements ITileEntityProvider
*/ */
public int onBlockPlaced(World par1World, int par2, int par3, int par4, int side, float hitX, float hitY, float hitZ, int metadata) public int onBlockPlaced(World par1World, int par2, int par3, int par4, int side, float hitX, float hitY, float hitZ, int metadata)
{ {
return ForgeDirection.getOrientation(side).ordinal(); return ForgeDirection.getOrientation(side).getOpposite().ordinal();
} }
@Override @Override

View file

@ -34,27 +34,24 @@ public class RenderMultimeter extends TileEntitySpecialRenderer
ForgeDirection direction = ForgeDirection.getOrientation(tileEntity.worldObj.getBlockMetadata(tileEntity.xCoord, tileEntity.yCoord, tileEntity.zCoord)); ForgeDirection direction = ForgeDirection.getOrientation(tileEntity.worldObj.getBlockMetadata(tileEntity.xCoord, tileEntity.yCoord, tileEntity.zCoord));
GL11.glPushMatrix(); GL11.glPushMatrix();
/ GL11.glTranslated(x + 0.5, y + 0.5, z + 0.5); GL11.glTranslated(x + 0.5, y + 0.5, z + 0.5);
GL11.glTranslated(x + 0.5, y + 1.5, z + 0.5); GL11.glRotatef(90, 0, 0, 1);
//GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F); GL11.glTranslated(0, -1, 0);
GL11.glRotatef(90F, 0, 0, 1);
GL11.glTranslated(x + 0.5, y + 1.5, z + 0.5);
/*
switch (direction) switch (direction)
{ {
case UP:
GL11.glRotatef(90, 0, 1, 0);
break;
case DOWN: case DOWN:
GL11.glRotatef(-90, 0, 1, 0);
break;
case NORTH:
GL11.glRotatef(180, 0, 1, 0);
GL11.glRotatef(180, 0, 0, 1); GL11.glRotatef(180, 0, 0, 1);
GL11.glTranslatef(0, -2, 0); GL11.glTranslatef(0, -2, 0);
break; break;
case UP:
break;
case NORTH:
GL11.glTranslatef(1, 1, 0);
GL11.glRotatef(90, 0, 0, 1);
break;
case SOUTH: case SOUTH:
GL11.glTranslatef(-1, 1, 0);
GL11.glRotatef(-90, 0, 0, 1);
break; break;
case WEST: case WEST:
GL11.glTranslatef(0, 1, 1); GL11.glTranslatef(0, 1, 1);
@ -65,19 +62,12 @@ public class RenderMultimeter extends TileEntitySpecialRenderer
GL11.glRotatef(90, 1, 0, 0); GL11.glRotatef(90, 1, 0, 0);
break; break;
} }
*/
this.func_110628_a(TEXTURE); this.func_110628_a(TEXTURE);
MODEL.render(0.0625f); MODEL.render(0.0625f);
GL11.glPopMatrix(); GL11.glPopMatrix();
/**
* Render from side 2 to 6. This means render all sides excluding top and bottom.
*/
for (int side = 0; side < 6; side++)
{
if (direction.ordinal() != side)
{
GL11.glPushMatrix(); GL11.glPushMatrix();
GL11.glPolygonOffset(-10, -10); GL11.glPolygonOffset(-10, -10);
GL11.glEnable(GL11.GL_POLYGON_OFFSET_FILL); GL11.glEnable(GL11.GL_POLYGON_OFFSET_FILL);
@ -88,39 +78,41 @@ public class RenderMultimeter extends TileEntitySpecialRenderer
float displayHeight = 1 - 2F / 16; float displayHeight = 1 - 2F / 16;
GL11.glTranslatef((float) x, (float) y, (float) z); GL11.glTranslatef((float) x, (float) y, (float) z);
switch (side) switch (direction)
{ {
case 1: case UP:
break;
case 0:
GL11.glTranslatef(1, 1, 0); GL11.glTranslatef(1, 1, 0);
GL11.glRotatef(180, 1, 0, 0); GL11.glRotatef(180, 1, 0, 0);
GL11.glRotatef(180, 0, 1, 0); GL11.glRotatef(180, 0, 1, 0);
GL11.glTranslatef(0, -0.9f, -0.1f);
break; break;
case 3: case DOWN:
GL11.glTranslatef(0, 1, 0); GL11.glRotatef(180, 0, 1, 0);
GL11.glRotatef(0, 0, 1, 0); GL11.glTranslatef(-1, -0.9f, -1.1f);
GL11.glRotatef(90, 1, 0, 0);
break; break;
case 2: case SOUTH:
GL11.glTranslatef(1, 1, 1); GL11.glTranslatef(1, 1, 1);
GL11.glRotatef(180, 0, 1, 0); GL11.glRotatef(180, 0, 1, 0);
GL11.glRotatef(90, 1, 0, 0); GL11.glRotatef(90, 1, 0, 0);
GL11.glTranslatef(0, -0.9f, -0.1f);
break; break;
case 5: case NORTH:
GL11.glTranslatef(0, 1, 1); GL11.glTranslatef(0, 1, 0);
GL11.glRotatef(90, 0, 1, 0); GL11.glRotatef(0, 0, 1, 0);
GL11.glRotatef(90, 1, 0, 0); GL11.glRotatef(90, 1, 0, 0);
GL11.glTranslatef(0, -0.9f, -0.1f);
break; break;
case 4: case EAST:
GL11.glTranslatef(1, 1, 0); GL11.glTranslatef(1, 1, 0);
GL11.glRotatef(-90, 0, 1, 0); GL11.glRotatef(-90, 0, 1, 0);
GL11.glRotatef(90, 1, 0, 0); GL11.glRotatef(90, 1, 0, 0);
GL11.glTranslatef(0, -0.9f, -0.1f);
break;
case WEST:
GL11.glTranslatef(0, 1, 1);
GL11.glRotatef(90, 0, 1, 0);
GL11.glRotatef(90, 1, 0, 0);
GL11.glTranslatef(0, -0.9f, -0.1f);
break; break;
} }
@ -162,6 +154,4 @@ public class RenderMultimeter extends TileEntitySpecialRenderer
GL11.glDisable(GL11.GL_POLYGON_OFFSET_FILL); GL11.glDisable(GL11.GL_POLYGON_OFFSET_FILL);
GL11.glPopMatrix(); GL11.glPopMatrix();
} }
}
}
} }