mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-21 12:42:26 +00:00
118 lines
3.0 KiB
Diff
118 lines
3.0 KiB
Diff
--- ../src_base/minecraft/net/minecraft/item/ItemStack.java
|
|
+++ ../src_work/minecraft/net/minecraft/item/ItemStack.java
|
|
@@ -29,6 +29,7 @@
|
|
import net.minecraft.util.Icon;
|
|
import net.minecraft.util.StatCollector;
|
|
import net.minecraft.world.World;
|
|
+import net.minecraftforge.event.ForgeEventFactory;
|
|
|
|
public final class ItemStack
|
|
{
|
|
@@ -223,7 +224,7 @@
|
|
*/
|
|
public int getMaxStackSize()
|
|
{
|
|
- return this.getItem().getItemStackLimit();
|
|
+ return this.getItem().getItemStackLimit(this);
|
|
}
|
|
|
|
/**
|
|
@@ -252,7 +253,9 @@
|
|
*/
|
|
public boolean isItemDamaged()
|
|
{
|
|
- return this.isItemStackDamageable() && this.itemDamage > 0;
|
|
+ boolean damaged = itemDamage > 0;
|
|
+ if (getItem() != null) damaged = getItem().isDamaged(this);
|
|
+ return this.isItemStackDamageable() && damaged;
|
|
}
|
|
|
|
/**
|
|
@@ -260,6 +263,10 @@
|
|
*/
|
|
public int getItemDamageForDisplay()
|
|
{
|
|
+ if (getItem() != null)
|
|
+ {
|
|
+ return getItem().getDisplayDamage(this);
|
|
+ }
|
|
return this.itemDamage;
|
|
}
|
|
|
|
@@ -268,6 +275,10 @@
|
|
*/
|
|
public int getItemDamage()
|
|
{
|
|
+ if (getItem() != null)
|
|
+ {
|
|
+ return getItem().getDamage(this);
|
|
+ }
|
|
return this.itemDamage;
|
|
}
|
|
|
|
@@ -276,6 +287,12 @@
|
|
*/
|
|
public void setItemDamage(int par1)
|
|
{
|
|
+ if (getItem() != null)
|
|
+ {
|
|
+ getItem().setDamage(this, par1);
|
|
+ return;
|
|
+ }
|
|
+
|
|
this.itemDamage = par1;
|
|
|
|
if (this.itemDamage < 0)
|
|
@@ -289,7 +306,7 @@
|
|
*/
|
|
public int getMaxDamage()
|
|
{
|
|
- return Item.itemsList[this.itemID].getMaxDamage();
|
|
+ return this.getItem().getMaxDamage(this);
|
|
}
|
|
|
|
/**
|
|
@@ -327,8 +344,8 @@
|
|
}
|
|
}
|
|
|
|
- this.itemDamage += par1;
|
|
- return this.itemDamage > this.getMaxDamage();
|
|
+ setItemDamage(getItemDamage() + par1); //Redirect through Item's callback if applicable.
|
|
+ return getItemDamage() > getMaxDamage();
|
|
}
|
|
}
|
|
|
|
@@ -396,7 +413,7 @@
|
|
*/
|
|
public boolean canHarvestBlock(Block par1Block)
|
|
{
|
|
- return Item.itemsList[this.itemID].canHarvestBlock(par1Block);
|
|
+ return Item.itemsList[this.itemID].canHarvestBlock(par1Block, this);
|
|
}
|
|
|
|
public boolean func_111282_a(EntityPlayer par1EntityPlayer, EntityLivingBase par2EntityLivingBase)
|
|
@@ -733,14 +750,21 @@
|
|
{
|
|
arraylist.add("Durability: " + (this.getMaxDamage() - this.getItemDamageForDisplay()) + " / " + this.getMaxDamage());
|
|
}
|
|
+ ForgeEventFactory.onItemTooltip(this, par1EntityPlayer, arraylist, par2);
|
|
|
|
return arraylist;
|
|
}
|
|
|
|
+ @Deprecated
|
|
@SideOnly(Side.CLIENT)
|
|
public boolean hasEffect()
|
|
{
|
|
- return this.getItem().hasEffect(this);
|
|
+ return hasEffect(0);
|
|
+ }
|
|
+ @SideOnly(Side.CLIENT)
|
|
+ public boolean hasEffect(int pass)
|
|
+ {
|
|
+ return this.getItem().hasEffect(this, pass);
|
|
}
|
|
|
|
@SideOnly(Side.CLIENT)
|