From 4d44f0da49a8676fe557ba5da9022428a6b6f061 Mon Sep 17 00:00:00 2001 From: OnyxDarkKnight Date: Sat, 21 Dec 2013 12:58:12 +0200 Subject: Added new messages, added the timers to the config file, changed the config file a bit, fixed the molds not dropping correctly --- .../block/BlockJewelrsCraftingTable.java | 24 +++++++++-------- .../darkknight/jewelrycraft/block/BlockMolder.java | 30 ++++++++++++---------- .../jewelrycraft/block/BlockSmelter.java | 10 +++++--- 3 files changed, 36 insertions(+), 28 deletions(-) (limited to 'common/darkknight/jewelrycraft/block') 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; -- cgit v1.2.3