Made transformer Multipart, aesthetics only

This commit is contained in:
Calclavia 2013-12-23 21:29:38 +08:00
parent 2eba46403e
commit 34a0cdfc6b
13 changed files with 279 additions and 621 deletions

View file

@ -6,12 +6,12 @@ itemGroup.resonantinduction=Resonant Induction
tile.resonantinduction\:tesla.name=Tesla Coil tile.resonantinduction\:tesla.name=Tesla Coil
tile.resonantinduction\:contractor.name=Electromagnetic Levitator tile.resonantinduction\:contractor.name=Electromagnetic Levitator
tile.resonantinduction\:battery.name=Battery tile.resonantinduction\:battery.name=Battery
tile.resonantinduction\:transformer.name=Transformer
## Items ## Items
item.resonantinduction\:quantumEntangler.name=Quantum Entangler item.resonantinduction\:quantumEntangler.name=Quantum Entangler
item.resonantinduction\:linker.name=Electrostatic Linker item.resonantinduction\:linker.name=Electrostatic Linker
item.resonantinduction\:transformer.name=Transformer
item.resonantinduction\:multimeter.name=Multimeter item.resonantinduction\:multimeter.name=Multimeter
item.resonantinduction\:ioPanel.name=IO Panel item.resonantinduction\:ioPanel.name=IO Panel

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.7 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

View file

@ -11,7 +11,7 @@ import resonantinduction.gui.GuiMultimeter;
import resonantinduction.levitator.RenderLevitator; import resonantinduction.levitator.RenderLevitator;
import resonantinduction.levitator.TileEntityEMContractor; import resonantinduction.levitator.TileEntityEMContractor;
import resonantinduction.multimeter.PartMultimeter; import resonantinduction.multimeter.PartMultimeter;
import resonantinduction.multimeter.RenderItemMultimeter; import resonantinduction.multimeter.RenderRIItem;
import resonantinduction.render.BlockRenderingHandler; import resonantinduction.render.BlockRenderingHandler;
import resonantinduction.render.RenderTesla; import resonantinduction.render.RenderTesla;
import resonantinduction.tesla.TileEntityTesla; import resonantinduction.tesla.TileEntityTesla;
@ -37,7 +37,8 @@ public class ClientProxy extends CommonProxy
MinecraftForge.EVENT_BUS.register(SoundHandler.INSTANCE); MinecraftForge.EVENT_BUS.register(SoundHandler.INSTANCE);
RenderingRegistry.registerBlockHandler(BlockRenderingHandler.INSTANCE); RenderingRegistry.registerBlockHandler(BlockRenderingHandler.INSTANCE);
MinecraftForgeClient.registerItemRenderer(ResonantInduction.itemMultimeter.itemID, new RenderItemMultimeter()); MinecraftForgeClient.registerItemRenderer(ResonantInduction.itemMultimeter.itemID, RenderRIItem.INSTANCE);
MinecraftForgeClient.registerItemRenderer(ResonantInduction.itemTransformer.itemID, RenderRIItem.INSTANCE);
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityTesla.class, new RenderTesla()); ClientRegistry.bindTileEntitySpecialRenderer(TileEntityTesla.class, new RenderTesla());
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityEMContractor.class, new RenderLevitator()); ClientRegistry.bindTileEntitySpecialRenderer(TileEntityEMContractor.class, new RenderLevitator());
} }

View file

@ -1,6 +1,7 @@
package resonantinduction; package resonantinduction;
import resonantinduction.multimeter.PartMultimeter; import resonantinduction.multimeter.PartMultimeter;
import resonantinduction.transformer.PartTransformer;
import resonantinduction.wire.part.PartFlatWire; import resonantinduction.wire.part.PartFlatWire;
import codechicken.multipart.MultiPartRegistry; import codechicken.multipart.MultiPartRegistry;
import codechicken.multipart.MultiPartRegistry.IPartFactory; import codechicken.multipart.MultiPartRegistry.IPartFactory;
@ -31,7 +32,7 @@ public class MultipartRI implements IPartFactory
} }
else if (name.equals("resonant_induction_transformer")) else if (name.equals("resonant_induction_transformer"))
{ {
return new PartMultimeter(); return new PartTransformer();
} }
return null; return null;

View file

@ -31,6 +31,7 @@ import resonantinduction.levitator.TileEntityEMContractor;
import resonantinduction.multimeter.ItemMultimeter; import resonantinduction.multimeter.ItemMultimeter;
import resonantinduction.tesla.BlockTesla; import resonantinduction.tesla.BlockTesla;
import resonantinduction.tesla.TileEntityTesla; import resonantinduction.tesla.TileEntityTesla;
import resonantinduction.transformer.ItemTransformer;
import resonantinduction.wire.EnumWireMaterial; import resonantinduction.wire.EnumWireMaterial;
import resonantinduction.wire.ItemWire; import resonantinduction.wire.ItemWire;
import basiccomponents.api.BasicRegistry; import basiccomponents.api.BasicRegistry;
@ -179,6 +180,7 @@ public class ResonantInduction
itemLinker = new ItemLinker(getNextItemID()); itemLinker = new ItemLinker(getNextItemID());
itemPartWire = new ItemWire(getNextItemID()); itemPartWire = new ItemWire(getNextItemID());
itemMultimeter = new ItemMultimeter(getNextItemID()); itemMultimeter = new ItemMultimeter(getNextItemID());
itemTransformer = new ItemTransformer(getNextItemID());
// Blocks // Blocks
blockTesla = new BlockTesla(getNextBlockID()); blockTesla = new BlockTesla(getNextBlockID());
@ -196,6 +198,7 @@ public class ResonantInduction
GameRegistry.registerItem(itemLinker, itemLinker.getUnlocalizedName()); GameRegistry.registerItem(itemLinker, itemLinker.getUnlocalizedName());
GameRegistry.registerItem(itemMultimeter, itemMultimeter.getUnlocalizedName()); GameRegistry.registerItem(itemMultimeter, itemMultimeter.getUnlocalizedName());
GameRegistry.registerItem(itemTransformer, itemTransformer.getUnlocalizedName());
GameRegistry.registerBlock(blockTesla, blockTesla.getUnlocalizedName()); GameRegistry.registerBlock(blockTesla, blockTesla.getUnlocalizedName());
GameRegistry.registerBlock(blockEMContractor, ItemBlockContractor.class, blockEMContractor.getUnlocalizedName()); GameRegistry.registerBlock(blockEMContractor, ItemBlockContractor.class, blockEMContractor.getUnlocalizedName());

View file

@ -0,0 +1,22 @@
package resonantinduction.base;
import net.minecraftforge.common.Configuration;
import resonantinduction.ResonantInduction;
import resonantinduction.TabRI;
import codechicken.multipart.JItemMultiPart;
/**
* @author Calclavia
*
*/
public abstract class ItemMultipartBase extends JItemMultiPart
{
public ItemMultipartBase(String name, int id)
{
super(ResonantInduction.CONFIGURATION.get(Configuration.CATEGORY_ITEM, name, id).getInt(id));
this.setCreativeTab(TabRI.INSTANCE);
this.setUnlocalizedName(ResonantInduction.PREFIX + name);
this.setTextureName(ResonantInduction.PREFIX + name);
}
}

View file

@ -7,28 +7,21 @@ import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.Icon; import net.minecraft.util.Icon;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.common.Configuration;
import net.minecraftforge.common.ForgeDirection; import net.minecraftforge.common.ForgeDirection;
import resonantinduction.ResonantInduction; import resonantinduction.base.ItemMultipartBase;
import resonantinduction.TabRI;
import resonantinduction.wire.EnumWireMaterial; import resonantinduction.wire.EnumWireMaterial;
import codechicken.lib.vec.BlockCoord; import codechicken.lib.vec.BlockCoord;
import codechicken.lib.vec.Vector3; import codechicken.lib.vec.Vector3;
import codechicken.multipart.JItemMultiPart;
import codechicken.multipart.MultiPartRegistry; import codechicken.multipart.MultiPartRegistry;
import codechicken.multipart.TMultiPart; import codechicken.multipart.TMultiPart;
public class ItemMultimeter extends JItemMultiPart public class ItemMultimeter extends ItemMultipartBase
{ {
private Icon[] icons = new Icon[EnumWireMaterial.values().length]; private Icon[] icons = new Icon[EnumWireMaterial.values().length];
public ItemMultimeter(int id) public ItemMultimeter(int id)
{ {
super(ResonantInduction.CONFIGURATION.get(Configuration.CATEGORY_ITEM, "multimeter", id).getInt(id)); super("multimeter", id);
this.setUnlocalizedName(ResonantInduction.PREFIX + "multimeter");
this.setCreativeTab(TabRI.INSTANCE);
this.setHasSubtypes(true);
this.setMaxDamage(0);
} }
@Override @Override

View file

@ -1,42 +0,0 @@
package resonantinduction.multimeter;
import net.minecraft.item.ItemStack;
import net.minecraftforge.client.IItemRenderer;
import org.lwjgl.opengl.GL11;
import cpw.mods.fml.client.FMLClientHandler;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
/**
* @author Calclavia
*
*/
@SideOnly(Side.CLIENT)
public class RenderItemMultimeter implements IItemRenderer
{
@Override
public boolean handleRenderType(ItemStack item, ItemRenderType type)
{
return item.getItem() instanceof ItemMultimeter;
}
@Override
public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item, ItemRendererHelper helper)
{
return item.getItem() instanceof ItemMultimeter;
}
@Override
public void renderItem(ItemRenderType type, ItemStack item, Object... data)
{
GL11.glPushMatrix();
GL11.glRotatef(180, 0, 1, 0);
GL11.glTranslated(0, -1, -0.7);
FMLClientHandler.instance().getClient().renderEngine.bindTexture(RenderMultimeter.TEXTURE);
RenderMultimeter.MODEL.render(0.0625f);
GL11.glPopMatrix();
}
}

View file

@ -0,0 +1,59 @@
package resonantinduction.multimeter;
import net.minecraft.item.ItemStack;
import net.minecraftforge.client.IItemRenderer;
import org.lwjgl.opengl.GL11;
import resonantinduction.transformer.ItemTransformer;
import resonantinduction.transformer.RenderTransformer;
import cpw.mods.fml.client.FMLClientHandler;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
/**
* @author Calclavia
*
*/
@SideOnly(Side.CLIENT)
public class RenderRIItem implements IItemRenderer
{
public static final RenderRIItem INSTANCE = new RenderRIItem();
@Override
public boolean handleRenderType(ItemStack item, ItemRenderType type)
{
return true;
}
@Override
public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item, ItemRendererHelper helper)
{
return true;
}
@Override
public void renderItem(ItemRenderType type, ItemStack item, Object... data)
{
if (item.getItem() instanceof ItemMultimeter)
{
GL11.glPushMatrix();
GL11.glRotatef(180, 0, 1, 0);
GL11.glTranslated(0, -1, -0.7);
FMLClientHandler.instance().getClient().renderEngine.bindTexture(RenderMultimeter.TEXTURE);
RenderMultimeter.MODEL.render(0.0625f);
GL11.glPopMatrix();
}
else if (item.getItem() instanceof ItemTransformer)
{
GL11.glPushMatrix();
GL11.glRotatef(180, 0, 0, 1);
GL11.glTranslated(0, -1, 0);
GL11.glScaled(0.9f, 0.9f, 0.9f);
FMLClientHandler.instance().getClient().renderEngine.bindTexture(RenderTransformer.TEXTURE);
RenderTransformer.MODEL.render(0.0625f);
GL11.glPopMatrix();
}
}
}

View file

@ -1,34 +1,23 @@
package resonantinduction.transformer; package resonantinduction.transformer;
import java.util.List;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.Icon; import net.minecraft.util.Icon;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.common.Configuration; import resonantinduction.base.ItemMultipartBase;
import net.minecraftforge.common.ForgeDirection;
import resonantinduction.ResonantInduction;
import resonantinduction.TabRI;
import resonantinduction.wire.EnumWireMaterial; import resonantinduction.wire.EnumWireMaterial;
import codechicken.lib.vec.BlockCoord; import codechicken.lib.vec.BlockCoord;
import codechicken.lib.vec.Vector3; import codechicken.lib.vec.Vector3;
import codechicken.multipart.JItemMultiPart;
import codechicken.multipart.MultiPartRegistry; import codechicken.multipart.MultiPartRegistry;
import codechicken.multipart.TMultiPart; import codechicken.multipart.TMultiPart;
public class ItemTransformer extends JItemMultiPart public class ItemTransformer extends ItemMultipartBase
{ {
private Icon[] icons = new Icon[EnumWireMaterial.values().length]; private Icon[] icons = new Icon[EnumWireMaterial.values().length];
public ItemTransformer(int id) public ItemTransformer(int id)
{ {
super(ResonantInduction.CONFIGURATION.get(Configuration.CATEGORY_ITEM, "multimeter", id).getInt(id)); super("transformer", id);
this.setUnlocalizedName(ResonantInduction.PREFIX + "multimeter");
this.setCreativeTab(TabRI.INSTANCE);
this.setHasSubtypes(true);
this.setMaxDamage(0);
} }
@Override @Override

View file

@ -3,559 +3,147 @@ package resonantinduction.transformer;
import net.minecraft.client.model.ModelBase; import net.minecraft.client.model.ModelBase;
import net.minecraft.client.model.ModelRenderer; import net.minecraft.client.model.ModelRenderer;
import net.minecraft.entity.Entity; import net.minecraft.entity.Entity;
import net.minecraftforge.common.ForgeDirection;
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly; import cpw.mods.fml.relauncher.SideOnly;
import static net.minecraftforge.common.ForgeDirection.*;
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public class ModelTransformer extends ModelBase public class ModelTransformer extends ModelBase
{ {
ModelRenderer Down_North; // fields
ModelRenderer Down_West; ModelRenderer a;
ModelRenderer Down_South; ModelRenderer b;
ModelRenderer Down_East; ModelRenderer c;
ModelRenderer Up_East; ModelRenderer d;
ModelRenderer Up_West; ModelRenderer out2;
ModelRenderer Up_South; ModelRenderer out1;
ModelRenderer Up_North; ModelRenderer out3;
ModelRenderer South_Up; ModelRenderer out4;
ModelRenderer South_Down; ModelRenderer i;
ModelRenderer South_West; ModelRenderer j;
ModelRenderer South_East; ModelRenderer in1;
ModelRenderer North_Up; ModelRenderer in2;
ModelRenderer North_East; ModelRenderer in3;
ModelRenderer North_West; ModelRenderer in4;
ModelRenderer North_Down;
ModelRenderer East_South; public ModelTransformer()
ModelRenderer East_North; {
ModelRenderer East_Up; textureWidth = 70;
ModelRenderer East_Down; textureHeight = 45;
ModelRenderer West_Down;
ModelRenderer West_Up; a = new ModelRenderer(this, 0, 0);
ModelRenderer West_South; a.addBox(-8F, 0F, -8F, 16, 2, 16);
ModelRenderer West_North; a.setRotationPoint(0F, 22F, 0F);
ModelRenderer io_Up; a.setTextureSize(70, 45);
ModelRenderer io_East; a.mirror = true;
ModelRenderer io_West; setRotation(a, 0F, 0F, 0F);
ModelRenderer io_South; b = new ModelRenderer(this, 0, 19);
ModelRenderer io_North; b.addBox(0F, 0F, -2F, 3, 11, 4);
ModelRenderer io_Down; b.setRotationPoint(5F, 11F, 0F);
b.setTextureSize(70, 45);
public ModelTransformer() b.mirror = true;
{ setRotation(b, 0F, 0F, 0F);
super(); c = new ModelRenderer(this, 0, 19);
textureWidth = 128; c.addBox(0F, 0F, -2F, 3, 11, 4);
textureHeight = 64; c.setRotationPoint(-8F, 11F, 0F);
c.setTextureSize(70, 45);
Down_North = new ModelRenderer(this, 108, 8); c.mirror = true;
Down_North.addBox(0F, 0F, 0F, 8, 2, 2); setRotation(c, 0F, 0F, 0F);
Down_North.setRotationPoint(-7F, 21F, -1F); d = new ModelRenderer(this, 15, 19);
Down_North.setTextureSize(this.textureWidth, this.textureHeight); d.addBox(0F, 0F, -2F, 16, 1, 4);
Down_North.mirror = true; d.setRotationPoint(-8F, 10F, 0F);
setRotation(Down_North, 0F, 0F, 0F); d.setTextureSize(70, 45);
Down_West = new ModelRenderer(this, 108, 22); d.mirror = true;
Down_West.addBox(0F, 0F, 0F, 2, 2, 8); setRotation(d, 0F, 0F, 0F);
Down_West.setRotationPoint(-1F, 21F, -7F); out2 = new ModelRenderer(this, 0, 35);
Down_West.setTextureSize(this.textureWidth, this.textureHeight); out2.addBox(0F, 0F, -3F, 5, 0, 6);
Down_West.mirror = true; out2.setRotationPoint(-9F, 16F, 0F);
setRotation(Down_West, 0F, 0F, 0F); out2.setTextureSize(70, 45);
Down_South = new ModelRenderer(this, 108, 4); out2.mirror = true;
Down_South.addBox(0F, 0F, 0F, 8, 2, 2); setRotation(out2, 0F, 0F, 0F);
Down_South.setRotationPoint(-1F, 21F, -1F); out1 = new ModelRenderer(this, 0, 35);
Down_South.setTextureSize(this.textureWidth, this.textureHeight); out1.addBox(0F, 0F, -3F, 5, 0, 6);
Down_South.mirror = true; out1.setRotationPoint(-9F, 15F, 0F);
setRotation(Down_South, 0F, 0F, 0F); out1.setTextureSize(70, 45);
Down_East = new ModelRenderer(this, 108, 12); out1.mirror = true;
Down_East.addBox(0F, 0F, 0F, 2, 2, 8); setRotation(out1, 0F, 0F, 0F);
Down_East.setRotationPoint(-1F, 21F, -1F); out3 = new ModelRenderer(this, 0, 35);
Down_East.setTextureSize(this.textureWidth, this.textureHeight); out3.addBox(0F, 0F, -3F, 5, 0, 6);
Down_East.mirror = true; out3.setRotationPoint(-9F, 17F, 0F);
setRotation(Down_East, 0F, 0F, 0F); out3.setTextureSize(70, 45);
Up_East = new ModelRenderer(this, 88, 22); out3.mirror = true;
Up_East.addBox(0F, 0F, 0F, 2, 2, 8); setRotation(out3, 0F, 0F, 0F);
Up_East.setRotationPoint(-1F, 9F, -1F); out4 = new ModelRenderer(this, 0, 35);
Up_East.setTextureSize(this.textureWidth, this.textureHeight); out4.addBox(0F, 0F, -3F, 5, 0, 6);
Up_East.mirror = true; out4.setRotationPoint(-9F, 18F, 0F);
setRotation(Up_East, 0F, 0F, 0F); out4.setTextureSize(70, 45);
Up_West = new ModelRenderer(this, 88, 12); out4.mirror = true;
Up_West.addBox(0F, 0F, 0F, 2, 2, 8); setRotation(out4, 0F, 0F, 0F);
Up_West.setRotationPoint(-1F, 9F, -7F); i = new ModelRenderer(this, 34, 35);
Up_West.setTextureSize(this.textureWidth, this.textureHeight); i.addBox(0F, 0F, -1F, 2, 5, 2);
Up_West.mirror = true; i.setRotationPoint(-10F, 14F, 0F);
setRotation(Up_West, 0F, 0F, 0F); i.setTextureSize(70, 45);
Up_South = new ModelRenderer(this, 108, 0); i.mirror = true;
Up_South.addBox(0F, 0F, 0F, 8, 2, 2); setRotation(i, 0F, 0F, 0F);
Up_South.setRotationPoint(-1F, 9F, -1F); j = new ModelRenderer(this, 24, 35);
Up_South.setTextureSize(this.textureWidth, this.textureHeight); j.addBox(0F, 0F, -1F, 2, 5, 2);
Up_South.mirror = true; j.setRotationPoint(8F, 14F, 0F);
setRotation(Up_South, 0F, 0F, 0F); j.setTextureSize(70, 45);
Up_North = new ModelRenderer(this, 88, 0); j.mirror = true;
Up_North.addBox(0F, 0F, 0F, 8, 2, 2); setRotation(j, 0F, 0F, 0F);
Up_North.setRotationPoint(-7F, 9F, -1F); in1 = new ModelRenderer(this, 0, 35);
Up_North.setTextureSize(this.textureWidth, this.textureHeight); in1.addBox(0F, 0F, -3F, 5, 0, 6);
Up_North.mirror = true; in1.setRotationPoint(4F, 15F, 0F);
setRotation(Up_North, 0F, 0F, 0F); in1.setTextureSize(70, 45);
South_Up = new ModelRenderer(this, 0, 22); in1.mirror = true;
South_Up.addBox(0F, 0F, 0F, 2, 8, 2); setRotation(in1, 0F, 0F, 0F);
South_Up.setRotationPoint(5F, 9F, -1F); in2 = new ModelRenderer(this, 0, 35);
South_Up.setTextureSize(this.textureWidth, this.textureHeight); in2.addBox(0F, 0F, -3F, 5, 0, 6);
South_Up.mirror = true; in2.setRotationPoint(4F, 16F, 0F);
setRotation(South_Up, 0F, 0F, 0F); in2.setTextureSize(70, 45);
South_Down = new ModelRenderer(this, 8, 22); in2.mirror = true;
South_Down.addBox(0F, 0F, 0F, 2, 8, 2); setRotation(in2, 0F, 0F, 0F);
South_Down.setRotationPoint(5F, 15F, -1F); in3 = new ModelRenderer(this, 0, 35);
South_Down.setTextureSize(this.textureWidth, this.textureHeight); in3.addBox(0F, 0F, -3F, 5, 0, 6);
South_Down.mirror = true; in3.setRotationPoint(4F, 17F, 0F);
setRotation(South_Down, 0F, 0F, 0F); in3.setTextureSize(70, 45);
South_West = new ModelRenderer(this, 68, 22); in3.mirror = true;
South_West.addBox(0F, 0F, 0F, 2, 2, 8); setRotation(in3, 0F, 0F, 0F);
South_West.setRotationPoint(5F, 15F, -7F); in4 = new ModelRenderer(this, 0, 35);
South_West.setTextureSize(this.textureWidth, this.textureHeight); in4.addBox(0F, 0F, -3F, 5, 0, 6);
South_West.mirror = true; in4.setRotationPoint(4F, 18F, 0F);
setRotation(South_West, 0F, 0F, 0F); in4.setTextureSize(70, 45);
South_East = new ModelRenderer(this, 68, 12); in4.mirror = true;
South_East.addBox(0F, 0F, 0F, 2, 2, 8); setRotation(in4, 0F, 0F, 0F);
South_East.setRotationPoint(5F, 15F, -1F); }
South_East.setTextureSize(this.textureWidth, this.textureHeight);
South_East.mirror = true; public void render(float f5)
setRotation(South_East, 0F, 0F, 0F); {
North_Up = new ModelRenderer(this, 16, 22); a.render(f5);
North_Up.addBox(0F, 0F, 0F, 2, 8, 2); b.render(f5);
North_Up.setRotationPoint(-7F, 9F, -1F); c.render(f5);
North_Up.setTextureSize(this.textureWidth, this.textureHeight); d.render(f5);
North_Up.mirror = true; out2.render(f5);
setRotation(North_Up, 0F, 0F, 0F); out1.render(f5);
North_East = new ModelRenderer(this, 48, 22); out3.render(f5);
North_East.addBox(0F, 0F, 0F, 2, 2, 8); out4.render(f5);
North_East.setRotationPoint(-7F, 15F, -1F); i.render(f5);
North_East.setTextureSize(this.textureWidth, this.textureHeight); j.render(f5);
North_East.mirror = true; in1.render(f5);
setRotation(North_East, 0F, 0F, 0F); in2.render(f5);
North_West = new ModelRenderer(this, 48, 12); in3.render(f5);
North_West.addBox(0F, 0F, 0F, 2, 2, 8); in4.render(f5);
North_West.setRotationPoint(-7F, 15F, -7F); }
North_West.setTextureSize(this.textureWidth, this.textureHeight);
North_West.mirror = true; private void setRotation(ModelRenderer model, float x, float y, float z)
setRotation(North_West, 0F, 0F, 0F); {
North_Down = new ModelRenderer(this, 0, 12); model.rotateAngleX = x;
North_Down.addBox(0F, 0F, 0F, 2, 8, 2); model.rotateAngleY = y;
North_Down.setRotationPoint(-7F, 15F, -1F); model.rotateAngleZ = z;
North_Down.setTextureSize(this.textureWidth, this.textureHeight); }
North_Down.mirror = true;
setRotation(North_Down, 0F, 0F, 0F); public void setRotationAngles(float f, float f1, float f2, float f3, float f4, float f5, Entity entity)
East_South = new ModelRenderer(this, 88, 4); {
East_South.addBox(0F, 0F, 0F, 8, 2, 2); super.setRotationAngles(f, f1, f2, f3, f4, f5, entity);
East_South.setRotationPoint(-1F, 15F, 5F); }
East_South.setTextureSize(this.textureWidth, this.textureHeight);
East_South.mirror = true;
setRotation(East_South, 0F, 0F, 0F);
East_North = new ModelRenderer(this, 88, 8);
East_North.addBox(0F, 0F, 0F, 8, 2, 2);
East_North.setRotationPoint(-7F, 15F, 5F);
East_North.setTextureSize(this.textureWidth, this.textureHeight);
East_North.mirror = true;
setRotation(East_North, 0F, 0F, 0F);
East_Up = new ModelRenderer(this, 8, 12);
East_Up.addBox(0F, 0F, 0F, 2, 8, 2);
East_Up.setRotationPoint(-1F, 9F, 5F);
East_Up.setTextureSize(this.textureWidth, this.textureHeight);
East_Up.mirror = true;
setRotation(East_Up, 0F, 0F, 0F);
East_Down = new ModelRenderer(this, 16, 12);
East_Down.addBox(0F, 0F, 0F, 2, 8, 2);
East_Down.setRotationPoint(-1F, 15F, 5F);
East_Down.setTextureSize(this.textureWidth, this.textureHeight);
East_Down.mirror = true;
setRotation(East_Down, 0F, 0F, 0F);
West_Down = new ModelRenderer(this, 24, 22);
West_Down.addBox(0F, 0F, 0F, 2, 8, 2);
West_Down.setRotationPoint(-1F, 15F, -7F);
West_Down.setTextureSize(this.textureWidth, this.textureHeight);
West_Down.mirror = true;
setRotation(West_Down, 0F, 0F, 0F);
West_Up = new ModelRenderer(this, 24, 12);
West_Up.addBox(0F, 0F, 0F, 2, 8, 2);
West_Up.setRotationPoint(-1F, 9F, -7F);
West_Up.setTextureSize(this.textureWidth, this.textureHeight);
West_Up.mirror = true;
setRotation(West_Up, 0F, 0F, 0F);
West_South = new ModelRenderer(this, 68, 0);
West_South.addBox(0F, 0F, 0F, 8, 2, 2);
West_South.setRotationPoint(-1F, 15F, -7F);
West_South.setTextureSize(this.textureWidth, this.textureHeight);
West_South.mirror = true;
setRotation(West_South, 0F, 0F, 0F);
West_North = new ModelRenderer(this, 68, 4);
West_North.addBox(0F, 0F, 0F, 8, 2, 2);
West_North.setRotationPoint(-7F, 15F, -7F);
West_North.setTextureSize(this.textureWidth, this.textureHeight);
West_North.mirror = true;
setRotation(West_North, 0F, 0F, 0F);
io_Up = new ModelRenderer(this, 0, 0);
io_Up.addBox(0F, 0F, 0F, 4, 3, 4);
io_Up.setRotationPoint(-2F, 8F, -2F);
io_Up.setTextureSize(this.textureWidth, this.textureHeight);
io_Up.mirror = true;
setRotation(io_Up, 0F, 0F, 0F);
io_East = new ModelRenderer(this, 0, 7);
io_East.addBox(0F, 0F, 0F, 4, 4, 3);
io_East.setRotationPoint(-2F, 14F, 5F);
io_East.setTextureSize(this.textureWidth, this.textureHeight);
io_East.mirror = true;
setRotation(io_East, 0F, 0F, 0F);
io_West = new ModelRenderer(this, 14, 8);
io_West.addBox(0F, 0F, 0F, 4, 4, 3);
io_West.setRotationPoint(-2F, 14F, -8F);
io_West.setTextureSize(this.textureWidth, this.textureHeight);
io_West.mirror = true;
setRotation(io_West, 0F, 0F, 0F);
io_South = new ModelRenderer(this, 16, 0);
io_South.addBox(0F, 0F, 0F, 3, 4, 4);
io_South.setRotationPoint(5F, 14F, -2F);
io_South.setTextureSize(this.textureWidth, this.textureHeight);
io_South.mirror = true;
setRotation(io_South, 0F, 0F, 0F);
io_North = new ModelRenderer(this, 30, 0);
io_North.addBox(0F, 0F, 0F, 3, 4, 4);
io_North.setRotationPoint(-8F, 14F, -2F);
io_North.setTextureSize(this.textureWidth, this.textureHeight);
io_North.mirror = true;
setRotation(io_North, 0F, 0F, 0F);
io_Down = new ModelRenderer(this, 28, 8);
io_Down.addBox(0F, 0F, 0F, 4, 3, 4);
io_Down.setRotationPoint(-2F, 21F, -2F);
io_Down.setTextureSize(this.textureWidth, this.textureHeight);
io_Down.mirror = true;
setRotation(io_Down, 0F, 0F, 0F);
}
@Override
public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5)
{
super.render(entity, f, f1, f2, f3, f4, f5);
this.setRotationAngles(f, f1, f2, f3, f4, f5, entity);
}
public void renderIO(ForgeDirection dir, float f5)
{
switch (dir)
{
case UP:
this.io_Up.render(f5);
break;
case DOWN:
this.io_Down.render(f5);
break;
case NORTH:
this.io_North.render(f5);
break;
case SOUTH:
this.io_South.render(f5);
break;
case EAST:
this.io_East.render(f5);
break;
case WEST:
this.io_West.render(f5);
break;
default:
break;
}
}
public void renderCores(ForgeDirection in, ForgeDirection out, float f5)
{
if (in == UP || out == UP)
{
if (in == DOWN || out == DOWN)
{
this.Down_East.render(f5);
this.Down_North.render(f5);
this.Down_South.render(f5);
this.Down_West.render(f5);
this.East_Down.render(f5);
this.North_Down.render(f5);
this.South_Down.render(f5);
this.West_Down.render(f5);
this.East_Up.render(f5);
this.North_Up.render(f5);
this.South_Up.render(f5);
this.West_Up.render(f5);
this.Up_East.render(f5);
this.Up_North.render(f5);
this.Up_South.render(f5);
this.Up_West.render(f5);
}
else if (in == NORTH || out == NORTH)
{
this.North_East.render(f5);
this.North_West.render(f5);
this.East_North.render(f5);
this.West_North.render(f5);
this.East_Up.render(f5);
this.West_Up.render(f5);
this.Up_East.render(f5);
this.Up_West.render(f5);
}
else if (in == SOUTH || out == SOUTH)
{
this.South_East.render(f5);
this.South_West.render(f5);
this.East_South.render(f5);
this.West_South.render(f5);
this.East_Up.render(f5);
this.West_Up.render(f5);
this.Up_East.render(f5);
this.Up_West.render(f5);
}
else if (in == EAST || out == EAST)
{
this.East_North.render(f5);
this.East_South.render(f5);
this.North_East.render(f5);
this.South_East.render(f5);
this.North_Up.render(f5);
this.South_Up.render(f5);
this.Up_North.render(f5);
this.Up_South.render(f5);
}
else if (in == WEST || out == WEST)
{
this.West_North.render(f5);
this.West_South.render(f5);
this.North_West.render(f5);
this.South_West.render(f5);
this.North_Up.render(f5);
this.South_Up.render(f5);
this.Up_North.render(f5);
this.Up_South.render(f5);
}
}
else if (in == DOWN || out == DOWN)
{
if (in == NORTH || out == NORTH)
{
this.North_East.render(f5);
this.North_West.render(f5);
this.East_North.render(f5);
this.West_North.render(f5);
this.East_Down.render(f5);
this.West_Down.render(f5);
this.Down_East.render(f5);
this.Down_West.render(f5);
}
else if (in == SOUTH || out == SOUTH)
{
this.South_East.render(f5);
this.South_West.render(f5);
this.East_South.render(f5);
this.West_South.render(f5);
this.East_Down.render(f5);
this.West_Down.render(f5);
this.Down_East.render(f5);
this.Down_West.render(f5);
}
else if (in == EAST || out == EAST)
{
this.East_North.render(f5);
this.East_South.render(f5);
this.North_East.render(f5);
this.South_East.render(f5);
this.North_Down.render(f5);
this.South_Down.render(f5);
this.Down_North.render(f5);
this.Down_South.render(f5);
}
else if (in == WEST || out == WEST)
{
this.West_North.render(f5);
this.West_South.render(f5);
this.North_West.render(f5);
this.South_West.render(f5);
this.North_Down.render(f5);
this.South_Down.render(f5);
this.Down_North.render(f5);
this.Down_South.render(f5);
}
}
else if (in == NORTH || out == NORTH)
{
if (in == SOUTH || out == SOUTH)
{
this.North_Down.render(f5);
this.North_East.render(f5);
this.North_Up.render(f5);
this.North_West.render(f5);
this.Down_North.render(f5);
this.East_North.render(f5);
this.Up_North.render(f5);
this.West_North.render(f5);
this.Down_South.render(f5);
this.East_South.render(f5);
this.Up_South.render(f5);
this.West_South.render(f5);
this.South_Down.render(f5);
this.South_East.render(f5);
this.South_Up.render(f5);
this.South_West.render(f5);
}
else if (in == EAST || out == EAST)
{
this.North_Down.render(f5);
this.North_Up.render(f5);
this.Down_North.render(f5);
this.Up_North.render(f5);
this.Down_East.render(f5);
this.Up_East.render(f5);
this.East_Down.render(f5);
this.East_Up.render(f5);
}
else if (in == WEST || out == WEST)
{
this.North_Down.render(f5);
this.North_Up.render(f5);
this.Down_North.render(f5);
this.Up_North.render(f5);
this.Down_West.render(f5);
this.Up_West.render(f5);
this.West_Down.render(f5);
this.West_Up.render(f5);
}
}
else if (in == SOUTH || out == SOUTH)
{
if (in == EAST || out == EAST)
{
this.South_Down.render(f5);
this.South_Up.render(f5);
this.Down_South.render(f5);
this.Up_South.render(f5);
this.Down_East.render(f5);
this.Up_East.render(f5);
this.East_Down.render(f5);
this.East_Up.render(f5);
}
else if (in == WEST || out == WEST)
{
this.South_Down.render(f5);
this.South_Up.render(f5);
this.Down_South.render(f5);
this.Up_South.render(f5);
this.Down_West.render(f5);
this.Up_West.render(f5);
this.West_Down.render(f5);
this.West_Up.render(f5);
}
}
else if (in == EAST || out == EAST)
{
if (in == WEST || out == WEST)
{
this.East_Down.render(f5);
this.East_North.render(f5);
this.East_South.render(f5);
this.East_Up.render(f5);
this.Down_East.render(f5);
this.North_East.render(f5);
this.South_East.render(f5);
this.Up_East.render(f5);
this.Down_West.render(f5);
this.North_West.render(f5);
this.South_West.render(f5);
this.Up_West.render(f5);
this.West_Down.render(f5);
this.West_North.render(f5);
this.West_South.render(f5);
this.West_Up.render(f5);
}
}
}
private void setRotation(ModelRenderer model, float x, float y, float z)
{
model.rotateAngleX = x;
model.rotateAngleY = y;
model.rotateAngleZ = z;
}
@Override
public void setRotationAngles(float f, float f1, float f2, float f3, float f4, float f5, Entity entity)
{
super.setRotationAngles(f, f1, f2, f3, f4, f5, entity);
}
public void renderAll(float f5)
{
this.Down_North.render(f5);
this.Down_West.render(f5);
this.Down_South.render(f5);
this.Down_East.render(f5);
this.Up_East.render(f5);
this.Up_West.render(f5);
this.Up_South.render(f5);
this.Up_North.render(f5);
this.South_Up.render(f5);
this.South_Down.render(f5);
this.South_West.render(f5);
this.South_East.render(f5);
this.North_Up.render(f5);
this.North_East.render(f5);
this.North_West.render(f5);
this.North_Down.render(f5);
this.East_South.render(f5);
this.East_North.render(f5);
this.East_Up.render(f5);
this.East_Down.render(f5);
this.West_Down.render(f5);
this.West_Up.render(f5);
this.West_South.render(f5);
this.West_North.render(f5);
}
} }

View file

@ -1,7 +1,16 @@
package resonantinduction.transformer; package resonantinduction.transformer;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.MovingObjectPosition;
import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.GL11;
import resonantinduction.ResonantInduction;
import codechicken.lib.render.CCRenderState; import codechicken.lib.render.CCRenderState;
import codechicken.lib.render.TextureUtils; import codechicken.lib.render.TextureUtils;
import codechicken.lib.vec.Cuboid6; import codechicken.lib.vec.Cuboid6;
@ -72,7 +81,26 @@ public class PartTransformer extends JCuboidPart implements JNormalOcclusion, TF
@Override @Override
public Iterable<Cuboid6> getOcclusionBoxes() public Iterable<Cuboid6> getOcclusionBoxes()
{ {
return null; return Arrays.asList(oBoxes[this.side]);
}
protected ItemStack getItem()
{
return new ItemStack(ResonantInduction.itemTransformer);
}
@Override
public Iterable<ItemStack> getDrops()
{
List<ItemStack> drops = new ArrayList<ItemStack>();
drops.add(getItem());
return drops;
}
@Override
public ItemStack pickItem(MovingObjectPosition hit)
{
return getItem();
} }
@Override @Override
@ -92,6 +120,22 @@ public class PartTransformer extends JCuboidPart implements JNormalOcclusion, TF
} }
} }
@Override
public void load(NBTTagCompound nbt)
{
super.load(nbt);
this.side = nbt.getByte("side");
this.stepUp = nbt.getBoolean("stepUp");
}
@Override
public void save(NBTTagCompound nbt)
{
super.save(nbt);
nbt.setByte("side", (byte) this.side);
nbt.setBoolean("stepUp", this.stepUp);
}
@Override @Override
public String getType() public String getType()
{ {

View file

@ -20,7 +20,7 @@ import cpw.mods.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public class RenderTransformer public class RenderTransformer
{ {
private static final ModelTransformer MODEL = new ModelTransformer(); public static final ModelTransformer MODEL = new ModelTransformer();
public static final ResourceLocation TEXTURE = new ResourceLocation(ResonantInduction.DOMAIN, ResonantInduction.MODEL_TEXTURE_DIRECTORY + "transformer.png"); public static final ResourceLocation TEXTURE = new ResourceLocation(ResonantInduction.DOMAIN, ResonantInduction.MODEL_TEXTURE_DIRECTORY + "transformer.png");
public static void render(PartTransformer part, double x, double y, double z) public static void render(PartTransformer part, double x, double y, double z)
@ -45,7 +45,7 @@ public class RenderTransformer
GL11.glScalef(1.0F, -1F, -1F); GL11.glScalef(1.0F, -1F, -1F);
GL11.glRotatef(90, 0.0F, 1.0F, 0.0F); GL11.glRotatef(90, 0.0F, 1.0F, 0.0F);
FMLClientHandler.instance().getClient().renderEngine.bindTexture(TEXTURE); FMLClientHandler.instance().getClient().renderEngine.bindTexture(TEXTURE);
MODEL.render(null, 0, 0, 0, 0, 0, 0.0625F); MODEL.render(0.0625F);
//this.model.renderCores(te.getInput(), te.getOutput(), 0.0625F); //this.model.renderCores(te.getInput(), te.getOutput(), 0.0625F);
// this.bindTexture(TextureLocations.MODEL_TRANSFORMER_INPUT); // this.bindTexture(TextureLocations.MODEL_TRANSFORMER_INPUT);