Files
MinecraftForge/forge/patches/minecraft/net/minecraft/src/Item.java.patch
T

118 lines
3.4 KiB
Diff

--- ../src_base/minecraft/net/minecraft/src/Item.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft/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.List;
import java.util.Random;
@@ -177,6 +178,9 @@
private String potionModifier;
private String itemName;
+ // FORGE: To disable repair recipes.
+ protected boolean canRepair=true;
+
protected Item(int i)
{
maxStackSize = 64;
@@ -221,6 +225,14 @@
return getIconFromDamage(itemstack.getItemDamage());
}
+ /* 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;
@@ -231,6 +243,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;
@@ -278,6 +297,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;
@@ -473,6 +520,32 @@
{
return 0;
}
+
+ /* FORGE: Called when a new CreativeContainer is opened, populate the list
+ * with all of the items for this item you want a player in creative mode
+ * to have access to.
+ */
+ public void addCreativeItems(ArrayList itemList)
+ {
+ if (this.shiftedIndex != Item.potion.shiftedIndex)
+ {
+ itemList.add(new ItemStack(this, 1));
+ }
+ }
+
+ /**
+ * 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
{