diff --git a/resources/assets/resonantinduction/languages/en_US.properties b/resources/assets/resonantinduction/languages/en_US.properties index 13f33ec8..ad81de76 100755 --- a/resources/assets/resonantinduction/languages/en_US.properties +++ b/resources/assets/resonantinduction/languages/en_US.properties @@ -6,12 +6,12 @@ itemGroup.resonantinduction=Resonant Induction tile.resonantinduction\:tesla.name=Tesla Coil tile.resonantinduction\:contractor.name=Electromagnetic Levitator tile.resonantinduction\:battery.name=Battery -tile.resonantinduction\:transformer.name=Transformer ## Items item.resonantinduction\:quantumEntangler.name=Quantum Entangler item.resonantinduction\:linker.name=Electrostatic Linker +item.resonantinduction\:transformer.name=Transformer item.resonantinduction\:multimeter.name=Multimeter item.resonantinduction\:ioPanel.name=IO Panel diff --git a/resources/assets/resonantinduction/textures/models/transformer.png b/resources/assets/resonantinduction/textures/models/transformer.png index eb7b91c8..bc0e5f3d 100644 Binary files a/resources/assets/resonantinduction/textures/models/transformer.png and b/resources/assets/resonantinduction/textures/models/transformer.png differ diff --git a/src/resonantinduction/ClientProxy.java b/src/resonantinduction/ClientProxy.java index f8b02f71..86de7b8d 100644 --- a/src/resonantinduction/ClientProxy.java +++ b/src/resonantinduction/ClientProxy.java @@ -11,7 +11,7 @@ import resonantinduction.gui.GuiMultimeter; import resonantinduction.levitator.RenderLevitator; import resonantinduction.levitator.TileEntityEMContractor; import resonantinduction.multimeter.PartMultimeter; -import resonantinduction.multimeter.RenderItemMultimeter; +import resonantinduction.multimeter.RenderRIItem; import resonantinduction.render.BlockRenderingHandler; import resonantinduction.render.RenderTesla; import resonantinduction.tesla.TileEntityTesla; @@ -37,7 +37,8 @@ public class ClientProxy extends CommonProxy MinecraftForge.EVENT_BUS.register(SoundHandler.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(TileEntityEMContractor.class, new RenderLevitator()); } diff --git a/src/resonantinduction/MultipartRI.java b/src/resonantinduction/MultipartRI.java index b7fb9945..616bfd2d 100644 --- a/src/resonantinduction/MultipartRI.java +++ b/src/resonantinduction/MultipartRI.java @@ -1,6 +1,7 @@ package resonantinduction; import resonantinduction.multimeter.PartMultimeter; +import resonantinduction.transformer.PartTransformer; import resonantinduction.wire.part.PartFlatWire; import codechicken.multipart.MultiPartRegistry; import codechicken.multipart.MultiPartRegistry.IPartFactory; @@ -31,7 +32,7 @@ public class MultipartRI implements IPartFactory } else if (name.equals("resonant_induction_transformer")) { - return new PartMultimeter(); + return new PartTransformer(); } return null; diff --git a/src/resonantinduction/ResonantInduction.java b/src/resonantinduction/ResonantInduction.java index cbe43bf1..16110905 100644 --- a/src/resonantinduction/ResonantInduction.java +++ b/src/resonantinduction/ResonantInduction.java @@ -31,6 +31,7 @@ import resonantinduction.levitator.TileEntityEMContractor; import resonantinduction.multimeter.ItemMultimeter; import resonantinduction.tesla.BlockTesla; import resonantinduction.tesla.TileEntityTesla; +import resonantinduction.transformer.ItemTransformer; import resonantinduction.wire.EnumWireMaterial; import resonantinduction.wire.ItemWire; import basiccomponents.api.BasicRegistry; @@ -179,6 +180,7 @@ public class ResonantInduction itemLinker = new ItemLinker(getNextItemID()); itemPartWire = new ItemWire(getNextItemID()); itemMultimeter = new ItemMultimeter(getNextItemID()); + itemTransformer = new ItemTransformer(getNextItemID()); // Blocks blockTesla = new BlockTesla(getNextBlockID()); @@ -196,6 +198,7 @@ public class ResonantInduction GameRegistry.registerItem(itemLinker, itemLinker.getUnlocalizedName()); GameRegistry.registerItem(itemMultimeter, itemMultimeter.getUnlocalizedName()); + GameRegistry.registerItem(itemTransformer, itemTransformer.getUnlocalizedName()); GameRegistry.registerBlock(blockTesla, blockTesla.getUnlocalizedName()); GameRegistry.registerBlock(blockEMContractor, ItemBlockContractor.class, blockEMContractor.getUnlocalizedName()); diff --git a/src/resonantinduction/base/ItemMultipartBase.java b/src/resonantinduction/base/ItemMultipartBase.java new file mode 100644 index 00000000..668cd147 --- /dev/null +++ b/src/resonantinduction/base/ItemMultipartBase.java @@ -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); + } + +} diff --git a/src/resonantinduction/multimeter/ItemMultimeter.java b/src/resonantinduction/multimeter/ItemMultimeter.java index bf48069d..8ac47a85 100644 --- a/src/resonantinduction/multimeter/ItemMultimeter.java +++ b/src/resonantinduction/multimeter/ItemMultimeter.java @@ -7,28 +7,21 @@ import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.Icon; import net.minecraft.world.World; -import net.minecraftforge.common.Configuration; import net.minecraftforge.common.ForgeDirection; -import resonantinduction.ResonantInduction; -import resonantinduction.TabRI; +import resonantinduction.base.ItemMultipartBase; import resonantinduction.wire.EnumWireMaterial; import codechicken.lib.vec.BlockCoord; import codechicken.lib.vec.Vector3; -import codechicken.multipart.JItemMultiPart; import codechicken.multipart.MultiPartRegistry; import codechicken.multipart.TMultiPart; -public class ItemMultimeter extends JItemMultiPart +public class ItemMultimeter extends ItemMultipartBase { private Icon[] icons = new Icon[EnumWireMaterial.values().length]; public ItemMultimeter(int id) { - super(ResonantInduction.CONFIGURATION.get(Configuration.CATEGORY_ITEM, "multimeter", id).getInt(id)); - this.setUnlocalizedName(ResonantInduction.PREFIX + "multimeter"); - this.setCreativeTab(TabRI.INSTANCE); - this.setHasSubtypes(true); - this.setMaxDamage(0); + super("multimeter", id); } @Override diff --git a/src/resonantinduction/multimeter/RenderItemMultimeter.java b/src/resonantinduction/multimeter/RenderItemMultimeter.java deleted file mode 100644 index c5a0dded..00000000 --- a/src/resonantinduction/multimeter/RenderItemMultimeter.java +++ /dev/null @@ -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(); - } - -} diff --git a/src/resonantinduction/multimeter/RenderRIItem.java b/src/resonantinduction/multimeter/RenderRIItem.java new file mode 100644 index 00000000..e72ddcab --- /dev/null +++ b/src/resonantinduction/multimeter/RenderRIItem.java @@ -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(); + } + } + +} diff --git a/src/resonantinduction/transformer/ItemTransformer.java b/src/resonantinduction/transformer/ItemTransformer.java index fbe9c645..4126f3fc 100644 --- a/src/resonantinduction/transformer/ItemTransformer.java +++ b/src/resonantinduction/transformer/ItemTransformer.java @@ -1,34 +1,23 @@ package resonantinduction.transformer; -import java.util.List; - import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.Icon; import net.minecraft.world.World; -import net.minecraftforge.common.Configuration; -import net.minecraftforge.common.ForgeDirection; -import resonantinduction.ResonantInduction; -import resonantinduction.TabRI; +import resonantinduction.base.ItemMultipartBase; import resonantinduction.wire.EnumWireMaterial; import codechicken.lib.vec.BlockCoord; import codechicken.lib.vec.Vector3; -import codechicken.multipart.JItemMultiPart; import codechicken.multipart.MultiPartRegistry; import codechicken.multipart.TMultiPart; -public class ItemTransformer extends JItemMultiPart +public class ItemTransformer extends ItemMultipartBase { private Icon[] icons = new Icon[EnumWireMaterial.values().length]; public ItemTransformer(int id) { - super(ResonantInduction.CONFIGURATION.get(Configuration.CATEGORY_ITEM, "multimeter", id).getInt(id)); - this.setUnlocalizedName(ResonantInduction.PREFIX + "multimeter"); - this.setCreativeTab(TabRI.INSTANCE); - this.setHasSubtypes(true); - this.setMaxDamage(0); + super("transformer", id); } @Override diff --git a/src/resonantinduction/transformer/ModelTransformer.java b/src/resonantinduction/transformer/ModelTransformer.java index 6e153119..d3206faa 100644 --- a/src/resonantinduction/transformer/ModelTransformer.java +++ b/src/resonantinduction/transformer/ModelTransformer.java @@ -3,559 +3,147 @@ package resonantinduction.transformer; import net.minecraft.client.model.ModelBase; import net.minecraft.client.model.ModelRenderer; import net.minecraft.entity.Entity; -import net.minecraftforge.common.ForgeDirection; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; -import static net.minecraftforge.common.ForgeDirection.*; @SideOnly(Side.CLIENT) public class ModelTransformer extends ModelBase { - ModelRenderer Down_North; - ModelRenderer Down_West; - ModelRenderer Down_South; - ModelRenderer Down_East; - ModelRenderer Up_East; - ModelRenderer Up_West; - ModelRenderer Up_South; - ModelRenderer Up_North; - ModelRenderer South_Up; - ModelRenderer South_Down; - ModelRenderer South_West; - ModelRenderer South_East; - ModelRenderer North_Up; - ModelRenderer North_East; - ModelRenderer North_West; - ModelRenderer North_Down; - ModelRenderer East_South; - ModelRenderer East_North; - ModelRenderer East_Up; - ModelRenderer East_Down; - ModelRenderer West_Down; - ModelRenderer West_Up; - ModelRenderer West_South; - ModelRenderer West_North; - ModelRenderer io_Up; - ModelRenderer io_East; - ModelRenderer io_West; - ModelRenderer io_South; - ModelRenderer io_North; - ModelRenderer io_Down; - - public ModelTransformer() - { - super(); - textureWidth = 128; - textureHeight = 64; - - Down_North = new ModelRenderer(this, 108, 8); - Down_North.addBox(0F, 0F, 0F, 8, 2, 2); - Down_North.setRotationPoint(-7F, 21F, -1F); - Down_North.setTextureSize(this.textureWidth, this.textureHeight); - Down_North.mirror = true; - setRotation(Down_North, 0F, 0F, 0F); - Down_West = new ModelRenderer(this, 108, 22); - Down_West.addBox(0F, 0F, 0F, 2, 2, 8); - Down_West.setRotationPoint(-1F, 21F, -7F); - Down_West.setTextureSize(this.textureWidth, this.textureHeight); - Down_West.mirror = true; - setRotation(Down_West, 0F, 0F, 0F); - Down_South = new ModelRenderer(this, 108, 4); - Down_South.addBox(0F, 0F, 0F, 8, 2, 2); - Down_South.setRotationPoint(-1F, 21F, -1F); - Down_South.setTextureSize(this.textureWidth, this.textureHeight); - Down_South.mirror = true; - setRotation(Down_South, 0F, 0F, 0F); - Down_East = new ModelRenderer(this, 108, 12); - Down_East.addBox(0F, 0F, 0F, 2, 2, 8); - Down_East.setRotationPoint(-1F, 21F, -1F); - Down_East.setTextureSize(this.textureWidth, this.textureHeight); - Down_East.mirror = true; - setRotation(Down_East, 0F, 0F, 0F); - Up_East = new ModelRenderer(this, 88, 22); - Up_East.addBox(0F, 0F, 0F, 2, 2, 8); - Up_East.setRotationPoint(-1F, 9F, -1F); - Up_East.setTextureSize(this.textureWidth, this.textureHeight); - Up_East.mirror = true; - setRotation(Up_East, 0F, 0F, 0F); - Up_West = new ModelRenderer(this, 88, 12); - Up_West.addBox(0F, 0F, 0F, 2, 2, 8); - Up_West.setRotationPoint(-1F, 9F, -7F); - Up_West.setTextureSize(this.textureWidth, this.textureHeight); - Up_West.mirror = true; - setRotation(Up_West, 0F, 0F, 0F); - Up_South = new ModelRenderer(this, 108, 0); - Up_South.addBox(0F, 0F, 0F, 8, 2, 2); - Up_South.setRotationPoint(-1F, 9F, -1F); - Up_South.setTextureSize(this.textureWidth, this.textureHeight); - Up_South.mirror = true; - setRotation(Up_South, 0F, 0F, 0F); - Up_North = new ModelRenderer(this, 88, 0); - Up_North.addBox(0F, 0F, 0F, 8, 2, 2); - Up_North.setRotationPoint(-7F, 9F, -1F); - Up_North.setTextureSize(this.textureWidth, this.textureHeight); - Up_North.mirror = true; - setRotation(Up_North, 0F, 0F, 0F); - South_Up = new ModelRenderer(this, 0, 22); - South_Up.addBox(0F, 0F, 0F, 2, 8, 2); - South_Up.setRotationPoint(5F, 9F, -1F); - South_Up.setTextureSize(this.textureWidth, this.textureHeight); - South_Up.mirror = true; - setRotation(South_Up, 0F, 0F, 0F); - South_Down = new ModelRenderer(this, 8, 22); - South_Down.addBox(0F, 0F, 0F, 2, 8, 2); - South_Down.setRotationPoint(5F, 15F, -1F); - South_Down.setTextureSize(this.textureWidth, this.textureHeight); - South_Down.mirror = true; - setRotation(South_Down, 0F, 0F, 0F); - South_West = new ModelRenderer(this, 68, 22); - South_West.addBox(0F, 0F, 0F, 2, 2, 8); - South_West.setRotationPoint(5F, 15F, -7F); - South_West.setTextureSize(this.textureWidth, this.textureHeight); - South_West.mirror = true; - setRotation(South_West, 0F, 0F, 0F); - South_East = new ModelRenderer(this, 68, 12); - South_East.addBox(0F, 0F, 0F, 2, 2, 8); - South_East.setRotationPoint(5F, 15F, -1F); - South_East.setTextureSize(this.textureWidth, this.textureHeight); - South_East.mirror = true; - setRotation(South_East, 0F, 0F, 0F); - North_Up = new ModelRenderer(this, 16, 22); - North_Up.addBox(0F, 0F, 0F, 2, 8, 2); - North_Up.setRotationPoint(-7F, 9F, -1F); - North_Up.setTextureSize(this.textureWidth, this.textureHeight); - North_Up.mirror = true; - setRotation(North_Up, 0F, 0F, 0F); - North_East = new ModelRenderer(this, 48, 22); - North_East.addBox(0F, 0F, 0F, 2, 2, 8); - North_East.setRotationPoint(-7F, 15F, -1F); - North_East.setTextureSize(this.textureWidth, this.textureHeight); - North_East.mirror = true; - setRotation(North_East, 0F, 0F, 0F); - North_West = new ModelRenderer(this, 48, 12); - North_West.addBox(0F, 0F, 0F, 2, 2, 8); - North_West.setRotationPoint(-7F, 15F, -7F); - North_West.setTextureSize(this.textureWidth, this.textureHeight); - North_West.mirror = true; - setRotation(North_West, 0F, 0F, 0F); - North_Down = new ModelRenderer(this, 0, 12); - North_Down.addBox(0F, 0F, 0F, 2, 8, 2); - North_Down.setRotationPoint(-7F, 15F, -1F); - North_Down.setTextureSize(this.textureWidth, this.textureHeight); - North_Down.mirror = true; - setRotation(North_Down, 0F, 0F, 0F); - East_South = new ModelRenderer(this, 88, 4); - East_South.addBox(0F, 0F, 0F, 8, 2, 2); - 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); - } + // fields + ModelRenderer a; + ModelRenderer b; + ModelRenderer c; + ModelRenderer d; + ModelRenderer out2; + ModelRenderer out1; + ModelRenderer out3; + ModelRenderer out4; + ModelRenderer i; + ModelRenderer j; + ModelRenderer in1; + ModelRenderer in2; + ModelRenderer in3; + ModelRenderer in4; + + public ModelTransformer() + { + textureWidth = 70; + textureHeight = 45; + + a = new ModelRenderer(this, 0, 0); + a.addBox(-8F, 0F, -8F, 16, 2, 16); + a.setRotationPoint(0F, 22F, 0F); + a.setTextureSize(70, 45); + a.mirror = true; + setRotation(a, 0F, 0F, 0F); + b = new ModelRenderer(this, 0, 19); + b.addBox(0F, 0F, -2F, 3, 11, 4); + b.setRotationPoint(5F, 11F, 0F); + b.setTextureSize(70, 45); + b.mirror = true; + setRotation(b, 0F, 0F, 0F); + c = new ModelRenderer(this, 0, 19); + c.addBox(0F, 0F, -2F, 3, 11, 4); + c.setRotationPoint(-8F, 11F, 0F); + c.setTextureSize(70, 45); + c.mirror = true; + setRotation(c, 0F, 0F, 0F); + d = new ModelRenderer(this, 15, 19); + d.addBox(0F, 0F, -2F, 16, 1, 4); + d.setRotationPoint(-8F, 10F, 0F); + d.setTextureSize(70, 45); + d.mirror = true; + setRotation(d, 0F, 0F, 0F); + out2 = new ModelRenderer(this, 0, 35); + out2.addBox(0F, 0F, -3F, 5, 0, 6); + out2.setRotationPoint(-9F, 16F, 0F); + out2.setTextureSize(70, 45); + out2.mirror = true; + setRotation(out2, 0F, 0F, 0F); + out1 = new ModelRenderer(this, 0, 35); + out1.addBox(0F, 0F, -3F, 5, 0, 6); + out1.setRotationPoint(-9F, 15F, 0F); + out1.setTextureSize(70, 45); + out1.mirror = true; + setRotation(out1, 0F, 0F, 0F); + out3 = new ModelRenderer(this, 0, 35); + out3.addBox(0F, 0F, -3F, 5, 0, 6); + out3.setRotationPoint(-9F, 17F, 0F); + out3.setTextureSize(70, 45); + out3.mirror = true; + setRotation(out3, 0F, 0F, 0F); + out4 = new ModelRenderer(this, 0, 35); + out4.addBox(0F, 0F, -3F, 5, 0, 6); + out4.setRotationPoint(-9F, 18F, 0F); + out4.setTextureSize(70, 45); + out4.mirror = true; + setRotation(out4, 0F, 0F, 0F); + i = new ModelRenderer(this, 34, 35); + i.addBox(0F, 0F, -1F, 2, 5, 2); + i.setRotationPoint(-10F, 14F, 0F); + i.setTextureSize(70, 45); + i.mirror = true; + setRotation(i, 0F, 0F, 0F); + j = new ModelRenderer(this, 24, 35); + j.addBox(0F, 0F, -1F, 2, 5, 2); + j.setRotationPoint(8F, 14F, 0F); + j.setTextureSize(70, 45); + j.mirror = true; + setRotation(j, 0F, 0F, 0F); + in1 = new ModelRenderer(this, 0, 35); + in1.addBox(0F, 0F, -3F, 5, 0, 6); + in1.setRotationPoint(4F, 15F, 0F); + in1.setTextureSize(70, 45); + in1.mirror = true; + setRotation(in1, 0F, 0F, 0F); + in2 = new ModelRenderer(this, 0, 35); + in2.addBox(0F, 0F, -3F, 5, 0, 6); + in2.setRotationPoint(4F, 16F, 0F); + in2.setTextureSize(70, 45); + in2.mirror = true; + setRotation(in2, 0F, 0F, 0F); + in3 = new ModelRenderer(this, 0, 35); + in3.addBox(0F, 0F, -3F, 5, 0, 6); + in3.setRotationPoint(4F, 17F, 0F); + in3.setTextureSize(70, 45); + in3.mirror = true; + setRotation(in3, 0F, 0F, 0F); + in4 = new ModelRenderer(this, 0, 35); + in4.addBox(0F, 0F, -3F, 5, 0, 6); + in4.setRotationPoint(4F, 18F, 0F); + in4.setTextureSize(70, 45); + in4.mirror = true; + setRotation(in4, 0F, 0F, 0F); + } + + public void render(float f5) + { + a.render(f5); + b.render(f5); + c.render(f5); + d.render(f5); + out2.render(f5); + out1.render(f5); + out3.render(f5); + out4.render(f5); + i.render(f5); + j.render(f5); + in1.render(f5); + in2.render(f5); + in3.render(f5); + in4.render(f5); + } + + private void setRotation(ModelRenderer model, float x, float y, float z) + { + model.rotateAngleX = x; + model.rotateAngleY = y; + model.rotateAngleZ = z; + } + + 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); - } - } \ No newline at end of file diff --git a/src/resonantinduction/transformer/PartTransformer.java b/src/resonantinduction/transformer/PartTransformer.java index bc26a7ed..590c5442 100644 --- a/src/resonantinduction/transformer/PartTransformer.java +++ b/src/resonantinduction/transformer/PartTransformer.java @@ -1,7 +1,16 @@ 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 resonantinduction.ResonantInduction; import codechicken.lib.render.CCRenderState; import codechicken.lib.render.TextureUtils; import codechicken.lib.vec.Cuboid6; @@ -72,7 +81,26 @@ public class PartTransformer extends JCuboidPart implements JNormalOcclusion, TF @Override public Iterable getOcclusionBoxes() { - return null; + return Arrays.asList(oBoxes[this.side]); + } + + protected ItemStack getItem() + { + return new ItemStack(ResonantInduction.itemTransformer); + } + + @Override + public Iterable getDrops() + { + List drops = new ArrayList(); + drops.add(getItem()); + return drops; + } + + @Override + public ItemStack pickItem(MovingObjectPosition hit) + { + return getItem(); } @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 public String getType() { diff --git a/src/resonantinduction/transformer/RenderTransformer.java b/src/resonantinduction/transformer/RenderTransformer.java index 945aeb8b..00180e0d 100644 --- a/src/resonantinduction/transformer/RenderTransformer.java +++ b/src/resonantinduction/transformer/RenderTransformer.java @@ -20,7 +20,7 @@ import cpw.mods.fml.relauncher.SideOnly; @SideOnly(Side.CLIENT) 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 void render(PartTransformer part, double x, double y, double z) @@ -45,7 +45,7 @@ public class RenderTransformer GL11.glScalef(1.0F, -1F, -1F); GL11.glRotatef(90, 0.0F, 1.0F, 0.0F); 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.bindTexture(TextureLocations.MODEL_TRANSFORMER_INPUT);