Gears now rendering

This commit is contained in:
Calclavia 2014-01-16 20:34:43 +08:00
parent f92d8ad6f8
commit 5538fda9d4
7 changed files with 686 additions and 619 deletions

View file

@ -1,4 +1,4 @@
package resonantinduction.electrical.render;
package resonantinduction.core.render;
import net.minecraft.item.ItemStack;
import net.minecraftforge.client.IItemRenderer;

View file

@ -4,6 +4,7 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import net.minecraftforge.client.MinecraftForgeClient;
import resonantinduction.core.render.RenderRIItem;
import resonantinduction.electrical.battery.RenderBattery;
import resonantinduction.electrical.battery.TileBattery;
import resonantinduction.electrical.encoder.TileEncoder;
@ -15,7 +16,6 @@ import resonantinduction.electrical.levitator.TileLevitator;
import resonantinduction.electrical.multimeter.GuiMultimeter;
import resonantinduction.electrical.multimeter.PartMultimeter;
import resonantinduction.electrical.render.FXElectricBolt;
import resonantinduction.electrical.render.RenderRIItem;
import resonantinduction.electrical.tesla.RenderTesla;
import resonantinduction.electrical.tesla.TileTesla;
import universalelectricity.api.vector.Vector3;

View file

@ -1,6 +1,7 @@
package resonantinduction.mechanical;
import net.minecraftforge.client.MinecraftForgeClient;
import resonantinduction.core.render.RenderRIItem;
import resonantinduction.mechanical.fluid.pipe.ItemPipeRenderer;
import resonantinduction.mechanical.fluid.pipe.RenderPipe;
import resonantinduction.mechanical.fluid.pipe.TilePipe;
@ -14,6 +15,7 @@ public class ClientProxy extends CommonProxy
@Override
public void preInit()
{
MinecraftForgeClient.registerItemRenderer(Mechanical.itemGear.itemID, RenderRIItem.INSTANCE);
}
@Override

View file

@ -221,7 +221,10 @@ public class PartGear extends JCuboidPart implements JNormalOcclusion, TFacePart
@SideOnly(Side.CLIENT)
public void renderDynamic(Vector3 pos, float frame, int pass)
{
RenderGear.INSTANCE.renderDynamic(this, tile().xCoord, tile().yCoord, tile().zCoord);
if (pass == 0)
{
RenderGear.INSTANCE.renderDynamic(this, pos.x, pos.y, pos.z);
}
}
@Override

View file

@ -23,44 +23,52 @@ public class RenderGear
public void renderInventory(Block block, int metadata, int modelID, RenderBlocks renderer)
{
GL11.glPushMatrix();
GL11.glTranslatef((float) 0.5F, (float) 0.5F, (float) 0.5F);
GL11.glTranslatef(-0.3f, 0.6f, 0);
GL11.glRotatef(75, 1, 0, 0);
GL11.glScalef(10, 10, 10);
FMLClientHandler.instance().getClient().renderEngine.bindTexture(TEXTURE);
MODEL.renderAll();
GL11.glPopMatrix();
}
public void renderDynamic(PartGear part, int x, int y, int z)
public void renderDynamic(PartGear part, double x, double y, double z)
{
GL11.glPushMatrix();
GL11.glTranslatef((float) x + 0.5F, (float) y + 0.5F, (float) z + 0.5F);
// Center the model first.
GL11.glTranslatef((float) x, (float) y + 0.5f, (float) z);
GL11.glPushMatrix();
switch (part.placementSide)
{
case DOWN:
GL11.glTranslatef(0, -0.5f, 0);
break;
case UP:
GL11.glRotatef(180, 0, 0, 1);
GL11.glTranslatef(0, -2, 0);
GL11.glTranslatef(0, 0.5f, 0);
break;
case NORTH:
GL11.glTranslatef(0, 0.5f, 0);
GL11.glRotatef(90, 1, 0, 0);
GL11.glTranslatef(0, -1, -1);
break;
case SOUTH:
GL11.glTranslatef(0, -0.5f, 1f);
GL11.glRotatef(-90, 1, 0, 0);
GL11.glTranslatef(0, -1, 1);
break;
case WEST:
GL11.glTranslatef(0.1f, -0.5f, 0);
GL11.glRotatef(90, 0, 0, 1);
GL11.glTranslatef(1, -1, 0);
break;
case EAST:
GL11.glTranslatef(0.9f, 0.5f, 0);
GL11.glRotatef(-90, 0, 0, 1);
GL11.glTranslatef(-1, -1, 0);
break;
}
GL11.glScalef(10, 10, 10);
FMLClientHandler.instance().getClient().renderEngine.bindTexture(TEXTURE);
MODEL.renderAll();
GL11.glPopMatrix();
GL11.glPopMatrix();
}
}

View file

@ -1,16 +1,13 @@
# 3ds Max Wavefront OBJ Exporter v0.97b - (c)2007 guruware
# File Created: 15.01.2014 20:24:21
# Blender MTL File: 'None'
# Material Count: 1
newmtl Material__25
Ns 10.000000
Ni 1.500000
d 1.000000
Tr 0.000000
Tf 1.000000 1.000000 1.000000
illum 2
Ka 0.588000 0.588000 0.588000
Kd 0.588000 0.588000 0.588000
Ks 0.000000 0.000000 0.000000
Ke 0.000000 0.000000 0.000000
map_Ka gear.png
map_Kd gear.png
Ns 7.843137
Ka 0.000000 0.000000 0.000000
Kd 0.470400 0.470400 0.470400
Ks 0.000000 0.000000 0.000000
Ni 1.000000
d 1.000000
illum 2
map_Kd gear.png
map_Ka gear.png