Stack sensitive version of Item.getItemStackLimit. Closes #771
This commit is contained in:
parent
d3c80c326a
commit
96b4fd1da1
3 changed files with 43 additions and 5 deletions
|
@ -108,7 +108,7 @@ public class ChestGenHooks
|
||||||
{
|
{
|
||||||
ret = new ItemStack[0];
|
ret = new ItemStack[0];
|
||||||
}
|
}
|
||||||
else if (count > source.getItem().getItemStackLimit())
|
else if (count > source.getMaxStackSize())
|
||||||
{
|
{
|
||||||
ret = new ItemStack[count];
|
ret = new ItemStack[count];
|
||||||
for (int x = 0; x < count; x++)
|
for (int x = 0; x < count; x++)
|
||||||
|
|
|
@ -47,7 +47,15 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
itemsList[256 + par1] = this;
|
itemsList[256 + par1] = this;
|
||||||
@@ -606,6 +616,7 @@
|
@@ -334,6 +344,7 @@
|
||||||
|
/**
|
||||||
|
* Returns the maximum size of the stack for a specific item. *Isn't this more a Set than a Get?*
|
||||||
|
*/
|
||||||
|
+ @Deprecated
|
||||||
|
public int getItemStackLimit()
|
||||||
|
{
|
||||||
|
return this.maxStackSize;
|
||||||
|
@@ -606,6 +617,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
|
@ -55,7 +63,16 @@
|
||||||
public boolean hasEffect(ItemStack par1ItemStack)
|
public boolean hasEffect(ItemStack par1ItemStack)
|
||||||
{
|
{
|
||||||
return par1ItemStack.isItemEnchanted();
|
return par1ItemStack.isItemEnchanted();
|
||||||
@@ -635,7 +646,7 @@
|
@@ -626,7 +638,7 @@
|
||||||
|
*/
|
||||||
|
public boolean isItemTool(ItemStack par1ItemStack)
|
||||||
|
{
|
||||||
|
- return this.getItemStackLimit() == 1 && this.isDamageable();
|
||||||
|
+ return this.getItemStackLimit(par1ItemStack) == 1 && this.isDamageable();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected MovingObjectPosition getMovingObjectPositionFromPlayer(World par1World, EntityPlayer par2EntityPlayer, boolean par3)
|
||||||
|
@@ -635,7 +647,7 @@
|
||||||
float f1 = par2EntityPlayer.prevRotationPitch + (par2EntityPlayer.rotationPitch - par2EntityPlayer.prevRotationPitch) * f;
|
float f1 = par2EntityPlayer.prevRotationPitch + (par2EntityPlayer.rotationPitch - par2EntityPlayer.prevRotationPitch) * f;
|
||||||
float f2 = par2EntityPlayer.prevRotationYaw + (par2EntityPlayer.rotationYaw - par2EntityPlayer.prevRotationYaw) * f;
|
float f2 = par2EntityPlayer.prevRotationYaw + (par2EntityPlayer.rotationYaw - par2EntityPlayer.prevRotationYaw) * f;
|
||||||
double d0 = par2EntityPlayer.prevPosX + (par2EntityPlayer.posX - par2EntityPlayer.prevPosX) * (double)f;
|
double d0 = par2EntityPlayer.prevPosX + (par2EntityPlayer.posX - par2EntityPlayer.prevPosX) * (double)f;
|
||||||
|
@ -64,7 +81,7 @@
|
||||||
double d2 = par2EntityPlayer.prevPosZ + (par2EntityPlayer.posZ - par2EntityPlayer.prevPosZ) * (double)f;
|
double d2 = par2EntityPlayer.prevPosZ + (par2EntityPlayer.posZ - par2EntityPlayer.prevPosZ) * (double)f;
|
||||||
Vec3 vec3 = par1World.getWorldVec3Pool().getVecFromPool(d0, d1, d2);
|
Vec3 vec3 = par1World.getWorldVec3Pool().getVecFromPool(d0, d1, d2);
|
||||||
float f3 = MathHelper.cos(-f2 * 0.017453292F - (float)Math.PI);
|
float f3 = MathHelper.cos(-f2 * 0.017453292F - (float)Math.PI);
|
||||||
@@ -645,6 +656,10 @@
|
@@ -645,6 +657,10 @@
|
||||||
float f7 = f4 * f5;
|
float f7 = f4 * f5;
|
||||||
float f8 = f3 * f5;
|
float f8 = f3 * f5;
|
||||||
double d3 = 5.0D;
|
double d3 = 5.0D;
|
||||||
|
@ -75,7 +92,7 @@
|
||||||
Vec3 vec31 = vec3.addVector((double)f7 * d3, (double)f6 * d3, (double)f8 * d3);
|
Vec3 vec31 = vec3.addVector((double)f7 * d3, (double)f6 * d3, (double)f8 * d3);
|
||||||
return par1World.rayTraceBlocks_do_do(vec3, vec31, par3, !par3);
|
return par1World.rayTraceBlocks_do_do(vec3, vec31, par3, !par3);
|
||||||
}
|
}
|
||||||
@@ -753,4 +768,534 @@
|
@@ -753,4 +769,546 @@
|
||||||
{
|
{
|
||||||
StatList.initStats();
|
StatList.initStats();
|
||||||
}
|
}
|
||||||
|
@ -608,5 +625,17 @@
|
||||||
+ public boolean hasEffect(ItemStack par1ItemStack, int pass)
|
+ public boolean hasEffect(ItemStack par1ItemStack, int pass)
|
||||||
+ {
|
+ {
|
||||||
+ return hasEffect(par1ItemStack) && (pass == 0 || itemID != Item.potion.itemID);
|
+ return hasEffect(par1ItemStack) && (pass == 0 || itemID != Item.potion.itemID);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ /**
|
||||||
|
+ * Gets the maximum number of items that this stack should be able to hold.
|
||||||
|
+ * This is a ItemStack (and thus NBT) sensitive version of Item.getItemStackLimit()
|
||||||
|
+ *
|
||||||
|
+ * @param stack The ItemStack
|
||||||
|
+ * @return THe maximum number this item can be stacked to
|
||||||
|
+ */
|
||||||
|
+ public int getItemStackLimit(ItemStack stack)
|
||||||
|
+ {
|
||||||
|
+ return this.getItemStackLimit();
|
||||||
+ }
|
+ }
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,6 +8,15 @@
|
||||||
|
|
||||||
public final class ItemStack
|
public final class ItemStack
|
||||||
{
|
{
|
||||||
|
@@ -223,7 +224,7 @@
|
||||||
|
*/
|
||||||
|
public int getMaxStackSize()
|
||||||
|
{
|
||||||
|
- return this.getItem().getItemStackLimit();
|
||||||
|
+ return this.getItem().getItemStackLimit(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
@@ -252,7 +253,9 @@
|
@@ -252,7 +253,9 @@
|
||||||
*/
|
*/
|
||||||
public boolean isItemDamaged()
|
public boolean isItemDamaged()
|
||||||
|
|
Loading…
Reference in a new issue