diff options
Diffstat (limited to 'src/Java/gtPlusPlus/core/client')
-rw-r--r-- | src/Java/gtPlusPlus/core/client/model/ModelDecayChest.java | 46 | ||||
-rw-r--r-- | src/Java/gtPlusPlus/core/client/renderer/RenderDecayChest.java | 81 |
2 files changed, 127 insertions, 0 deletions
diff --git a/src/Java/gtPlusPlus/core/client/model/ModelDecayChest.java b/src/Java/gtPlusPlus/core/client/model/ModelDecayChest.java new file mode 100644 index 0000000000..c116dcf115 --- /dev/null +++ b/src/Java/gtPlusPlus/core/client/model/ModelDecayChest.java @@ -0,0 +1,46 @@ +package gtPlusPlus.core.client.model; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import net.minecraft.client.model.ModelBase; +import net.minecraft.client.model.ModelRenderer; + +@SideOnly(Side.CLIENT) +public class ModelDecayChest extends ModelBase +{ + /** The chest lid in the chest's model. */ + public ModelRenderer chestLid = (new ModelRenderer(this, 0, 0)).setTextureSize(64, 64); + /** The model of the bottom of the chest. */ + public ModelRenderer chestBelow; + /** The chest's knob in the chest model. */ + public ModelRenderer chestKnob; + + public ModelDecayChest() + { + this.chestLid.addBox(0.0F, -5.0F, -14.0F, 14, 5, 14, 0.0F); + this.chestLid.rotationPointX = 1.0F; + this.chestLid.rotationPointY = 7.0F; + this.chestLid.rotationPointZ = 15.0F; + this.chestKnob = (new ModelRenderer(this, 0, 0)).setTextureSize(64, 64); + this.chestKnob.addBox(-1.0F, -2.0F, -15.0F, 2, 4, 1, 0.0F); + this.chestKnob.rotationPointX = 8.0F; + this.chestKnob.rotationPointY = 7.0F; + this.chestKnob.rotationPointZ = 15.0F; + this.chestBelow = (new ModelRenderer(this, 0, 19)).setTextureSize(64, 64); + this.chestBelow.addBox(0.0F, 0.0F, 0.0F, 14, 10, 14, 0.0F); + this.chestBelow.rotationPointX = 1.0F; + this.chestBelow.rotationPointY = 6.0F; + this.chestBelow.rotationPointZ = 1.0F; + } + + /** + * This method renders out all parts of the chest model. + */ + public void renderAll() + { + this.chestKnob.rotateAngleX = this.chestLid.rotateAngleX; + this.chestLid.render(0.0625F); + this.chestKnob.render(0.0625F); + this.chestBelow.render(0.0625F); + } +}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/client/renderer/RenderDecayChest.java b/src/Java/gtPlusPlus/core/client/renderer/RenderDecayChest.java new file mode 100644 index 0000000000..7b120c5de1 --- /dev/null +++ b/src/Java/gtPlusPlus/core/client/renderer/RenderDecayChest.java @@ -0,0 +1,81 @@ +package gtPlusPlus.core.client.renderer; + +import org.lwjgl.opengl.GL11; +import org.lwjgl.opengl.GL12; + +import cpw.mods.fml.client.registry.RenderingRegistry; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import gtPlusPlus.api.objects.Logger; +import gtPlusPlus.core.client.model.ModelDecayChest; +import gtPlusPlus.core.lib.CORE; +import gtPlusPlus.core.tileentities.general.TileEntityDecayablesChest; +import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.ResourceLocation; + +@SideOnly(Side.CLIENT) +public class RenderDecayChest extends TileEntitySpecialRenderer { + + private static final ResourceLocation mChestTexture = new ResourceLocation(CORE.MODID, "textures/blocks/TileEntities/DecayablesChest_full.png"); + private ModelDecayChest mChestModel = new ModelDecayChest(); + + public static RenderDecayChest INSTANCE; + public final int mRenderID; + + public RenderDecayChest() { + INSTANCE = this; + this.mRenderID = RenderingRegistry.getNextAvailableRenderId(); + Logger.INFO("Registered Lead Lined Chest Renderer."); + } + + public void renderTileEntityAt(TileEntityDecayablesChest p_147500_1_, double p_147500_2_, double p_147500_4_, + double p_147500_6_, float p_147500_8_) { + + int i = 0; + + if (true) { + this.bindTexture(mChestTexture); + GL11.glPushMatrix(); + GL11.glEnable(GL12.GL_RESCALE_NORMAL); + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + GL11.glTranslatef((float) p_147500_2_, (float) p_147500_4_ + 1.0F, (float) p_147500_6_ + 1.0F); + GL11.glScalef(1.0F, -1.0F, -1.0F); + GL11.glTranslatef(0.5F, 0.5F, 0.5F); + short short1 = 0; + + if (i == 2) { + short1 = 180; + } + + if (i == 3) { + short1 = 0; + } + + if (i == 4) { + short1 = 90; + } + + if (i == 5) { + short1 = -90; + } + + GL11.glRotatef((float) short1, 0.0F, 1.0F, 0.0F); + GL11.glTranslatef(-0.5F, -0.5F, -0.5F); + float f1 = p_147500_1_.prevLidAngle + (p_147500_1_.lidAngle - p_147500_1_.prevLidAngle) * p_147500_8_; + + f1 = 1.0F - f1; + f1 = 1.0F - f1 * f1 * f1; + mChestModel.chestLid.rotateAngleX = -(f1 * CORE.PI / 2.0F); + mChestModel.renderAll(); + GL11.glDisable(GL12.GL_RESCALE_NORMAL); + GL11.glPopMatrix(); + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + } + } + + public void renderTileEntityAt(TileEntity p_147500_1_, double p_147500_2_, double p_147500_4_, double p_147500_6_, + float p_147500_8_) { + this.renderTileEntityAt((TileEntityDecayablesChest) p_147500_1_, p_147500_2_, p_147500_4_, p_147500_6_, p_147500_8_); + } +}
\ No newline at end of file |