Added battery model and renderer

This commit is contained in:
Calclavia 2013-08-04 11:13:02 -04:00
parent 98c15becad
commit 1fd0bac321
4 changed files with 395 additions and 4 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

View file

@ -9,6 +9,7 @@ import net.minecraft.world.World;
import net.minecraftforge.common.ForgeDirection;
import resonantinduction.ResonantInduction;
import resonantinduction.base.BlockBase;
import resonantinduction.base.Vector3;
import resonantinduction.entangler.ItemCoordLink;
import resonantinduction.render.BlockRenderingHandler;
import cpw.mods.fml.relauncher.Side;
@ -30,7 +31,7 @@ public class BlockEMContractor extends BlockBase implements ITileEntityProvider
}
@Override
public boolean onBlockActivated(World par1World, int par2, int par3, int par4, EntityPlayer entityPlayer, int par6, float par7, float par8, float par9)
public boolean onBlockActivated(World world, int par2, int par3, int par4, EntityPlayer entityPlayer, int par6, float par7, float par8, float par9)
{
TileEntityEMContractor contractor = (TileEntityEMContractor) par1World.getBlockTileEntity(par2, par3, par4);
@ -39,10 +40,14 @@ public class BlockEMContractor extends BlockBase implements ITileEntityProvider
if (entityPlayer.getCurrentEquippedItem().getItem() instanceof ItemCoordLink)
{
ItemCoordLink link = ((ItemCoordLink) entityPlayer.getCurrentEquippedItem().getItem());
if (link.getLink(entityPlayer.getCurrentEquippedItem()) != null)
Vector3 linkVec = link.getLink(entityPlayer.getCurrentEquippedItem());
if (linkVec != null)
{
if(linkVec.getTileEntity(world) instanceof TileEntityEMContractor)
{
contractor.setLink((TileEntityEMContractor)linkVec.getTileEntity(world));
}
}
return false;

View file

@ -0,0 +1,348 @@
package resonantinduction.model;
import net.minecraft.client.model.ModelBase;
import net.minecraft.client.model.ModelRenderer;
public class ModelBattery extends ModelBase
{
// fields
ModelRenderer BackInnerPanel;
ModelRenderer Slide1;
ModelRenderer Slide2;
ModelRenderer Slide3;
ModelRenderer Slide4;
ModelRenderer Slide5;
ModelRenderer Slide6;
ModelRenderer Slide7;
ModelRenderer Slide8;
ModelRenderer Slide9;
ModelRenderer Slide10;
ModelRenderer Slide11;
ModelRenderer Slide12;
ModelRenderer Slide13;
ModelRenderer Slide14;
ModelRenderer Slide15;
ModelRenderer Slide16;
ModelRenderer Slide17;
ModelRenderer Slide18;
ModelRenderer Slide19;
ModelRenderer Slide20;
ModelRenderer Slide21;
ModelRenderer Slide22;
ModelRenderer Slide23;
ModelRenderer Slide24;
ModelRenderer Slide25;
ModelRenderer Slide26;
ModelRenderer Slide27;
ModelRenderer Slide28;
ModelRenderer FrontInnerPanel;
ModelRenderer RightInnerPanel;
ModelRenderer LeftInnerPanel;
ModelRenderer Podium;
ModelRenderer BottomBase;
ModelRenderer PodiumBase;
ModelRenderer TapNode1;
ModelRenderer TapNode2;
ModelRenderer TapNode3;
ModelRenderer TapNode4;
ModelRenderer ElectricalConduit;
public ModelBattery()
{
textureWidth = 128;
textureHeight = 128;
BackInnerPanel = new ModelRenderer(this, 0, 46);
BackInnerPanel.addBox(0F, 0F, 0F, 14, 15, 3);
BackInnerPanel.setRotationPoint(-7F, 9F, 4F);
BackInnerPanel.setTextureSize(64, 32);
BackInnerPanel.mirror = true;
setRotation(BackInnerPanel, 0F, 0F, 0F);
Slide1 = new ModelRenderer(this, 39, 0);
Slide1.addBox(0F, 0F, 0F, 14, 1, 1);
Slide1.setRotationPoint(-7F, 15F, 7F);
Slide1.setTextureSize(64, 32);
Slide1.mirror = true;
setRotation(Slide1, 0F, 0F, 0F);
Slide2 = new ModelRenderer(this, 39, 0);
Slide2.addBox(0F, 0F, 0F, 14, 1, 1);
Slide2.setRotationPoint(-7F, 15F, -8F);
Slide2.setTextureSize(64, 32);
Slide2.mirror = true;
setRotation(Slide2, 0F, 0F, 0F);
Slide3 = new ModelRenderer(this, 35, 0);
Slide3.addBox(0F, 0F, 0F, 16, 1, 1);
Slide3.setRotationPoint(-8F, 23F, -8F);
Slide3.setTextureSize(64, 32);
Slide3.mirror = true;
setRotation(Slide3, 0F, 0F, 0F);
Slide4 = new ModelRenderer(this, 35, 0);
Slide4.addBox(0F, 0F, 0F, 16, 1, 1);
Slide4.setRotationPoint(-8F, 23F, 7F);
Slide4.setTextureSize(64, 32);
Slide4.mirror = true;
setRotation(Slide4, 0F, 0F, 0F);
Slide5 = new ModelRenderer(this, 0, 19);
Slide5.addBox(0F, 0F, 0F, 1, 1, 14);
Slide5.setRotationPoint(-8F, 16F, -7F);
Slide5.setTextureSize(64, 32);
Slide5.mirror = true;
setRotation(Slide5, 0F, 0F, 0F);
Slide6 = new ModelRenderer(this, 0, 19);
Slide6.addBox(0F, 0F, 0F, 1, 1, 14);
Slide6.setRotationPoint(7F, 16F, -7F);
Slide6.setTextureSize(64, 32);
Slide6.mirror = true;
setRotation(Slide6, 0F, 0F, 0F);
Slide7 = new ModelRenderer(this, 0, 19);
Slide7.addBox(0F, 0F, 0F, 1, 1, 14);
Slide7.setRotationPoint(7F, 23F, -7F);
Slide7.setTextureSize(64, 32);
Slide7.mirror = true;
setRotation(Slide7, 0F, 0F, 0F);
Slide8 = new ModelRenderer(this, 0, 19);
Slide8.addBox(0F, 0F, 0F, 1, 1, 14);
Slide8.setRotationPoint(-8F, 23F, -7F);
Slide8.setTextureSize(64, 32);
Slide8.mirror = true;
setRotation(Slide8, 0F, 0F, 0F);
Slide9 = new ModelRenderer(this, 0, 0);
Slide9.addBox(0F, 0F, 0F, 1, 14, 1);
Slide9.setRotationPoint(7F, 9F, 0F);
Slide9.setTextureSize(64, 32);
Slide9.mirror = true;
setRotation(Slide9, 0F, 0F, 0F);
Slide10 = new ModelRenderer(this, 0, 0);
Slide10.addBox(0F, 0F, 0F, 1, 14, 1);
Slide10.setRotationPoint(7F, 9F, -8F);
Slide10.setTextureSize(64, 32);
Slide10.mirror = true;
setRotation(Slide10, 0F, 0F, 0F);
Slide11 = new ModelRenderer(this, 0, 0);
Slide11.addBox(0F, 0F, 0F, 1, 14, 1);
Slide11.setRotationPoint(0F, 9F, -8F);
Slide11.setTextureSize(64, 32);
Slide11.mirror = true;
setRotation(Slide11, 0F, 0F, 0F);
Slide12 = new ModelRenderer(this, 0, 0);
Slide12.addBox(0F, 0F, 0F, 1, 14, 1);
Slide12.setRotationPoint(0F, 9F, 7F);
Slide12.setTextureSize(64, 32);
Slide12.mirror = true;
setRotation(Slide12, 0F, 0F, 0F);
Slide13 = new ModelRenderer(this, 0, 0);
Slide13.addBox(0F, 0F, 0F, 1, 14, 1);
Slide13.setRotationPoint(-8F, 9F, -8F);
Slide13.setTextureSize(64, 32);
Slide13.mirror = true;
setRotation(Slide13, 0F, 0F, 0F);
Slide14 = new ModelRenderer(this, 0, 0);
Slide14.addBox(0F, 0F, 0F, 1, 14, 1);
Slide14.setRotationPoint(-8F, 9F, 0F);
Slide14.setTextureSize(64, 32);
Slide14.mirror = true;
setRotation(Slide14, 0F, 0F, 0F);
Slide15 = new ModelRenderer(this, 0, 0);
Slide15.addBox(0F, 0F, 0F, 1, 14, 1);
Slide15.setRotationPoint(-1F, 9F, -8F);
Slide15.setTextureSize(64, 32);
Slide15.mirror = true;
setRotation(Slide15, 0F, 0F, 0F);
Slide16 = new ModelRenderer(this, 0, 0);
Slide16.addBox(0F, 0F, 0F, 1, 14, 1);
Slide16.setRotationPoint(-1F, 9F, 7F);
Slide16.setTextureSize(64, 32);
Slide16.mirror = true;
setRotation(Slide16, 0F, 0F, 0F);
Slide17 = new ModelRenderer(this, 0, 0);
Slide17.addBox(0F, 0F, 0F, 1, 14, 1);
Slide17.setRotationPoint(7F, 9F, 7F);
Slide17.setTextureSize(64, 32);
Slide17.mirror = true;
setRotation(Slide17, 0F, 0F, 0F);
Slide18 = new ModelRenderer(this, 0, 0);
Slide18.addBox(0F, 0F, 0F, 1, 14, 1);
Slide18.setRotationPoint(-8F, 9F, 7F);
Slide18.setTextureSize(64, 32);
Slide18.mirror = true;
setRotation(Slide18, 0F, 0F, 0F);
Slide19 = new ModelRenderer(this, 0, 0);
Slide19.addBox(0F, 0F, 0F, 1, 14, 1);
Slide19.setRotationPoint(7F, 9F, -1F);
Slide19.setTextureSize(64, 32);
Slide19.mirror = true;
setRotation(Slide19, 0F, 0F, 0F);
Slide20 = new ModelRenderer(this, 0, 0);
Slide20.addBox(0F, 0F, 0F, 1, 14, 1);
Slide20.setRotationPoint(-8F, 9F, -1F);
Slide20.setTextureSize(64, 32);
Slide20.mirror = true;
setRotation(Slide20, 0F, 0F, 0F);
Slide21 = new ModelRenderer(this, 0, 19);
Slide21.addBox(0F, 0F, 0F, 1, 1, 14);
Slide21.setRotationPoint(-8F, 15F, -7F);
Slide21.setTextureSize(64, 32);
Slide21.mirror = true;
setRotation(Slide21, 0F, 0F, 0F);
Slide22 = new ModelRenderer(this, 0, 19);
Slide22.addBox(0F, 0F, 0F, 1, 1, 14);
Slide22.setRotationPoint(7F, 8F, -7F);
Slide22.setTextureSize(64, 32);
Slide22.mirror = true;
setRotation(Slide22, 0F, 0F, 0F);
Slide23 = new ModelRenderer(this, 0, 19);
Slide23.addBox(0F, 0F, 0F, 1, 1, 14);
Slide23.setRotationPoint(-8F, 8F, -7F);
Slide23.setTextureSize(64, 32);
Slide23.mirror = true;
setRotation(Slide23, 0F, 0F, 0F);
Slide24 = new ModelRenderer(this, 0, 19);
Slide24.addBox(0F, 0F, 0F, 1, 1, 14);
Slide24.setRotationPoint(7F, 15F, -7F);
Slide24.setTextureSize(64, 32);
Slide24.mirror = true;
setRotation(Slide24, 0F, 0F, 0F);
Slide25 = new ModelRenderer(this, 35, 0);
Slide25.addBox(0F, 0F, 0F, 16, 1, 1);
Slide25.setRotationPoint(-8F, 8F, 7F);
Slide25.setTextureSize(64, 32);
Slide25.mirror = true;
setRotation(Slide25, 0F, 0F, 0F);
Slide26 = new ModelRenderer(this, 35, 0);
Slide26.addBox(0F, 0F, 0F, 16, 1, 1);
Slide26.setRotationPoint(-8F, 8F, -8F);
Slide26.setTextureSize(64, 32);
Slide26.mirror = true;
setRotation(Slide26, 0F, 0F, 0F);
Slide27 = new ModelRenderer(this, 39, 0);
Slide27.addBox(0F, 0F, 0F, 14, 1, 1);
Slide27.setRotationPoint(-7F, 16F, 7F);
Slide27.setTextureSize(64, 32);
Slide27.mirror = true;
setRotation(Slide27, 0F, 0F, 0F);
Slide28 = new ModelRenderer(this, 39, 0);
Slide28.addBox(0F, 0F, 0F, 14, 1, 1);
Slide28.setRotationPoint(-7F, 16F, -8F);
Slide28.setTextureSize(64, 32);
Slide28.mirror = true;
setRotation(Slide28, 0F, 0F, 0F);
FrontInnerPanel = new ModelRenderer(this, 0, 46);
FrontInnerPanel.addBox(0F, 0F, 0F, 14, 15, 3);
FrontInnerPanel.setRotationPoint(-7F, 9F, -7F);
FrontInnerPanel.setTextureSize(64, 32);
FrontInnerPanel.mirror = true;
setRotation(FrontInnerPanel, 0F, 0F, 0F);
RightInnerPanel = new ModelRenderer(this, 0, 65);
RightInnerPanel.addBox(0F, 0F, 0F, 3, 15, 8);
RightInnerPanel.setRotationPoint(-7F, 9F, -4F);
RightInnerPanel.setTextureSize(64, 32);
RightInnerPanel.mirror = true;
setRotation(RightInnerPanel, 0F, 0F, 0F);
LeftInnerPanel = new ModelRenderer(this, 0, 65);
LeftInnerPanel.addBox(0F, 0F, 0F, 3, 15, 8);
LeftInnerPanel.setRotationPoint(4F, 9F, -4F);
LeftInnerPanel.setTextureSize(64, 32);
LeftInnerPanel.mirror = true;
setRotation(LeftInnerPanel, 0F, 0F, 0F);
Podium = new ModelRenderer(this, 23, 65);
Podium.addBox(0F, 0F, 0F, 1, 9, 1);
Podium.setRotationPoint(-0.5F, 12F, -0.5F);
Podium.setTextureSize(64, 32);
Podium.mirror = true;
setRotation(Podium, 0F, 0F, 0F);
BottomBase = new ModelRenderer(this, 0, 36);
BottomBase.addBox(0F, 0F, 0F, 8, 1, 8);
BottomBase.setRotationPoint(-4F, 23F, -4F);
BottomBase.setTextureSize(64, 32);
BottomBase.mirror = true;
setRotation(BottomBase, 0F, 0F, 0F);
PodiumBase = new ModelRenderer(this, 0, 89);
PodiumBase.addBox(0F, 0F, 0F, 4, 2, 4);
PodiumBase.setRotationPoint(-2F, 21F, -2F);
PodiumBase.setTextureSize(64, 32);
PodiumBase.mirror = true;
setRotation(PodiumBase, 0F, 0F, 0F);
TapNode1 = new ModelRenderer(this, 23, 76);
TapNode1.addBox(0F, 0F, 0F, 1, 2, 1);
TapNode1.setRotationPoint(-0.5F, 15F, 3F);
TapNode1.setTextureSize(64, 32);
TapNode1.mirror = true;
setRotation(TapNode1, 0F, 0F, 0F);
TapNode2 = new ModelRenderer(this, 23, 76);
TapNode2.addBox(0F, 0F, 0F, 1, 2, 1);
TapNode2.setRotationPoint(3F, 15F, -0.5F);
TapNode2.setTextureSize(64, 32);
TapNode2.mirror = true;
setRotation(TapNode2, 0F, 0F, 0F);
TapNode3 = new ModelRenderer(this, 23, 76);
TapNode3.addBox(0F, 0F, 0F, 1, 2, 1);
TapNode3.setRotationPoint(-0.5F, 15F, -4F);
TapNode3.setTextureSize(64, 32);
TapNode3.mirror = true;
setRotation(TapNode3, 0F, 0F, 0F);
TapNode4 = new ModelRenderer(this, 23, 76);
TapNode4.addBox(0F, 0F, 0F, 1, 2, 1);
TapNode4.setRotationPoint(-4F, 15F, -0.5F);
TapNode4.setTextureSize(64, 32);
TapNode4.mirror = true;
setRotation(TapNode4, 0F, 0F, 0F);
ElectricalConduit = new ModelRenderer(this, 17, 89);
ElectricalConduit.addBox(0F, 0F, 0F, 3, 3, 3);
ElectricalConduit.setRotationPoint(-1.5F, 11F, -1.5F);
ElectricalConduit.setTextureSize(64, 32);
ElectricalConduit.mirror = true;
setRotation(ElectricalConduit, 0F, 0F, 0F);
}
public void render(float f5)
{
BackInnerPanel.render(f5);
Slide1.render(f5);
Slide2.render(f5);
Slide3.render(f5);
Slide4.render(f5);
Slide5.render(f5);
Slide6.render(f5);
Slide7.render(f5);
Slide8.render(f5);
Slide9.render(f5);
Slide10.render(f5);
Slide11.render(f5);
Slide12.render(f5);
Slide13.render(f5);
Slide14.render(f5);
Slide15.render(f5);
Slide16.render(f5);
Slide17.render(f5);
Slide18.render(f5);
Slide19.render(f5);
Slide20.render(f5);
Slide21.render(f5);
Slide22.render(f5);
Slide23.render(f5);
Slide24.render(f5);
Slide25.render(f5);
Slide26.render(f5);
Slide27.render(f5);
Slide28.render(f5);
FrontInnerPanel.render(f5);
RightInnerPanel.render(f5);
LeftInnerPanel.render(f5);
Podium.render(f5);
BottomBase.render(f5);
PodiumBase.render(f5);
TapNode1.render(f5);
TapNode2.render(f5);
TapNode3.render(f5);
TapNode4.render(f5);
ElectricalConduit.render(f5);
}
private void setRotation(ModelRenderer model, float x, float y, float z)
{
model.rotateAngleX = x;
model.rotateAngleY = y;
model.rotateAngleZ = z;
}
}

View file

@ -0,0 +1,38 @@
/**
*
*/
package resonantinduction.render;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ResourceLocation;
import org.lwjgl.opengl.GL11;
import resonantinduction.ResonantInduction;
import resonantinduction.model.ModelBattery;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
/**
* @author Calclavia
*
*/
@SideOnly(Side.CLIENT)
public class RenderBattery extends TileEntitySpecialRenderer
{
public static final ResourceLocation TEXTURE = new ResourceLocation(ResonantInduction.DOMAIN, ResonantInduction.MODEL_TEXTURE_DIRECTORY + "battery.png");
public static final ModelBattery MODEL = new ModelBattery();
@Override
public void renderTileEntityAt(TileEntity t, double x, double y, double z, float f)
{
GL11.glPushMatrix();
GL11.glTranslated(x + 0.5, y + 1.5, z + 0.5);
GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F);
this.func_110628_a(TEXTURE);
MODEL.render(0.0625f);
GL11.glPopMatrix();
}
}