diff options
| author | Lance5057 <Lance5057@gmail.com> | 2015-07-09 01:59:36 -0500 |
|---|---|---|
| committer | Lance5057 <Lance5057@gmail.com> | 2015-07-09 01:59:36 -0500 |
| commit | e9c02857b01d7c4afe887c612fc3a1a70a973837 (patch) | |
| tree | 05b2b6af6d2795bea9b8dee9cbdb49b37733d1ff /src/main | |
| parent | a918009626db55c1fc5f359c557f0e848da15f46 (diff) | |
Worked on the Finishing Anvil
Diffstat (limited to 'src/main')
26 files changed, 1051 insertions, 106 deletions
diff --git a/src/main/java/gmail/Lance5057/TD_Config.java b/src/main/java/gmail/Lance5057/TD_Config.java index f729b59..bcd08d3 100644 --- a/src/main/java/gmail/Lance5057/TD_Config.java +++ b/src/main/java/gmail/Lance5057/TD_Config.java @@ -13,6 +13,7 @@ public class TD_Config public int DazeID; public int CrestFeathersID; public int CrestMirrorsID; + public int CrestLegendsID; public TD_Config(FMLPreInitializationEvent e) { @@ -27,6 +28,7 @@ public class TD_Config DazeID = config.get("Modifier Configs", "Daze ID", 18).getInt(); CrestFeathersID = config.get("Modifier Configs", "Crest of Feathers ID", 19).getInt(); CrestMirrorsID = config.get("Modifier Configs", "Crest of Mirrors ID", 20).getInt(); + CrestLegendsID = config.get("Modifier Configs", "Crest of Legends ID", 21).getInt(); config.save(); } diff --git a/src/main/java/gmail/Lance5057/TinkersDefense.java b/src/main/java/gmail/Lance5057/TinkersDefense.java index 8bf5ce3..aa55913 100644 --- a/src/main/java/gmail/Lance5057/TinkersDefense.java +++ b/src/main/java/gmail/Lance5057/TinkersDefense.java @@ -3,7 +3,8 @@ package gmail.Lance5057; import static net.minecraft.util.EnumChatFormatting.DARK_RED; import static net.minecraft.util.EnumChatFormatting.GOLD; import static net.minecraft.util.EnumChatFormatting.LIGHT_PURPLE; -import gmail.Lance5057.armor.blocks.ArmorAnvil; +import gmail.Lance5057.armor.items.ChainArmor; +import gmail.Lance5057.armor.items.ClothArmor; import gmail.Lance5057.armor.items.Sheath; import gmail.Lance5057.armor.items.TinkerArmor; import gmail.Lance5057.armor.tools.Item_Cloth; @@ -12,11 +13,13 @@ import gmail.Lance5057.armor.tools.Item_Thread; import gmail.Lance5057.blocks.AeonSteelBlock; import gmail.Lance5057.blocks.CrestMount; import gmail.Lance5057.blocks.DogbeariumBlock; +import gmail.Lance5057.blocks.FinishingAnvil; import gmail.Lance5057.blocks.JewelersBench; import gmail.Lance5057.blocks.QueensGoldBlock; import gmail.Lance5057.events.TDEventHandler; import gmail.Lance5057.items.AeonSteelIngot; import gmail.Lance5057.items.DogbeariumIngot; +import gmail.Lance5057.items.Injector; import gmail.Lance5057.items.QueensGoldIngot; import gmail.Lance5057.items.TD_Patterns; import gmail.Lance5057.items.tools.HeaterShield; @@ -28,20 +31,23 @@ import gmail.Lance5057.liquids.moltenQueensGoldFluid; import gmail.Lance5057.modifiers.TDefenseActiveToolMod; import gmail.Lance5057.modifiers.modifierDaze; import gmail.Lance5057.modifiers.shields.modifierCrestofFeathers; +import gmail.Lance5057.modifiers.shields.modifierCrestofLegends; import gmail.Lance5057.modifiers.shields.modifierCrestofMirrors; import gmail.Lance5057.network.PacketHandler; import gmail.Lance5057.proxy.CommonProxy; -import gmail.Lance5057.tileentities.TileEntity_ArmorAnvil; +import gmail.Lance5057.tileentities.TileEntity_FinishingAnvil; import gmail.Lance5057.tileentities.TileEntity_CrestMount; import gmail.Lance5057.tileentities.TileEntity_JewelersBench; import net.minecraft.block.Block; import net.minecraft.block.material.Material; +import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.item.Item; import net.minecraft.item.ItemArmor.ArmorMaterial; import net.minecraft.item.ItemStack; +import net.minecraft.util.IIcon; import net.minecraft.util.StatCollector; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.common.config.Configuration; @@ -79,7 +85,8 @@ import cpw.mods.fml.common.registry.GameRegistry; public class TinkersDefense { private static int modGuiIndex = 0; - public static final int GUI_ITEM_INV = modGuiIndex++; + public static final int GUI_CREST_INV = modGuiIndex++; + public static final int GUI_ANVIL_INV = modGuiIndex++; @Instance(Reference.MOD_ID) public static TinkersDefense instance = new TinkersDefense(); @@ -128,20 +135,23 @@ public class TinkersDefense { public static Block block_JewelersBench; public static Item item_TinkerArmor; + public static Item item_ChainArmor; + public static Item item_ClothArmor; public static Item item_Sheath; - - public static Item item_Crest_Feathers; - public static Item item_Crest_Blades; public static Item item_thread; public static Item item_glowthread; public static Item item_cloth; + + public static Item item_relic; public static Pattern woodPattern; public static Pattern metalPattern; public static DynamicToolPart partRivet; public static DynamicToolPart partArmorplate; + + public static Injector tcInject; @SidedProxy(clientSide = "gmail.Lance5057.proxy.ClientProxy", serverSide = "gmail.Lance5057.proxy.CommonProxy") public static CommonProxy proxy; @@ -166,12 +176,12 @@ public class TinkersDefense { new ItemStack(TinkerTools.toughRod, 1, 1), 'i', new ItemStack(TinkerTools.toolRod, 1, 1) }); - block_ArmorAnvil = new ArmorAnvil().setHardness(4.0F) + block_ArmorAnvil = new FinishingAnvil().setHardness(4.0F) .setStepSound(Block.soundTypeAnvil).setBlockName("ArmorAnvil") .setCreativeTab(tabName); GameRegistry.registerBlock(block_ArmorAnvil, "Block_ArmorAnvil"); - GameRegistry.registerTileEntity(TileEntity_ArmorAnvil.class, + GameRegistry.registerTileEntity(TileEntity_FinishingAnvil.class, "Tile_ArmorAnvil"); block_JewelersBench = new JewelersBench().setHardness(4.0F) @@ -188,6 +198,13 @@ public class TinkersDefense { tabIcon = new Item().setMaxStackSize(1).setCreativeTab(tabName).setUnlocalizedName("tabIcon").setTextureName(Reference.MOD_ID + ":Icon"); GameRegistry.registerItem(tabIcon, "tabIcon"); + + item_relic = new Item().setCreativeTab(tabName).setMaxStackSize(1) + .setUnlocalizedName("AncientRelic") + .setTextureName(Reference.MOD_ID + ":AncientRelic"); + + GameRegistry.registerItem(item_relic, "Ancient Relic"); + // AeonSteel item_AeonSteelIngot = new AeonSteelIngot().setCreativeTab(tabName) .setMaxStackSize(64).setUnlocalizedName("AeonSteelIngot") @@ -281,24 +298,6 @@ public class TinkersDefense { tool_wrench = new TinkerWrench(); - item_Crest_Feathers = new Item().setCreativeTab(tabName) - .setMaxStackSize(1).setUnlocalizedName("Crest_Feathers") - .setTextureName(Reference.MOD_ID + ":Crest_feather"); - - GameRegistry.registerItem(item_Crest_Feathers, "Crest of Feathers"); - GameRegistry.addRecipe(new ItemStack(item_Crest_Feathers), - new Object[] { "---", "f-f", "-o-", 'f', Items.feather, 'o', - Items.iron_ingot }); - - item_Crest_Blades = new Item().setCreativeTab(tabName) - .setMaxStackSize(1).setUnlocalizedName("Crest_Blades") - .setTextureName(Reference.MOD_ID + ":Crest_blades"); - - GameRegistry.registerItem(item_Crest_Blades, "Crest of Blades"); - GameRegistry.addRecipe(new ItemStack(item_Crest_Blades), - new Object[] { "---", "f-f", "-o-", 'f', Items.iron_sword, 'o', - Items.diamond }); - GameRegistry.registerItem(tool_roundShield, "Round Shield"); GameRegistry.registerItem(tool_heaterShield, "Heater Shield"); GameRegistry.registerItem(tool_wrench, "Tinker Wrench"); @@ -333,6 +332,14 @@ public class TinkersDefense { item_TinkerArmor = new TinkerArmor(ArmorMaterial.IRON, 4, 1).setUnlocalizedName("Tinker_Armor"); GameRegistry.registerItem(item_TinkerArmor,"Tinker Armor"); + + item_ChainArmor = new ChainArmor(ArmorMaterial.IRON, 4, + 1).setUnlocalizedName("Chain_Armor"); + GameRegistry.registerItem(item_ChainArmor,"Chain Armor"); + + item_ClothArmor = new ClothArmor(ArmorMaterial.IRON, 4, + 1).setUnlocalizedName("Cloth_Armor"); + GameRegistry.registerItem(item_ClothArmor,"Cloth Armor"); item_Sheath = new Sheath().setUnlocalizedName("Sheath"); GameRegistry.registerItem(item_Sheath, "Sheath"); @@ -345,17 +352,25 @@ public class TinkersDefense { public void init(FMLInitializationEvent e) { System.out.print(Reference.MOD_ID); + //tcInject = new Injector(); + //GameRegistry.registerItem(tcInject, "debugger"); + + PatternBuilder pb = PatternBuilder.instance; ModifyBuilder.registerModifier(new modifierDaze("Daze", config.DazeID, new ItemStack[] { new ItemStack(Blocks.light_weighted_pressure_plate), new ItemStack(Items.potionitem,1,8202)}, new int[] {1,0})); - ModifyBuilder.registerModifier(new modifierCrestofFeathers("Crest of Feathers", config.CrestFeathersID, new ItemStack[] { new ItemStack(item_Crest_Feathers)}, + ModifyBuilder.registerModifier(new modifierCrestofFeathers("Crest of Feathers", config.CrestFeathersID, new ItemStack[] { new ItemStack(Items.feather)}, new int[] {1})); ModifyBuilder.registerModifier(new modifierCrestofMirrors("Crest of Mirrors", config.CrestMirrorsID, new ItemStack[] { new ItemStack(Blocks.glass_pane)}, new int[] {1})); + + ModifyBuilder.registerModifier(new modifierCrestofLegends("Crest of Legends", config.CrestLegendsID, new ItemStack[] { new ItemStack(item_relic)}, + new int[] {1})); + TConstructRegistry.registerActiveToolMod(new TDefenseActiveToolMod()); for (ToolCore tool : TConstructRegistry.getToolMapping()) @@ -363,6 +378,7 @@ public class TinkersDefense { TConstructClientRegistry.addEffectRenderMapping(tool, config.DazeID, "tinker", "daze", true); TConstructClientRegistry.addEffectRenderMapping(tool, config.CrestFeathersID, "tinker", "feathers", true); TConstructClientRegistry.addEffectRenderMapping(tool, config.CrestMirrorsID, "tinker", "mirrors", true); + TConstructClientRegistry.addEffectRenderMapping(tool, config.CrestLegendsID, "tinker", "legends", true); } diff --git a/src/main/java/gmail/Lance5057/armor/blocks/ArmorAnvil.java b/src/main/java/gmail/Lance5057/armor/blocks/ArmorAnvil.java deleted file mode 100644 index c6aa286..0000000 --- a/src/main/java/gmail/Lance5057/armor/blocks/ArmorAnvil.java +++ /dev/null @@ -1,50 +0,0 @@ -package gmail.Lance5057.armor.blocks; - -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import gmail.Lance5057.tileentities.TileEntity_ArmorAnvil; -import gmail.Lance5057.tileentities.TileEntity_CrestMount; -import net.minecraft.block.Block; -import net.minecraft.block.ITileEntityProvider; -import net.minecraft.block.material.Material; -import net.minecraft.client.renderer.texture.IIconRegister; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.world.World; - -public class ArmorAnvil extends Block implements ITileEntityProvider -{ - - public ArmorAnvil() { - super(Material.iron); - } - - //You don't want the normal render type, or it wont render properly. - @Override - public int getRenderType() { - return -1; - } - - //It's not an opaque cube, so you need this. - @Override - public boolean isOpaqueCube() { - return false; - } - - //It's not a normal block, so you need this too. - public boolean renderAsNormalBlock() { - return false; - } - - //This is the icon to use for showing the block in your hand. - @SideOnly(Side.CLIENT) - @Override - public void registerBlockIcons(IIconRegister icon) { - this.blockIcon = icon.registerIcon("tinkersdefense:WIP"); - } - - @Override - public TileEntity createNewTileEntity(World w, int md) { - TileEntity_ArmorAnvil te = new TileEntity_ArmorAnvil(); - return te; - } -} diff --git a/src/main/java/gmail/Lance5057/armor/items/ChainArmor.java b/src/main/java/gmail/Lance5057/armor/items/ChainArmor.java new file mode 100644 index 0000000..6a5dea9 --- /dev/null +++ b/src/main/java/gmail/Lance5057/armor/items/ChainArmor.java @@ -0,0 +1,78 @@ +package gmail.Lance5057.armor.items; + +import gmail.Lance5057.TinkersDefense; +import gmail.Lance5057.proxy.ClientProxy; +import net.minecraft.client.model.ModelBiped; +import net.minecraft.client.renderer.texture.IIconRegister; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemArmor; +import net.minecraft.item.ItemStack; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + +public class ChainArmor extends ItemArmor { + public ChainArmor(ArmorMaterial par2EnumArmorMaterial, int par3, int par4) { + super(par2EnumArmorMaterial, par3, par4); + } + + @Override + @SideOnly(Side.CLIENT) + public void registerIcons(IIconRegister par1IconRegister) { + String itemName = "tinkersdefense:textures/armor/ChainArmor"; + this.itemIcon = par1IconRegister.registerIcon(itemName); + } + + @Override + public String getArmorTexture(ItemStack stack, Entity entity, int slot, + String type) { + return "tinkersdefense:textures/armor/ChainArmor.png"; + } + + @Override + @SideOnly(Side.CLIENT) + public ModelBiped getArmorModel(EntityLivingBase entityLiving, + ItemStack itemStack, int armorSlot) + { + +// return ClientProxy.chain; + ModelBiped armorModel = ClientProxy.chain; + if (itemStack != null) { +// if (itemStack.getItem() instanceof TinkerArmor) { +// int type = ((ItemArmor) itemStack.getItem()).armorType; +// if (type == 1 || type == 3) { +// armorModel = TinkersDefense.proxy.getArmorModel(0); +// } else { +// armorModel = TinkersDefense.proxy.getArmorModel(1); +// } +// +// } + if (armorModel != null) { +// armorModel.bipedHead.showModel = armorSlot == 0; +// armorModel.bipedHeadwear.showModel = armorSlot == 0; +// armorModel.bipedBody.showModel = armorSlot == 1 +// || armorSlot == 2; +// armorModel.bipedRightArm.showModel = armorSlot == 1; +// armorModel.bipedLeftArm.showModel = armorSlot == 1; +// armorModel.bipedRightLeg.showModel = armorSlot == 2 +// || armorSlot == 3; +// armorModel.bipedLeftLeg.showModel = armorSlot == 2 +// || armorSlot == 3; + armorModel.isSneak = entityLiving.isSneaking(); + armorModel.isRiding = entityLiving.isRiding(); + armorModel.isChild = entityLiving.isChild(); + armorModel.heldItemRight = entityLiving.getHeldItem() != null ? 1 + : 0; + + if (entityLiving instanceof EntityPlayer) { + armorModel.aimedBow = ((EntityPlayer) entityLiving) + .getItemInUseDuration() > 2; + } + return armorModel; + } + } + return armorModel; + } + +}
\ No newline at end of file diff --git a/src/main/java/gmail/Lance5057/armor/items/ClothArmor.java b/src/main/java/gmail/Lance5057/armor/items/ClothArmor.java new file mode 100644 index 0000000..1317a3e --- /dev/null +++ b/src/main/java/gmail/Lance5057/armor/items/ClothArmor.java @@ -0,0 +1,78 @@ +package gmail.Lance5057.armor.items; + +import gmail.Lance5057.TinkersDefense; +import gmail.Lance5057.proxy.ClientProxy; +import net.minecraft.client.model.ModelBiped; +import net.minecraft.client.renderer.texture.IIconRegister; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemArmor; +import net.minecraft.item.ItemStack; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + +public class ClothArmor extends ItemArmor { + public ClothArmor(ArmorMaterial par2EnumArmorMaterial, int par3, int par4) { + super(par2EnumArmorMaterial, par3, par4); + } + + @Override + @SideOnly(Side.CLIENT) + public void registerIcons(IIconRegister par1IconRegister) { + String itemName = "tinkersdefense:textures/armor/ClothArmor"; + this.itemIcon = par1IconRegister.registerIcon(itemName); + } + + @Override + public String getArmorTexture(ItemStack stack, Entity entity, int slot, + String type) { + return "tinkersdefense:textures/armor/ChainArmor.png"; + } + + @Override + @SideOnly(Side.CLIENT) + public ModelBiped getArmorModel(EntityLivingBase entityLiving, + ItemStack itemStack, int armorSlot) + { + +// return ClientProxy.chain; + ModelBiped armorModel = ClientProxy.chain; + if (itemStack != null) { +// if (itemStack.getItem() instanceof TinkerArmor) { +// int type = ((ItemArmor) itemStack.getItem()).armorType; +// if (type == 1 || type == 3) { +// armorModel = TinkersDefense.proxy.getArmorModel(0); +// } else { +// armorModel = TinkersDefense.proxy.getArmorModel(1); +// } +// +// } + if (armorModel != null) { +// armorModel.bipedHead.showModel = armorSlot == 0; +// armorModel.bipedHeadwear.showModel = armorSlot == 0; +// armorModel.bipedBody.showModel = armorSlot == 1 +// || armorSlot == 2; +// armorModel.bipedRightArm.showModel = armorSlot == 1; +// armorModel.bipedLeftArm.showModel = armorSlot == 1; +// armorModel.bipedRightLeg.showModel = armorSlot == 2 +// || armorSlot == 3; +// armorModel.bipedLeftLeg.showModel = armorSlot == 2 +// || armorSlot == 3; + armorModel.isSneak = entityLiving.isSneaking(); + armorModel.isRiding = entityLiving.isRiding(); + armorModel.isChild = entityLiving.isChild(); + armorModel.heldItemRight = entityLiving.getHeldItem() != null ? 1 + : 0; + + if (entityLiving instanceof EntityPlayer) { + armorModel.aimedBow = ((EntityPlayer) entityLiving) + .getItemInUseDuration() > 2; + } + return armorModel; + } + } + return armorModel; + } + +}
\ No newline at end of file diff --git a/src/main/java/gmail/Lance5057/armor/items/TinkerArmor.java b/src/main/java/gmail/Lance5057/armor/items/TinkerArmor.java index 811f18c..3899023 100644 --- a/src/main/java/gmail/Lance5057/armor/items/TinkerArmor.java +++ b/src/main/java/gmail/Lance5057/armor/items/TinkerArmor.java @@ -20,14 +20,14 @@ public class TinkerArmor extends ItemArmor { @Override @SideOnly(Side.CLIENT) public void registerIcons(IIconRegister par1IconRegister) { - String itemName = "tinkersdefense:textures/armor/ChainArmor"; + String itemName = "tinkersdefense:textures/armor/TinkerArmor"; this.itemIcon = par1IconRegister.registerIcon(itemName); } @Override public String getArmorTexture(ItemStack stack, Entity entity, int slot, String type) { - return "tinkersdefense:textures/armor/ChainArmor.png"; + return "tinkersdefense:textures/armor/TinkerArmor.png"; } @Override @@ -37,7 +37,7 @@ public class TinkerArmor extends ItemArmor { { // return ClientProxy.chain; - ModelBiped armorModel = ClientProxy.chain; + ModelBiped armorModel = ClientProxy.tutChest; if (itemStack != null) { // if (itemStack.getItem() instanceof TinkerArmor) { // int type = ((ItemArmor) itemStack.getItem()).armorType; diff --git a/src/main/java/gmail/Lance5057/armor/renderers/ModelClothArmor.java b/src/main/java/gmail/Lance5057/armor/renderers/ModelClothArmor.java new file mode 100644 index 0000000..3cc043e --- /dev/null +++ b/src/main/java/gmail/Lance5057/armor/renderers/ModelClothArmor.java @@ -0,0 +1,286 @@ +package gmail.Lance5057.armor.renderers; + +import net.minecraft.client.model.ModelBase; +import net.minecraft.client.model.ModelRenderer; +import net.minecraft.entity.Entity; +import org.lwjgl.opengl.GL11; + +/** + * Hood - Lance5057 + * Created using Tabula 4.1.1 + */ +public class ModelClothArmor extends ModelBase { + public ModelRenderer TopLeft; + public ModelRenderer field_78124_i; + public ModelRenderer field_78123_h; + public ModelRenderer Top; + public ModelRenderer Left; + public ModelRenderer Right; + public ModelRenderer Collar; + public ModelRenderer TrimLeft2; + public ModelRenderer TrimLeft3; + public ModelRenderer TrimLeft4; + public ModelRenderer TrimRight3; + public ModelRenderer TrimRight2; + public ModelRenderer TrimRight4; + public ModelRenderer Flop; + public ModelRenderer Top_1; + public ModelRenderer ArmLeft; + public ModelRenderer ArmRight; + public ModelRenderer Chest; + public ModelRenderer Belt; + public ModelRenderer Button; + public ModelRenderer Back; + public ModelRenderer ShawlLeft1; + public ModelRenderer ShawlLeft2; + public ModelRenderer ShawlRight1; + public ModelRenderer ShawlRight2; + public ModelRenderer LeftFront; + public ModelRenderer RightFront; + public ModelRenderer LeftFS; + public ModelRenderer LeftF; + public ModelRenderer LeftBS; + public ModelRenderer LeftB; + public ModelRenderer LeftB2; + public ModelRenderer LeftBA; + public ModelRenderer RightFS; + public ModelRenderer RightF; + public ModelRenderer RightBS; + public ModelRenderer RightB; + public ModelRenderer RightBA; + public ModelRenderer RightB2; + + public ModelClothArmor() { + this.textureWidth = 64; + this.textureHeight = 64; + this.TrimRight2 = new ModelRenderer(this, 0, 4); + this.TrimRight2.setRotationPoint(3.0F, -1.5F, -6.0F); + this.TrimRight2.addBox(0.0F, 0.0F, 0.0F, 2, 2, 1, 0.0F); + this.setRotateAngle(TrimRight2, 0.0F, 0.0F, 0.7853981633974483F); + this.Top_1 = new ModelRenderer(this, 0, 17); + this.Top_1.setRotationPoint(0.0F, -0.3F, 0.0F); + this.Top_1.addBox(-8.5F, 0.0F, -3.0F, 9, 2, 6, 0.01F); + this.RightB2 = new ModelRenderer(this, 0, 0); + this.RightB2.setRotationPoint(-6.2F, 0.0F, -3.61F); + this.RightB2.addBox(-1.7F, -0.4F, 3.3F, 1, 11, 2, 0.0F); + this.setRotateAngle(RightB2, 0.0F, 1.5707963267948966F, 0.08726646259971647F); + this.Top = new ModelRenderer(this, 0, 0); + this.Top.setRotationPoint(0.5F, 0.0F, 0.0F); + this.Top.addBox(-4.0F, -9.0F, -5.0F, 9, 1, 11, 0.0F); + this.setRotateAngle(Top, 0.0F, 3.141592653589793F, 0.0F); + this.TopLeft = new ModelRenderer(this, 0, 17); + this.TopLeft.setRotationPoint(0.0F, -0.3F, 0.0F); + this.TopLeft.addBox(-8.5F, 0.0F, -3.0F, 9, 2, 6, 0.01F); + this.setRotateAngle(TopLeft, 0.0F, 3.141592653589793F, 0.0F); + this.field_78123_h = new ModelRenderer(this, 0, 16); + this.field_78123_h.setRotationPoint(-1.899999976158142F, 12.0F, 0.10000000149011612F); + this.field_78123_h.addBox(-2.0F, 0.0F, -2.0F, 4, 12, 4, 0.0F); + this.TrimLeft3 = new ModelRenderer(this, 0, 0); + this.TrimLeft3.setRotationPoint(-2.3F, 0.0F, -5.5F); + this.TrimLeft3.addBox(0.0F, 0.0F, 0.0F, 2, 2, 1, 0.0F); + this.setRotateAngle(TrimLeft3, 0.009773843811168246F, 3.141592653589793F, 0.7853981633974483F); + this.ArmRight = new ModelRenderer(this, 32, 25); + this.ArmRight.setRotationPoint(-3.5F, 0.0F, 0.0F); + this.ArmRight.addBox(0.0F, 0.0F, -2.5F, 5, 11, 5, 0.01F); + this.setRotateAngle(ArmRight, 0.0F, 3.141592653589793F, 0.0F); + this.TrimRight3 = new ModelRenderer(this, 0, 0); + this.TrimRight3.setRotationPoint(3.7F, 0.0F, -5.5F); + this.TrimRight3.addBox(0.0F, 0.0F, 0.0F, 2, 2, 1, 0.0F); + this.setRotateAngle(TrimRight3, 0.0F, 3.141592653589793F, 0.7853981633974483F); + this.Left = new ModelRenderer(this, 40, 0); + this.Left.mirror = true; + this.Left.setRotationPoint(-0.5F, -0.3F, 0.0F); + this.Left.addBox(4.0F, -8.3F, -5.0F, 1, 7, 11, 0.0F); + this.setRotateAngle(Left, 0.0F, 3.141592653589793F, 0.08726646259971647F); + this.Right = new ModelRenderer(this, 40, 0); + this.Right.setRotationPoint(0.5F, -0.3F, 0.0F); + this.Right.addBox(-5.0F, -8.3F, -5.0F, 1, 7, 11, 0.0F); + this.setRotateAngle(Right, 0.0F, 3.141592653589793F, -0.08726646259971647F); + this.LeftB2 = new ModelRenderer(this, 0, 0); + this.LeftB2.setRotationPoint(-3.0F, -0.1F, 3.61F); + this.LeftB2.addBox(-1.7F, 0.0F, -2.0F, 1, 11, 2, 0.0F); + this.setRotateAngle(LeftB2, 0.0F, 4.71238898038469F, 0.08726646259971647F); + this.field_78124_i = new ModelRenderer(this, 0, 16); + this.field_78124_i.mirror = true; + this.field_78124_i.setRotationPoint(1.899999976158142F, 12.0F, 0.10000000149011612F); + this.field_78124_i.addBox(-2.0F, 0.0F, -2.0F, 4, 12, 4, 0.0F); + this.Button = new ModelRenderer(this, 0, 0); + this.Button.setRotationPoint(0.0F, 0.0F, -3.5F); + this.Button.addBox(0.0F, 0.0F, 0.0F, 2, 2, 1, 0.0F); + this.setRotateAngle(Button, 0.0F, 0.0F, 0.7853981633974483F); + this.LeftFS = new ModelRenderer(this, 0, 0); + this.LeftFS.setRotationPoint(-1.8F, 0.0F, -2.9F); + this.LeftFS.addBox(1.0F, 0.0F, 2.0F, 1, 11, 2, 0.0F); + this.setRotateAngle(LeftFS, 0.0F, 0.7853981633974483F, 0.0F); + this.Collar = new ModelRenderer(this, 0, 12); + this.Collar.setRotationPoint(0.0F, 0.0F, 0.0F); + this.Collar.addBox(-5.5F, -1.0F, -5.5F, 11, 2, 11, 0.0F); + this.setRotateAngle(Collar, 0.0F, 3.141592653589793F, 0.0F); + this.Back = new ModelRenderer(this, 8, 37); + this.Back.setRotationPoint(0.0F, 1.2F, 2.02F); + this.Back.addBox(-4.0F, 0.0F, 0.0F, 8, 5, 1, 0.0F); + this.RightFront = new ModelRenderer(this, 0, 0); + this.RightFront.setRotationPoint(-1.9F, 12.0F, 0.0F); + this.RightFront.addBox(1.4F, 0.0F, -1.5F, 1, 11, 3, 0.0F); + this.setRotateAngle(RightFront, 0.0F, 3.141592653589793F, 0.08726646259971647F); + this.ShawlRight1 = new ModelRenderer(this, 32, 0); + this.ShawlRight1.mirror = true; + this.ShawlRight1.setRotationPoint(-0.6F, 1.3F, 0.0F); + this.ShawlRight1.addBox(0.0F, 0.0F, -3.0F, 6, 5, 6, 0.0F); + this.setRotateAngle(ShawlRight1, 0.0F, 0.0F, -0.2792526803190927F); + this.LeftF = new ModelRenderer(this, 0, 0); + this.LeftF.setRotationPoint(-4.1F, 0.0F, -1.9F); + this.LeftF.addBox(0.0F, 0.0F, 2.1F, 1, 11, 3, 0.0F); + this.setRotateAngle(LeftF, 0.0F, 1.5707963267948966F, 0.0F); + this.LeftB = new ModelRenderer(this, 0, 0); + this.LeftB.setRotationPoint(-2.0F, 0.0F, 3.6F); + this.LeftB.addBox(-1.7F, 0.0F, -3.0F, 1, 11, 3, 0.0F); + this.setRotateAngle(LeftB, 0.0F, 4.71238898038469F, 0.0F); + this.LeftBS = new ModelRenderer(this, 0, 0); + this.LeftBS.setRotationPoint(1.0F, 0.0F, 3.6F); + this.LeftBS.addBox(-1.5F, 0.0F, -2.5F, 1, 11, 2, 0.0F); + this.setRotateAngle(LeftBS, 0.0F, -0.7853981633974483F, 0.0F); + this.RightB = new ModelRenderer(this, 0, 0); + this.RightB.setRotationPoint(-6.1F, -0.2F, -3.6F); + this.RightB.addBox(-1.7F, 0.2F, 4.1F, 1, 11, 3, 0.0F); + this.setRotateAngle(RightB, 0.0F, 1.5707963267948966F, 0.0F); + this.TrimLeft4 = new ModelRenderer(this, 40, 0); + this.TrimLeft4.setRotationPoint(5.3F, -2.0F, 5.0F); + this.TrimLeft4.addBox(0.0F, 0.0F, 0.0F, 1, 2, 11, 0.0F); + this.setRotateAngle(TrimLeft4, 0.0F, 3.141592653589793F, 0.5235987755982988F); + this.RightF = new ModelRenderer(this, 0, 0); + this.RightF.setRotationPoint(-4.1F, 0.0F, 1.9F); + this.RightF.addBox(0.1F, 0.0F, -5.1F, 1, 11, 3, 0.0F); + this.setRotateAngle(RightF, 0.0F, -1.5707963267948966F, 0.0F); + this.ShawlLeft1 = new ModelRenderer(this, 32, 0); + this.ShawlLeft1.setRotationPoint(-0.6F, 1.3F, 0.0F); + this.ShawlLeft1.addBox(0.0F, 0.0F, -3.0F, 6, 5, 6, 0.0F); + this.setRotateAngle(ShawlLeft1, 0.0F, 0.0F, -0.2792526803190927F); + this.ShawlRight2 = new ModelRenderer(this, 0, 34); + this.ShawlRight2.mirror = true; + this.ShawlRight2.setRotationPoint(-2.5F, -1.8F, -0.1F); + this.ShawlRight2.addBox(1.0F, -1.0F, -2.0F, 6, 3, 5, 0.0F); + this.setRotateAngle(ShawlRight2, 0.0F, 0.0F, 0.9424777960769379F); + this.TrimLeft2 = new ModelRenderer(this, 0, 4); + this.TrimLeft2.setRotationPoint(-3.0F, -1.5F, -6.0F); + this.TrimLeft2.addBox(0.0F, 0.0F, 0.0F, 2, 2, 1, 0.0F); + this.setRotateAngle(TrimLeft2, 0.0F, 0.0F, 0.7853981633974483F); + this.LeftFront = new ModelRenderer(this, 0, 0); + this.LeftFront.setRotationPoint(1.9F, 12.0F, 0.0F); + this.LeftFront.addBox(1.4F, 0.0F, -1.5F, 1, 11, 3, 0.0F); + this.setRotateAngle(LeftFront, 0.0F, 0.0F, -0.08726646259971647F); + this.TrimRight4 = new ModelRenderer(this, 40, 0); + this.TrimRight4.mirror = true; + this.TrimRight4.setRotationPoint(-4.5F, -2.5F, 5.0F); + this.TrimRight4.addBox(0.0F, 0.0F, 0.0F, 1, 2, 11, 0.0F); + this.setRotateAngle(TrimRight4, 0.0F, 3.141592653589793F, -0.5235987755982988F); + this.ShawlLeft2 = new ModelRenderer(this, 0, 34); + this.ShawlLeft2.mirror = true; + this.ShawlLeft2.setRotationPoint(-2.5F, -1.8F, 0.1F); + this.ShawlLeft2.addBox(1.0F, -1.0F, -3.0F, 6, 3, 5, 0.0F); + this.setRotateAngle(ShawlLeft2, 0.0F, 0.0F, 0.9424777960769379F); + this.RightBA = new ModelRenderer(this, 0, 0); + this.RightBA.setRotationPoint(-5.8F, -0.4F, -3.61F); + this.RightBA.addBox(-3.9F, 0.0F, -4.1F, 1, 11, 5, 0.0F); + this.setRotateAngle(RightBA, 0.0F, 2.6179938779914944F, 0.08726646259971647F); + this.LeftBA = new ModelRenderer(this, 0, 0); + this.LeftBA.setRotationPoint(-2.9F, -0.1F, 3.91F); + this.LeftBA.addBox(0.3F, 0.0F, -6.0F, 1, 11, 5, 0.0F); + this.setRotateAngle(LeftBA, 0.0F, 0.4363323129985824F, 0.08726646259971647F); + this.RightFS = new ModelRenderer(this, 0, 0); + this.RightFS.setRotationPoint(-1.9F, 0.0F, 2.9F); + this.RightFS.addBox(1.1F, 0.0F, -4.0F, 1, 11, 2, 0.0F); + this.setRotateAngle(RightFS, 0.0F, -0.7853981633974483F, 0.0F); + this.ArmLeft = new ModelRenderer(this, 32, 25); + this.ArmLeft.setRotationPoint(3.5F, -0.0F, 0.0F); + this.ArmLeft.addBox(0.0F, 0.0F, -2.5F, 5, 11, 5, 0.01F); + this.RightBS = new ModelRenderer(this, 0, 0); + this.RightBS.setRotationPoint(-3.1F, -0.2F, -3.6F); + this.RightBS.addBox(1.4F, 0.2F, 3.4F, 1, 11, 2, 0.0F); + this.setRotateAngle(RightBS, 0.0F, 0.7853981633974483F, 0.0F); + this.Flop = new ModelRenderer(this, 18, 25); + this.Flop.setRotationPoint(0.0F, -7.0F, 8.5F); + this.Flop.addBox(-4.0F, 0.0F, 0.0F, 8, 7, 4, 0.0F); + this.setRotateAngle(Flop, 0.5235987755982988F, 3.141592653589793F, 0.0F); + this.Belt = new ModelRenderer(this, 0, 25); + this.Belt.setRotationPoint(0.0F, 0.0F, 0.0F); + this.Belt.addBox(-6.8F, 10.0F, -3.0F, 10, 3, 6, 0.01F); + this.setRotateAngle(Belt, 0.0F, 0.0F, -0.13962634015954636F); + this.Chest = new ModelRenderer(this, 0, 0); + this.Chest.setRotationPoint(0.0F, 0.0F, 0.0F); + this.Chest.addBox(-4.5F, 0.0F, -2.5F, 9, 12, 5, 0.0F); + this.RightFront.addChild(this.RightB2); + this.LeftFront.addChild(this.LeftB2); + this.LeftFront.addChild(this.LeftFS); + this.ArmRight.addChild(this.ShawlRight1); + this.LeftFront.addChild(this.LeftF); + this.LeftFront.addChild(this.LeftB); + this.LeftFront.addChild(this.LeftBS); + this.RightFront.addChild(this.RightB); + this.RightFront.addChild(this.RightF); + this.ArmLeft.addChild(this.ShawlLeft1); + this.ShawlRight1.addChild(this.ShawlRight2); + this.ShawlLeft1.addChild(this.ShawlLeft2); + this.RightFront.addChild(this.RightBA); + this.LeftFront.addChild(this.LeftBA); + this.RightFront.addChild(this.RightFS); + this.RightFront.addChild(this.RightBS); + } + + @Override + public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) { + this.TrimRight2.render(f5); + this.Top_1.render(f5); + this.Top.render(f5); + this.TopLeft.render(f5); + this.field_78123_h.render(f5); + GL11.glPushMatrix(); + GL11.glTranslatef(this.TrimLeft3.offsetX, this.TrimLeft3.offsetY, this.TrimLeft3.offsetZ); + GL11.glTranslatef(this.TrimLeft3.rotationPointX * f5, this.TrimLeft3.rotationPointY * f5, this.TrimLeft3.rotationPointZ * f5); + GL11.glScaled(0.5D, 0.5D, 1.0D); + GL11.glTranslatef(-this.TrimLeft3.offsetX, -this.TrimLeft3.offsetY, -this.TrimLeft3.offsetZ); + GL11.glTranslatef(-this.TrimLeft3.rotationPointX * f5, -this.TrimLeft3.rotationPointY * f5, -this.TrimLeft3.rotationPointZ * f5); + this.TrimLeft3.render(f5); + GL11.glPopMatrix(); + this.ArmRight.render(f5); + GL11.glPushMatrix(); + GL11.glTranslatef(this.TrimRight3.offsetX, this.TrimRight3.offsetY, this.TrimRight3.offsetZ); + GL11.glTranslatef(this.TrimRight3.rotationPointX * f5, this.TrimRight3.rotationPointY * f5, this.TrimRight3.rotationPointZ * f5); + GL11.glScaled(0.5D, 0.5D, 1.0D); + GL11.glTranslatef(-this.TrimRight3.offsetX, -this.TrimRight3.offsetY, -this.TrimRight3.offsetZ); + GL11.glTranslatef(-this.TrimRight3.rotationPointX * f5, -this.TrimRight3.rotationPointY * f5, -this.TrimRight3.rotationPointZ * f5); + this.TrimRight3.render(f5); + GL11.glPopMatrix(); + this.Left.render(f5); + this.Right.render(f5); + this.field_78124_i.render(f5); + this.Button.render(f5); + this.Collar.render(f5); + this.Back.render(f5); + this.RightFront.render(f5); + this.TrimLeft4.render(f5); + this.TrimLeft2.render(f5); + this.LeftFront.render(f5); + this.TrimRight4.render(f5); + this.ArmLeft.render(f5); + GL11.glPushMatrix(); + GL11.glTranslatef(this.Flop.offsetX, this.Flop.offsetY, this.Flop.offsetZ); + GL11.glTranslatef(this.Flop.rotationPointX * f5, this.Flop.rotationPointY * f5, this.Flop.rotationPointZ * f5); + GL11.glScaled(1.1D, 1.0D, 1.0D); + GL11.glTranslatef(-this.Flop.offsetX, -this.Flop.offsetY, -this.Flop.offsetZ); + GL11.glTranslatef(-this.Flop.rotationPointX * f5, -this.Flop.rotationPointY * f5, -this.Flop.rotationPointZ * f5); + this.Flop.render(f5); + GL11.glPopMatrix(); + this.Belt.render(f5); + this.Chest.render(f5); + } + + /** + * This is a helper function from Tabula to set the rotation of model parts + */ + public void setRotateAngle(ModelRenderer modelRenderer, float x, float y, float z) { + modelRenderer.rotateAngleX = x; + modelRenderer.rotateAngleY = y; + modelRenderer.rotateAngleZ = z; + } +} diff --git a/src/main/java/gmail/Lance5057/blocks/CrestMount.java b/src/main/java/gmail/Lance5057/blocks/CrestMount.java index ccac070..d1561ec 100644 --- a/src/main/java/gmail/Lance5057/blocks/CrestMount.java +++ b/src/main/java/gmail/Lance5057/blocks/CrestMount.java @@ -45,7 +45,7 @@ public class CrestMount extends BlockContainer { return false; } //code to open gui explained later - player.openGui(TinkersDefense.instance, TinkersDefense.GUI_ITEM_INV, player.worldObj, x, y, z); + player.openGui(TinkersDefense.instance, TinkersDefense.GUI_CREST_INV, player.worldObj, x, y, z); return true; } diff --git a/src/main/java/gmail/Lance5057/blocks/FinishingAnvil.java b/src/main/java/gmail/Lance5057/blocks/FinishingAnvil.java new file mode 100644 index 0000000..ac4dcf3 --- /dev/null +++ b/src/main/java/gmail/Lance5057/blocks/FinishingAnvil.java @@ -0,0 +1,150 @@ +package gmail.Lance5057.blocks; + +import static net.minecraftforge.common.util.ForgeDirection.EAST; +import static net.minecraftforge.common.util.ForgeDirection.NORTH; +import static net.minecraftforge.common.util.ForgeDirection.SOUTH; +import static net.minecraftforge.common.util.ForgeDirection.WEST; +import gmail.Lance5057.TinkersDefense; +import gmail.Lance5057.tileentities.TileEntity_FinishingAnvil; + +import java.util.Random; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import net.minecraft.block.Block; +import net.minecraft.block.BlockContainer; +import net.minecraft.block.material.Material; +import net.minecraft.client.renderer.texture.IIconRegister; +import net.minecraft.entity.item.EntityItem; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.inventory.IInventory; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.tileentity.TileEntityChest; +import net.minecraft.world.World; + +public class FinishingAnvil extends BlockContainer { + public FinishingAnvil() { + super(Material.iron); + this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); + } + + @Override + public void onBlockAdded(World world, int i, int j, int k) + { + super.onBlockAdded(world, i, j, k); + world.markBlockForUpdate(i, j, k); + } + + @Override + public boolean onBlockActivated(World world, int x, int y, int z, + EntityPlayer player, int metadata, float what, float these, float are) { + TileEntity tileEntity = world.getTileEntity(x, y, z); + if (tileEntity == null || player.isSneaking()) { + return false; + } + //code to open gui explained later + player.openGui(TinkersDefense.instance, TinkersDefense.GUI_ANVIL_INV, player.worldObj, x, y, z); + return true; + } + + @Override + public void breakBlock(World world, int x, int y, int z, Block par5, int par6) { + dropItems(world, x, y, z); + super.breakBlock(world, x, y, z, par5, par6); + } + + private void dropItems(World world, int x, int y, int z){ + Random rand = new Random(); + + TileEntity tileEntity = world.getTileEntity(x, y, z); + if (!(tileEntity instanceof IInventory)) { + return; + } + IInventory inventory = (IInventory) tileEntity; + + for (int i = 0; i < inventory.getSizeInventory(); i++) { + ItemStack item = inventory.getStackInSlot(i); + + if (item != null && item.stackSize > 0) { + float rx = rand.nextFloat() * 0.8F + 0.1F; + float ry = rand.nextFloat() * 0.8F + 0.1F; + float rz = rand.nextFloat() * 0.8F + 0.1F; + + EntityItem entityItem = new EntityItem(world, + x + rx, y + ry, z + rz, + new ItemStack(item.getItem(), item.stackSize, item.getItemDamage())); + + if (item.hasTagCompound()) { + entityItem.getEntityItem().setTagCompound((NBTTagCompound) item.getTagCompound().copy()); + } + + float factor = 0.05F; + entityItem.motionX = rand.nextGaussian() * factor; + entityItem.motionY = rand.nextGaussian() * factor + 0.2F; + entityItem.motionZ = rand.nextGaussian() * factor; + world.spawnEntityInWorld(entityItem); + item.stackSize = 0; + } + } +} + + //You don't want the normal render type, or it wont render properly. + @Override + public int getRenderType() { + return -1; + } + + //It's not an opaque cube, so you need this. + @Override + public boolean isOpaqueCube() { + return false; + } + + //It's not a normal block, so you need this too. + public boolean renderAsNormalBlock() { + return false; + } + + //This is the icon to use for showing the block in your hand. + @SideOnly(Side.CLIENT) + @Override + public void registerBlockIcons(IIconRegister icon) { + this.blockIcon = icon.registerIcon("tinkersdefense:WIP"); + } + + @Override + public TileEntity createNewTileEntity(World w, int md) { + TileEntity_FinishingAnvil te = new TileEntity_FinishingAnvil(); + return te; + } + + @Override + public int onBlockPlaced(World p_149660_1_, int p_149660_2_, int p_149660_3_, int p_149660_4_, int p_149660_5_, float p_149660_6_, float p_149660_7_, float p_149660_8_, int p_149660_9_) + { + int j1 = p_149660_9_; + + if ((p_149660_9_ == 0 || p_149660_5_ == 2) && p_149660_1_.isSideSolid(p_149660_2_, p_149660_3_, p_149660_4_ + 1, NORTH)) + { + j1 = 1; + } + + if ((j1 == 0 || p_149660_5_ == 3) && p_149660_1_.isSideSolid(p_149660_2_, p_149660_3_, p_149660_4_ - 1, SOUTH)) + { + j1 = 2; + } + + if ((j1 == 0 || p_149660_5_ == 4) && p_149660_1_.isSideSolid(p_149660_2_ + 1, p_149660_3_, p_149660_4_, WEST)) + { + j1 = 3; + } + + if ((j1 == 0 || p_149660_5_ == 5) && p_149660_1_.isSideSolid(p_149660_2_ - 1, p_149660_3_, p_149660_4_, EAST)) + { + j1 = 4; + } + + return j1; + } +} diff --git a/src/main/java/gmail/Lance5057/containers/Container_CrestMount.java b/src/main/java/gmail/Lance5057/containers/Container_CrestMount.java index 2baa3e3..4cdeb42 100644 --- a/src/main/java/gmail/Lance5057/containers/Container_CrestMount.java +++ b/src/main/java/gmail/Lance5057/containers/Container_CrestMount.java @@ -10,12 +10,12 @@ import net.minecraft.item.ItemStack; public class Container_CrestMount extends Container { - public Container_CrestMount(InventoryPlayer inventoryPlayer, TileEntity_CrestMount TileEntity_CrestMount) + public Container_CrestMount(InventoryPlayer inventoryPlayer, TileEntity_CrestMount te) { - addSlotToContainer(new Slot(TileEntity_CrestMount, 0, 62, 28)); - addSlotToContainer(new Slot(TileEntity_CrestMount, 1, 98, 28)); - addSlotToContainer(new Slot(TileEntity_CrestMount, 2, 80, 28)); - addSlotToContainer(new Slot(TileEntity_CrestMount, 3, 80, 46)); + addSlotToContainer(new Slot(te, 0, 62, 28)); + addSlotToContainer(new Slot(te, 1, 98, 28)); + addSlotToContainer(new Slot(te, 2, 80, 28)); + addSlotToContainer(new Slot(te, 3, 80, 46)); for (int x = 0; x < 9; x++) { @@ -37,10 +37,7 @@ public class Container_CrestMount extends Container return true; } - /** - * Called when a player shift-clicks on a slot. You must override this or you will crash when someone does that. - * Only real change we make to this is to set needsUpdate to true at the end - */ + @Override public ItemStack transferStackInSlot(EntityPlayer par1EntityPlayer, int par2) { return null; diff --git a/src/main/java/gmail/Lance5057/containers/Container_FinishingAnvil.java b/src/main/java/gmail/Lance5057/containers/Container_FinishingAnvil.java new file mode 100644 index 0000000..5a445c9 --- /dev/null +++ b/src/main/java/gmail/Lance5057/containers/Container_FinishingAnvil.java @@ -0,0 +1,42 @@ +package gmail.Lance5057.containers; + +import gmail.Lance5057.tileentities.TileEntity_FinishingAnvil; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.inventory.Container; +import net.minecraft.inventory.Slot; +import net.minecraft.item.ItemStack; + +public class Container_FinishingAnvil extends Container +{ + public Container_FinishingAnvil(InventoryPlayer inventoryPlayer, TileEntity_FinishingAnvil te) + { + addSlotToContainer(new Slot(te, 0, 26, 32)); + addSlotToContainer(new Slot(te, 1, 62, 28)); + + for (int x = 0; x < 9; x++) + { + addSlotToContainer(new Slot(inventoryPlayer, x, 8 + 18 * x, 142)); + } + + for (int y = 0; y < 3; y++) + { + for (int x = 0; x < 9; x++) + { + addSlotToContainer(new Slot(inventoryPlayer, x + y * 9 + 9, 8 + 18 * x, 84 + y * 18)); + } + } + } + + @Override + public boolean canInteractWith(EntityPlayer p_75145_1_) + { + return true; + } + + @Override + public ItemStack transferStackInSlot(EntityPlayer par1EntityPlayer, int par2) + { + return null; + } +} diff --git a/src/main/java/gmail/Lance5057/gui/Gui_FinishingAnvil.java b/src/main/java/gmail/Lance5057/gui/Gui_FinishingAnvil.java new file mode 100644 index 0000000..7c2fb0a --- /dev/null +++ b/src/main/java/gmail/Lance5057/gui/Gui_FinishingAnvil.java @@ -0,0 +1,79 @@ +package gmail.Lance5057.gui; + +import gmail.Lance5057.TinkersDefense; +import gmail.Lance5057.containers.Container_CrestMount; +import gmail.Lance5057.containers.Container_FinishingAnvil; +import gmail.Lance5057.network.Message_CrestMount; +import gmail.Lance5057.tileentities.TileEntity_CrestMount; +import gmail.Lance5057.tileentities.TileEntity_FinishingAnvil; + +import org.lwjgl.opengl.GL11; + +import net.minecraft.client.gui.GuiButton; +import net.minecraft.client.gui.inventory.GuiContainer; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.inventory.Container; +import net.minecraft.util.ResourceLocation; + +public class Gui_FinishingAnvil extends GuiContainer +{ + private float xSize_lo; + private float ySize_lo; + + private final TileEntity_FinishingAnvil inventory; + + private static int buttonIndex = 0; + + private static final ResourceLocation iconLocation = new ResourceLocation("tinkersdefense", "textures/gui/finishinganvil.png"); + + public Gui_FinishingAnvil(InventoryPlayer invPlayer, TileEntity_FinishingAnvil te) + { + super(new Container_FinishingAnvil(invPlayer, te)); + this.inventory = te; + } + + @Override + public void initGui() + { + super.initGui(); + this.buttonList.add(new GuiButton(buttonIndex++ ,this.guiLeft+7, this.guiTop+13, 18, 18,"")); + this.buttonList.add(new GuiButton(buttonIndex++ ,this.guiLeft+183, this.guiTop+13, 33, 10,"Part")); + this.buttonList.add(new GuiButton(buttonIndex++ ,this.guiLeft+215, this.guiTop+13, 33, 10,"Sets")); + this.buttonList.add(new GuiButton(buttonIndex++ ,this.guiLeft+183, this.guiTop+33, 65, 10,"^")); + this.buttonList.add(new GuiButton(buttonIndex++ ,this.guiLeft+183, this.guiTop+148, 65, 10,"v")); + + //((GuiButton)this.buttonList.get(0)).displayString = "9"; + } + + @Override + protected void actionPerformed(GuiButton button) + { +// for(int i = 1; i<5; i++) +// { +// if(button.id == i) +// { +// +// } +// } + } + public void drawScreen(int par1, int par2, float par3) + { + super.drawScreen(par1, par2, par3); + this.xSize_lo = (float)par1; + this.ySize_lo = (float)par2; + } + + protected void drawGuiContainerForegroundLayer(int par1, int par2) + { + + } + + protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3) + { + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + this.mc.getTextureManager().bindTexture(iconLocation); + int k = ((this.width - this.xSize) / 2); + int l = (this.height - this.ySize) / 2; + this.drawTexturedModalRect(k, l, 0, 0, this.xSize+80, this.ySize); + } +} diff --git a/src/main/java/gmail/Lance5057/items/Injector.java b/src/main/java/gmail/Lance5057/items/Injector.java new file mode 100644 index 0000000..9297932 --- /dev/null +++ b/src/main/java/gmail/Lance5057/items/Injector.java @@ -0,0 +1,29 @@ +package gmail.Lance5057.items; + +import tconstruct.library.tools.ToolCore; +import tconstruct.tools.TinkerTools; +import net.minecraft.client.renderer.texture.IIconRegister; +import net.minecraft.item.Item; + +public class Injector extends Item +{ + int headsIndex; + int accessoryIndex; + int handleIndex; + int extraIndex; + + @Override + public void registerIcons(IIconRegister iconRegister) + { + Inject(TinkerTools.broadsword, iconRegister); + } + + protected void Inject(ToolCore tc, IIconRegister iconRegister) + { + tc.accessoryStrings.clear(); + tc.accessoryStrings.put(19, "tinkersdefense:broadsword/_smallguard"); + + + tc.registerIcons(iconRegister); + } +} diff --git a/src/main/java/gmail/Lance5057/modifiers/shields/modifierCrestofFeathers.java b/src/main/java/gmail/Lance5057/modifiers/shields/modifierCrestofFeathers.java index 53fdbed..70562c9 100644 --- a/src/main/java/gmail/Lance5057/modifiers/shields/modifierCrestofFeathers.java +++ b/src/main/java/gmail/Lance5057/modifiers/shields/modifierCrestofFeathers.java @@ -12,7 +12,7 @@ public class modifierCrestofFeathers extends ItemModTypeFilter public modifierCrestofFeathers(String type, int effect, ItemStack[] items, int[] values) { - super(effect, "Crest of Feathers", items, values); + super(effect, "Feathers", items, values); tooltipName = "\u00A7fCrest of Feathers"; guiType = type; } diff --git a/src/main/java/gmail/Lance5057/modifiers/shields/modifierCrestofLegends.java b/src/main/java/gmail/Lance5057/modifiers/shields/modifierCrestofLegends.java new file mode 100644 index 0000000..7282cc6 --- /dev/null +++ b/src/main/java/gmail/Lance5057/modifiers/shields/modifierCrestofLegends.java @@ -0,0 +1,64 @@ +package gmail.Lance5057.modifiers.shields; + +import tconstruct.modifiers.tools.ItemModTypeFilter; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; + +public class modifierCrestofLegends extends ItemModTypeFilter +{ + String tooltipName; + String guiType; + + public modifierCrestofLegends(String type, int effect, ItemStack[] items, int[] values) + { + super(effect, "Legends", items, values); + tooltipName = "\u00A7fCrest of Legends"; + guiType = type; + } + + @Override + protected boolean canModify (ItemStack tool, ItemStack[] input) + { + NBTTagCompound tags = tool.getTagCompound().getCompoundTag("InfiTool"); + + int keyPair[] = tags.getIntArray(key); + if (keyPair[0] + matchingAmount(input) <= keyPair[1]) + return true; + + else if (keyPair[0] == keyPair[1]) + return tags.getInteger("Modifiers") > 0; + + else + return false; + } + + @Override + public void modify (ItemStack[] input, ItemStack tool) + { + NBTTagCompound tags = tool.getTagCompound().getCompoundTag("InfiTool"); + int increase = matchingAmount(input); + if (tags.hasKey(key)) + { + int[] keyPair = tags.getIntArray(key); + + updateModTag(tool, keyPair); + + } + else + { + int modifiers = tags.getInteger("Modifiers"); + modifiers -= 1; + tags.setInteger("Modifiers", modifiers); + String modName = "\u00A76" + guiType; + int tooltipIndex = addToolTip(tool, tooltipName, modName); + } + } + + void updateModTag (ItemStack tool, int[] keys) + { + NBTTagCompound tags = tool.getTagCompound().getCompoundTag("InfiTool"); + String tip = "ModifierTip" + keys[2]; + String modName = "\u00A76" + guiType + " (" + keys[0] + "/" + keys[1] + ")"; + tags.setString(tip, modName); + } +} diff --git a/src/main/java/gmail/Lance5057/proxy/ClientProxy.java b/src/main/java/gmail/Lance5057/proxy/ClientProxy.java index 0bae0b8..a1738cb 100644 --- a/src/main/java/gmail/Lance5057/proxy/ClientProxy.java +++ b/src/main/java/gmail/Lance5057/proxy/ClientProxy.java @@ -2,13 +2,14 @@ package gmail.Lance5057.proxy; import gmail.Lance5057.TinkersDefense; import gmail.Lance5057.armor.renderers.ModelChainArmor; +import gmail.Lance5057.armor.renderers.ModelClothArmor; import gmail.Lance5057.armor.renderers.ModelSheath; import gmail.Lance5057.armor.renderers.ModelTinkerArmor; import gmail.Lance5057.models.Renderer_ArmorAnvil; import gmail.Lance5057.models.Renderer_CrestMount; import gmail.Lance5057.models.Renderer_JewelersBench; -import gmail.Lance5057.tileentities.TileEntity_ArmorAnvil; import gmail.Lance5057.tileentities.TileEntity_CrestMount; +import gmail.Lance5057.tileentities.TileEntity_FinishingAnvil; import gmail.Lance5057.tileentities.TileEntity_JewelersBench; import net.minecraft.client.model.ModelBiped; import net.minecraftforge.client.MinecraftForgeClient; @@ -16,9 +17,10 @@ import tconstruct.client.FlexibleToolRenderer; import cpw.mods.fml.client.registry.ClientRegistry; public class ClientProxy extends CommonProxy { - private static final ModelTinkerArmor tutChest = new ModelTinkerArmor(1.0f); + public static final ModelTinkerArmor tutChest = new ModelTinkerArmor(1.0f); public static final ModelSheath sheath = new ModelSheath(); public static final ModelChainArmor chain = new ModelChainArmor(0.1f); + public static final ModelClothArmor cloth = new ModelClothArmor(); @Override public void registerRenderers() { @@ -33,7 +35,7 @@ public class ClientProxy extends CommonProxy { ClientRegistry.bindTileEntitySpecialRenderer( TileEntity_CrestMount.class, new Renderer_CrestMount()); ClientRegistry.bindTileEntitySpecialRenderer( - TileEntity_ArmorAnvil.class, new Renderer_ArmorAnvil()); + TileEntity_FinishingAnvil.class, new Renderer_ArmorAnvil()); ClientRegistry.bindTileEntitySpecialRenderer( TileEntity_JewelersBench.class, new Renderer_JewelersBench()); diff --git a/src/main/java/gmail/Lance5057/proxy/CommonProxy.java b/src/main/java/gmail/Lance5057/proxy/CommonProxy.java index 5f21484..981ab0f 100644 --- a/src/main/java/gmail/Lance5057/proxy/CommonProxy.java +++ b/src/main/java/gmail/Lance5057/proxy/CommonProxy.java @@ -3,7 +3,9 @@ package gmail.Lance5057.proxy; import gmail.Lance5057.TinkersDefense; import gmail.Lance5057.containers.Container_CrestMount; import gmail.Lance5057.gui.Gui_CrestMount; +import gmail.Lance5057.gui.Gui_FinishingAnvil; import gmail.Lance5057.tileentities.TileEntity_CrestMount; +import gmail.Lance5057.tileentities.TileEntity_FinishingAnvil; import net.minecraft.client.model.ModelBiped; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.world.World; @@ -40,7 +42,7 @@ public class CommonProxy implements IGuiHandler { public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) { // Hooray, no 'magic' numbers - we know exactly which Gui this refers to - if (ID == TinkersDefense.GUI_ITEM_INV) + if (ID == TinkersDefense.GUI_CREST_INV) { // Use the player's held item to create the inventory return new Container_CrestMount(player.inventory, (TileEntity_CrestMount)world.getTileEntity(x, y, z)); @@ -52,12 +54,14 @@ public class CommonProxy implements IGuiHandler { public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) { - if (ID == TinkersDefense.GUI_ITEM_INV) + if (ID == TinkersDefense.GUI_CREST_INV) { - // We have to cast the new container as our custom class - return new Gui_CrestMount(player.inventory, (TileEntity_CrestMount)world.getTileEntity(x, y, z)); } + if (ID == TinkersDefense.GUI_ANVIL_INV) + { + return new Gui_FinishingAnvil(player.inventory, (TileEntity_FinishingAnvil)world.getTileEntity(x, y, z)); + } return null; } }
\ No newline at end of file diff --git a/src/main/java/gmail/Lance5057/tileentities/TileEntity_ArmorAnvil.java b/src/main/java/gmail/Lance5057/tileentities/TileEntity_ArmorAnvil.java deleted file mode 100644 index 59b823e..0000000 --- a/src/main/java/gmail/Lance5057/tileentities/TileEntity_ArmorAnvil.java +++ /dev/null @@ -1,8 +0,0 @@ -package gmail.Lance5057.tileentities; - -import net.minecraft.tileentity.TileEntity; - -public class TileEntity_ArmorAnvil extends TileEntity -{ - -} diff --git a/src/main/java/gmail/Lance5057/tileentities/TileEntity_FinishingAnvil.java b/src/main/java/gmail/Lance5057/tileentities/TileEntity_FinishingAnvil.java new file mode 100644 index 0000000..91188b1 --- /dev/null +++ b/src/main/java/gmail/Lance5057/tileentities/TileEntity_FinishingAnvil.java @@ -0,0 +1,176 @@ +package gmail.Lance5057.tileentities; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.inventory.IInventory; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.NBTTagList; +import net.minecraft.network.NetworkManager; +import net.minecraft.network.Packet; +import net.minecraft.network.play.server.S35PacketUpdateTileEntity; +import net.minecraft.tileentity.TileEntity; +import net.minecraftforge.common.util.Constants; + +public class TileEntity_FinishingAnvil extends TileEntity implements IInventory +{ + public static int invSize = 2; + public ItemStack[] inventory; + + private final String name = "Anvil Inventory"; + + public TileEntity_FinishingAnvil() + { + super(); + inventory = new ItemStack[invSize]; + } + + @Override + public void updateEntity() + { + super.updateEntity(); + } + + @Override + public Packet getDescriptionPacket() { + NBTTagCompound tag = new NBTTagCompound(); + writeToNBT(tag); + return new S35PacketUpdateTileEntity(xCoord, yCoord, zCoord, 0, tag); + } + + @Override + public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity pkt) { + readFromNBT(pkt.func_148857_g()); + } + + @Override + public int getSizeInventory() { + return invSize; + } + + @Override + public ItemStack getStackInSlot(int slot) { + return inventory[slot]; + } + + @Override + public ItemStack decrStackSize(int slot, int amount) { + ItemStack stack = getStackInSlot(slot); + if (stack != null) + { + if (stack.stackSize > amount) + { + stack = stack.splitStack(amount); + + if (stack.stackSize == 0) + { + setInventorySlotContents(slot, null); + } + } + else + { + setInventorySlotContents(slot, null); + } + + this.markDirty(); + } + return stack; + } + + @Override + public ItemStack getStackInSlotOnClosing(int slot) { + ItemStack stack = getStackInSlot(slot); + + if (stack != null) + { + setInventorySlotContents(slot, stack); + } + return stack; + } + + @Override + public void setInventorySlotContents(int slot, ItemStack itemstack) { + this.inventory[slot] = itemstack; + + if (itemstack != null && itemstack.stackSize > this.getInventoryStackLimit()) + { + itemstack.stackSize = this.getInventoryStackLimit(); + } + + this.markDirty(); + } + + @Override + public String getInventoryName() { + return name; + } + + @Override + public boolean hasCustomInventoryName() { + return name.length() > 0; + } + + @Override + public int getInventoryStackLimit() { + return 1; + } + + @Override + public boolean isUseableByPlayer(EntityPlayer p_70300_1_) { + return true; + } + + @Override + public void openInventory() { + + } + + @Override + public void closeInventory() { + + } + + @Override + public boolean isItemValidForSlot(int p_94041_1_, ItemStack p_94041_2_) { + return true; + } + + @Override + public void writeToNBT(NBTTagCompound compound) + { + super.writeToNBT(compound); + writeInventoryToNBT(compound); + } + + @Override + public void readFromNBT(NBTTagCompound compound) + { + super.readFromNBT(compound); + readInventoryFromNBT(compound); + } + + public void readInventoryFromNBT(NBTTagCompound tags) { + NBTTagList nbttaglist = tags.getTagList("Items", Constants.NBT.TAG_COMPOUND); + for (int iter = 0; iter < nbttaglist.tagCount(); iter++) { + NBTTagCompound tagList = (NBTTagCompound) nbttaglist.getCompoundTagAt(iter); + byte slotID = tagList.getByte("Slot"); + if (slotID >= 0 && slotID < inventory.length) { + inventory[slotID] = ItemStack.loadItemStackFromNBT(tagList); + } + } + } + + +public void writeInventoryToNBT(NBTTagCompound tags) { + NBTTagList nbttaglist = new NBTTagList(); + for (int iter = 0; iter < inventory.length; iter++) { + if (inventory[iter] != null) { + NBTTagCompound tagList = new NBTTagCompound(); + tagList.setByte("Slot", (byte) iter); + inventory[iter].writeToNBT(tagList); + nbttaglist.appendTag(tagList); + } + } + + tags.setTag("Items", nbttaglist); + } +} diff --git a/src/main/resources/assets/tinker/textures/items/heatershield/triangles_shield_effect.png b/src/main/resources/assets/tinker/textures/items/heatershield/legends_shield_effect.png Binary files differindex cd14f6a..cd14f6a 100644 --- a/src/main/resources/assets/tinker/textures/items/heatershield/triangles_shield_effect.png +++ b/src/main/resources/assets/tinker/textures/items/heatershield/legends_shield_effect.png diff --git a/src/main/resources/assets/tinkersdefense/daze_sword_effect.png b/src/main/resources/assets/tinkersdefense/daze_sword_effect.png Binary files differdeleted file mode 100644 index 2368f14..0000000 --- a/src/main/resources/assets/tinkersdefense/daze_sword_effect.png +++ /dev/null diff --git a/src/main/resources/assets/tinkersdefense/textures/guard.png b/src/main/resources/assets/tinkersdefense/textures/guard.png Binary files differnew file mode 100644 index 0000000..142e3a6 --- /dev/null +++ b/src/main/resources/assets/tinkersdefense/textures/guard.png diff --git a/src/main/resources/assets/tinkersdefense/textures/gui/finishinganvil.png b/src/main/resources/assets/tinkersdefense/textures/gui/finishinganvil.png Binary files differnew file mode 100644 index 0000000..4f2dfbe --- /dev/null +++ b/src/main/resources/assets/tinkersdefense/textures/gui/finishinganvil.png diff --git a/src/main/resources/assets/tinkersdefense/textures/items/AncientRelic.png b/src/main/resources/assets/tinkersdefense/textures/items/AncientRelic.png Binary files differnew file mode 100644 index 0000000..6476cfd --- /dev/null +++ b/src/main/resources/assets/tinkersdefense/textures/items/AncientRelic.png diff --git a/src/main/resources/assets/tinkersdefense/textures/items/broadsword/_smallguard.png b/src/main/resources/assets/tinkersdefense/textures/items/broadsword/_smallguard.png Binary files differnew file mode 100644 index 0000000..1039bf4 --- /dev/null +++ b/src/main/resources/assets/tinkersdefense/textures/items/broadsword/_smallguard.png diff --git a/src/main/resources/assets/tinkersdefense/textures/items/broadsword/queensgold_sword_accessory.png b/src/main/resources/assets/tinkersdefense/textures/items/broadsword/queensgold_sword_accessory.png Binary files differnew file mode 100644 index 0000000..142e3a6 --- /dev/null +++ b/src/main/resources/assets/tinkersdefense/textures/items/broadsword/queensgold_sword_accessory.png |
