--- ../src_base/minecraft_server/net/minecraft/src/Item.java 0000-00-00 00:00:00.000000000 -0000 +++ ../src_work/minecraft_server/net/minecraft/src/Item.java 0000-00-00 00:00:00.000000000 -0000 @@ -5,6 +5,7 @@ package net.minecraft.src; import java.io.PrintStream; +import java.util.ArrayList; import java.util.Random; // Referenced classes of package net.minecraft.src: @@ -175,6 +176,9 @@ private String potionInfo; private String itemName; + // FORGE: To disable repair recipes. + protected boolean canRepair=true; + protected Item(int i) { maxStackSize = 64; @@ -209,6 +213,14 @@ return this; } + /* FORGE: This is called when the item is used, before the block is + * activated. Return true to prevent any further processing. + */ + public boolean onItemUseFirst(ItemStack ist, EntityPlayer player, + World world, int i, int j, int k, int l) { + return false; + } + public boolean onItemUse(ItemStack itemstack, EntityPlayer entityplayer, World world, int i, int j, int k, int l) { return false; @@ -219,6 +231,13 @@ return 1.0F; } + /* FORGE: Metadata-sensitive version of getStrVsBlock + */ + public float getStrVsBlock(ItemStack itemstack, Block block, int md) + { + return getStrVsBlock(itemstack,block); + } + public ItemStack onItemRightClick(ItemStack itemstack, World world, EntityPlayer entityplayer) { return itemstack; @@ -266,6 +285,34 @@ return maxDamage > 0 && !hasSubtypes; } + /* FORGE: Called by CraftingManager to determine if an item is repairable. + */ + public boolean isRepairable() { + return canRepair && isDamageable(); + } + + /* FORGE: Call to disable repair recipes. + */ + public Item setNoRepair() { + canRepair=false; + return this; + } + + /* FORGE: Called before a block is broken. Return true to prevent default + * block harvesting. + * + * Note: In SMP, this is called on both client and server sides! + */ + public boolean onBlockStartBreak(ItemStack itemstack, int i, int j, int k, + EntityPlayer player) { + return false; + } + + /* FORGE: Called each tick while using an item. + */ + public void onUsingItemTick(ItemStack ist, EntityPlayer player, int count) { + } + public boolean hitEntity(ItemStack itemstack, EntityLiving entityliving, EntityLiving entityliving1) { return false; @@ -414,6 +461,26 @@ return 0; } + /* FORGE: This is not called by the server, but declared here for compatibility + */ + public void addCreativeItems(ArrayList itemList) + { + } + + /** + * Called when a player drops the item into the world, + * returning false from this will prevent the item from + * being removed from the players inventory and spawning + * in the world + * + * @param player The player that dropped the item + * @param item The item stack, before the item is removed. + */ + public boolean onDroppedByPlayer(ItemStack item, EntityPlayer player) + { + return true; + } + static { shovelSteel = (new ItemSpade(0, EnumToolMaterial.IRON)).setIconCoord(2, 5).setItemName("shovelIron");