Added gear renderer
This commit is contained in:
parent
ba53c65e77
commit
f92d8ad6f8
5 changed files with 78 additions and 6 deletions
|
@ -9,6 +9,8 @@ import resonantinduction.electrical.multimeter.ItemMultimeter;
|
|||
import resonantinduction.electrical.multimeter.RenderMultimeter;
|
||||
import resonantinduction.electrical.transformer.ItemTransformer;
|
||||
import resonantinduction.electrical.transformer.RenderTransformer;
|
||||
import resonantinduction.mechanical.gear.ItemGear;
|
||||
import resonantinduction.mechanical.gear.RenderGear;
|
||||
import cpw.mods.fml.client.FMLClientHandler;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
@ -37,7 +39,11 @@ public class RenderRIItem implements IItemRenderer
|
|||
@Override
|
||||
public void renderItem(ItemRenderType type, ItemStack item, Object... data)
|
||||
{
|
||||
if (item.getItem() instanceof ItemMultimeter)
|
||||
if (item.getItem() instanceof ItemGear)
|
||||
{
|
||||
RenderGear.INSTANCE.renderInventory(null, 0, 0, null);
|
||||
}
|
||||
else if (item.getItem() instanceof ItemMultimeter)
|
||||
{
|
||||
GL11.glPushMatrix();
|
||||
GL11.glRotatef(180, 0, 1, 0);
|
||||
|
|
|
@ -54,7 +54,7 @@ public class PartGear extends JCuboidPart implements JNormalOcclusion, TFacePart
|
|||
}
|
||||
}
|
||||
/** Side of the block this is placed on */
|
||||
private ForgeDirection placementSide;
|
||||
public ForgeDirection placementSide;
|
||||
|
||||
/** Positive torque means it is spinning clockwise */
|
||||
private long torque = 0;
|
||||
|
@ -221,7 +221,7 @@ 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);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -0,0 +1,66 @@
|
|||
package resonantinduction.mechanical.gear;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.client.model.AdvancedModelLoader;
|
||||
import net.minecraftforge.client.model.IModelCustom;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import resonantinduction.core.Reference;
|
||||
import cpw.mods.fml.client.FMLClientHandler;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class RenderGear
|
||||
{
|
||||
public static final RenderGear INSTANCE = new RenderGear();
|
||||
public final IModelCustom MODEL = AdvancedModelLoader.loadModel(Reference.MODEL_DIRECTORY + "gear/gear.obj");
|
||||
public final ResourceLocation TEXTURE = new ResourceLocation(Reference.DOMAIN, Reference.MODEL_PATH + "gear/gear.png");
|
||||
|
||||
public void renderInventory(Block block, int metadata, int modelID, RenderBlocks renderer)
|
||||
{
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef((float) 0.5F, (float) 0.5F, (float) 0.5F);
|
||||
FMLClientHandler.instance().getClient().renderEngine.bindTexture(TEXTURE);
|
||||
MODEL.renderAll();
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
public void renderDynamic(PartGear part, int x, int y, int z)
|
||||
{
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef((float) x + 0.5F, (float) y + 0.5F, (float) z + 0.5F);
|
||||
|
||||
switch (part.placementSide)
|
||||
{
|
||||
case DOWN:
|
||||
break;
|
||||
case UP:
|
||||
GL11.glRotatef(180, 0, 0, 1);
|
||||
GL11.glTranslatef(0, -2, 0);
|
||||
break;
|
||||
case NORTH:
|
||||
GL11.glRotatef(90, 1, 0, 0);
|
||||
GL11.glTranslatef(0, -1, -1);
|
||||
break;
|
||||
case SOUTH:
|
||||
GL11.glRotatef(-90, 1, 0, 0);
|
||||
GL11.glTranslatef(0, -1, 1);
|
||||
break;
|
||||
case WEST:
|
||||
GL11.glRotatef(90, 0, 0, 1);
|
||||
GL11.glTranslatef(1, -1, 0);
|
||||
break;
|
||||
case EAST:
|
||||
GL11.glRotatef(-90, 0, 0, 1);
|
||||
GL11.glTranslatef(-1, -1, 0);
|
||||
break;
|
||||
}
|
||||
FMLClientHandler.instance().getClient().renderEngine.bindTexture(TEXTURE);
|
||||
MODEL.renderAll();
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
}
|
|
@ -12,5 +12,5 @@ newmtl Material__25
|
|||
Kd 0.588000 0.588000 0.588000
|
||||
Ks 0.000000 0.000000 0.000000
|
||||
Ke 0.000000 0.000000 0.000000
|
||||
map_Ka C:\Users\mrabow\Google Drev\EDX\Cyanide\WoodTexture.png
|
||||
map_Kd C:\Users\mrabow\Google Drev\EDX\Cyanide\WoodTexture.png
|
||||
map_Ka gear.png
|
||||
map_Kd gear.png
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# 3ds Max Wavefront OBJ Exporter v0.97b - (c)2007 guruware
|
||||
# File Created: 15.01.2014 20:24:21
|
||||
|
||||
mtllib Gear.mtl
|
||||
mtllib gear.mtl
|
||||
|
||||
#
|
||||
# object Croc
|
||||
|
|
Loading…
Reference in a new issue