diff options
| author | OnyxDarkKnight <sor1n.iliutza16@gmail.com> | 2013-12-21 12:58:12 +0200 |
|---|---|---|
| committer | OnyxDarkKnight <sor1n.iliutza16@gmail.com> | 2013-12-21 12:58:12 +0200 |
| commit | 4d44f0da49a8676fe557ba5da9022428a6b6f061 (patch) | |
| tree | 7ef3a610ef60fcb5b63ac72962da6af27b8005ed /common | |
| parent | 401d313409ca088156f5e7658cdb744a9d2d2cb7 (diff) | |
Added new messages, added the timers to the config file, changed the config file a bit, fixed the molds not dropping correctly
Diffstat (limited to 'common')
5 files changed, 56 insertions, 39 deletions
diff --git a/common/darkknight/jewelrycraft/block/BlockJewelrsCraftingTable.java b/common/darkknight/jewelrycraft/block/BlockJewelrsCraftingTable.java index 4f327ff..30daab2 100644 --- a/common/darkknight/jewelrycraft/block/BlockJewelrsCraftingTable.java +++ b/common/darkknight/jewelrycraft/block/BlockJewelrsCraftingTable.java @@ -13,8 +13,10 @@ import net.minecraft.item.ItemStack; import net.minecraft.potion.Potion; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.MathHelper; +import net.minecraft.util.StatCollector; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; +import darkknight.jewelrycraft.config.ConfigHandler; import darkknight.jewelrycraft.item.ItemList; import darkknight.jewelrycraft.item.ItemRing; import darkknight.jewelrycraft.tileentity.TileEntityJewelrsCraftingTable; @@ -55,7 +57,7 @@ public class BlockJewelrsCraftingTable extends BlockContainer { te.jewel = item.copy(); te.hasJewel = true; - --item.stackSize; + if (!entityPlayer.capabilities.isCreativeMode) --item.stackSize; entityPlayer.inventory.onInventoryChanged(); } if (!te.hasEndItem && !te.hasModifier && item != null && item.getItem().itemID == modifiers[0]) @@ -63,10 +65,10 @@ public class BlockJewelrsCraftingTable extends BlockContainer te.modifier = item.copy(); te.modifier.stackSize = 1; te.hasModifier = true; - --item.stackSize; + if (!entityPlayer.capabilities.isCreativeMode) --item.stackSize; entityPlayer.inventory.onInventoryChanged(); } - if(te.hasEndItem && item != null) entityPlayer.addChatMessage("First take out the crafted jewel before inserting new stuff."); + if(te.hasEndItem && item != null) entityPlayer.addChatMessage(StatCollector.translateToLocal("chatmessage.jewelrycraft.table.hasenditem")); if (te.hasModifier && entityPlayer.isSneaking()) { @@ -135,13 +137,15 @@ public class BlockJewelrsCraftingTable extends BlockContainer te.endItem = new ItemStack(0, 0, 0); te.hasEndItem = false; } - else if (!te.hasModifier && !te.hasJewel && !world.isRemote) - player.addChatMessage("You need a ring and a modifier"); - else if (!te.hasJewel && !world.isRemote) - player.addChatMessage("You're missing a ring"); - else if (!te.hasModifier && !world.isRemote) - player.addChatMessage("You need a modifier"); - te.timer = 2000; + else if (te.hasJewel && te.hasModifier && te.timer > 0 && te.jewel != null) + player.addChatMessage(StatCollector.translateToLocalFormatted("chatmessage.jewelrycraft.table.iscrafting", te.jewel.getDisplayName()) + " (" + ((ConfigHandler.jewelryCraftingTime - te.timer)*100/ConfigHandler.jewelryCraftingTime) + "%)"); + else if (!te.hasModifier && !te.hasJewel) + player.addChatMessage(StatCollector.translateToLocal("chatmessage.jewelrycraft.table.missingjewelryandmodifier")); + else if (!te.hasJewel) + player.addChatMessage(StatCollector.translateToLocal("chatmessage.jewelrycraft.table.misingjewelry")); + else if (!te.hasModifier) + player.addChatMessage(StatCollector.translateToLocal("chatmessage.jewelrycraft.table.missingmodifier")); + if(te.timer == 0 && !te.hasEndItem) te.timer = ConfigHandler.jewelryCraftingTime; te.isDirty = true; } } diff --git a/common/darkknight/jewelrycraft/block/BlockMolder.java b/common/darkknight/jewelrycraft/block/BlockMolder.java index a58323b..22fca62 100644 --- a/common/darkknight/jewelrycraft/block/BlockMolder.java +++ b/common/darkknight/jewelrycraft/block/BlockMolder.java @@ -43,21 +43,23 @@ public class BlockMolder extends BlockContainer { TileEntityMolder te = (TileEntityMolder) world.getBlockTileEntity(i, j, k); ItemStack item = entityPlayer.inventory.getCurrentItem(); - if (te != null && item != null && !te.hasMold && item.itemID == ItemList.molds.itemID && !world.isRemote) + if (te != null && !world.isRemote) { - te.mold = item; - te.hasMold = true; - --item.stackSize; - if (world.isRemote) + if(item != null && !te.hasMold && item.itemID == ItemList.molds.itemID) + { + te.mold = item.copy(); + te.hasMold = true; + if (!entityPlayer.capabilities.isCreativeMode) --item.stackSize; entityPlayer.addChatMessage(StatCollector.translateToLocalFormatted("chatmessage.jewelrycraft.molder.addedmold", te.mold.getDisplayName())); - te.isDirty = true; - } - if (te.hasMold && entityPlayer.isSneaking() && !world.isRemote) - { - dropItem(world, (double)te.xCoord, (double)te.yCoord, (double)te.zCoord, te.mold); - te.mold = new ItemStack(0, 0, 0); - te.hasMold = false; - te.isDirty = true; + te.isDirty = true; + } + if (te.hasMold && entityPlayer.isSneaking()) + { + dropItem(world, (double)te.xCoord, (double)te.yCoord, (double)te.zCoord, te.mold); + te.mold = new ItemStack(0, 0, 0); + te.hasMold = false; + te.isDirty = true; + } } return true; } @@ -70,7 +72,7 @@ public class BlockMolder extends BlockContainer entityitem.motionY = 0.11000000298023224D; world.spawnEntityInWorld(entityitem); } - + public void breakBlock(World world, int i, int j, int k, int par5, int par6) { TileEntityMolder te = (TileEntityMolder) world.getBlockTileEntity(i, j, k); diff --git a/common/darkknight/jewelrycraft/block/BlockSmelter.java b/common/darkknight/jewelrycraft/block/BlockSmelter.java index f58812b..2f90b34 100644 --- a/common/darkknight/jewelrycraft/block/BlockSmelter.java +++ b/common/darkknight/jewelrycraft/block/BlockSmelter.java @@ -14,6 +14,7 @@ import net.minecraft.util.MathHelper; import net.minecraft.util.StatCollector; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; +import darkknight.jewelrycraft.config.ConfigHandler; import darkknight.jewelrycraft.tileentity.TileEntityMolder; import darkknight.jewelrycraft.tileentity.TileEntitySmelter; @@ -64,10 +65,11 @@ public class BlockSmelter extends BlockContainer if (!te.hasMetal && !te.hasMoltenMetal && item != null && item.getUnlocalizedName().toLowerCase().contains("ingot") && !item.getDisplayName().contains("Mold")) { entityPlayer.addChatMessage(StatCollector.translateToLocalFormatted("chatmessage.jewelrycraft.smelter.nowsmeltingingot", item.getDisplayName())); - te.metal = new ItemStack(item.itemID, 1, item.getItemDamage()); + te.metal = item.copy(); + te.metal.stackSize = 1; te.hasMetal = true; - te.melting = 1500; - --item.stackSize; + te.melting = ConfigHandler.ingotSmeltingTime; + if (!entityPlayer.capabilities.isCreativeMode) --item.stackSize; } else if (te.hasMetal && !te.hasMoltenMetal && item != null && item.getDisplayName().contains("Ingot") && !item.getDisplayName().contains("Mold")) entityPlayer.addChatMessage(StatCollector.translateToLocalFormatted("chatmessage.jewelrycraft.smelter.alreadyhasingot", te.metal.getDisplayName())); @@ -109,7 +111,7 @@ public class BlockSmelter extends BlockContainer { me.moltenMetal = te.moltenMetal; me.hasMoltenMetal = true; - me.cooling = 200; + me.cooling = ConfigHandler.ingotCoolingTime; te.moltenMetal = new ItemStack(0, 0, 0); te.hasMoltenMetal = false; me.isDirty = true; diff --git a/common/darkknight/jewelrycraft/config/ConfigHandler.java b/common/darkknight/jewelrycraft/config/ConfigHandler.java index 9ebfb94..a9b3923 100644 --- a/common/darkknight/jewelrycraft/config/ConfigHandler.java +++ b/common/darkknight/jewelrycraft/config/ConfigHandler.java @@ -17,6 +17,10 @@ public class ConfigHandler public static int idMolder = 1752; public static int idJewelCraftingTable = 1753; + public static int ingotCoolingTime = 200; + public static int ingotSmeltingTime = 1500; + public static int jewelryCraftingTime = 2000; + private static boolean isInitialized = false; public static void preInit(FMLPreInitializationEvent e) @@ -27,15 +31,20 @@ public class ConfigHandler config.load(); - idThiefGloves = config.getItem("id.ThiefGloves", idThiefGloves).getInt(); - idShadowIngot = config.getItem("id.ShadowIngot", idShadowIngot).getInt(); - idMolds = config.getItem("id.Molds", idMolds).getInt(); - idClayMolds = config.getItem("id.ClayMolds", idClayMolds).getInt(); - idRing = config.getItem("id.Ring", idRing).getInt(); - idShadowOre = config.getBlock("id.ShadowOre", idShadowOre).getInt(); - idSmelter = config.getBlock("id.Smelter", idSmelter).getInt(); - idMolder = config.getBlock("id.Molder", idMolder).getInt(); - idJewelCraftingTable = config.getBlock("id.JewelCraftingTable", idJewelCraftingTable).getInt(); + idThiefGloves = config.getItem("Thief Gloves", idThiefGloves).getInt(); + idShadowIngot = config.getItem("Shadow Ingot", idShadowIngot).getInt(); + idMolds = config.getItem("Molds", idMolds).getInt(); + idClayMolds = config.getItem("Clay Molds", idClayMolds).getInt(); + idRing = config.getItem("Ring", idRing).getInt(); + + idShadowOre = config.getBlock("Shadow Ore", idShadowOre).getInt(); + idSmelter = config.getBlock("Smelter", idSmelter).getInt(); + idMolder = config.getBlock("Molder", idMolder).getInt(); + idJewelCraftingTable = config.getBlock("Jeweler's Crafting Table", idJewelCraftingTable).getInt(); + + ingotCoolingTime = config.get("timers", "Molder Ingot Cooling Time", ingotCoolingTime).getInt(); + ingotSmeltingTime = config.get("timers", "Ingot Smelting Time", ingotSmeltingTime).getInt(); + jewelryCraftingTime = config.get("timers", "Jewelry Crafting Time", jewelryCraftingTime).getInt(); config.save(); diff --git a/common/darkknight/jewelrycraft/tileentity/TileEntityJewelrsCraftingTable.java b/common/darkknight/jewelrycraft/tileentity/TileEntityJewelrsCraftingTable.java index 920aef9..2242804 100644 --- a/common/darkknight/jewelrycraft/tileentity/TileEntityJewelrsCraftingTable.java +++ b/common/darkknight/jewelrycraft/tileentity/TileEntityJewelrsCraftingTable.java @@ -87,9 +87,9 @@ public class TileEntityJewelrsCraftingTable extends TileEntity this.hasEndItem = true; this.endItem = jewel.copy(); this.hasJewel = false; - this.jewel = new ItemStack(0, 0, 0); + this.jewel = new ItemStack(0, 0, 0); this.hasModifier = false; - this.modifier = new ItemStack(0, 0, 0); + this.modifier = new ItemStack(0, 0, 0); } } } |
