ForgePatch/forge/patches/minecraft_server/net/minecraft/src/Item.java.patch

57 lines
1.6 KiB
Diff
Raw Normal View History

--- ../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
@@ -175,6 +175,9 @@
private String field_39006_bR;
private String itemName;
+ // FORGE: To disable repair recipes.
+ protected boolean canRepair=true;
+
protected Item(int i)
{
maxStackSize = 64;
@@ -219,6 +222,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 +276,29 @@
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;
+ }
+
public boolean hitEntity(ItemStack itemstack, EntityLiving entityliving, EntityLiving entityliving1)
{
return false;