fix itemstack sizes
This commit is contained in:
parent
4e94a660ff
commit
c376d92790
111 changed files with 983 additions and 1353 deletions
|
@ -176,9 +176,9 @@ public class EntityAIControlledByPlayer extends EntityAIBase
|
|||
|
||||
if (itemstack != null && itemstack.getItem() == Items.carrot_on_a_stick)
|
||||
{
|
||||
itemstack.damageItem(1, entityplayer);
|
||||
itemstack.damage(1, entityplayer);
|
||||
|
||||
if (itemstack.size == 0)
|
||||
if (itemstack.isEmpty())
|
||||
{
|
||||
ItemStack itemstack1 = new ItemStack(Items.fishing_rod);
|
||||
itemstack1.copyData(itemstack);
|
||||
|
|
|
@ -60,21 +60,21 @@ public class EntityAIShareItems extends EntityAIWatchClosest2
|
|||
{
|
||||
Item item = itemstack.getItem();
|
||||
|
||||
if ((item == Items.bread || item == Items.potato || item == Items.carrot) && itemstack.size > 3)
|
||||
if ((item == Items.bread || item == Items.potato || item == Items.carrot) && itemstack.getSize() > 3)
|
||||
{
|
||||
int l = itemstack.size / 2;
|
||||
itemstack.size -= l;
|
||||
int l = itemstack.getSize() / 2;
|
||||
itemstack.decrSize(l);
|
||||
itemstack1 = new ItemStack(item, l);
|
||||
}
|
||||
else if (item == Items.wheats && itemstack.size > 5)
|
||||
else if (item == Items.wheats && itemstack.getSize() > 5)
|
||||
{
|
||||
int j = itemstack.size / 2 / 3 * 3;
|
||||
int j = itemstack.getSize() / 2 / 3 * 3;
|
||||
int k = j / 3;
|
||||
itemstack.size -= j;
|
||||
itemstack.decrSize(j);
|
||||
itemstack1 = new ItemStack(Items.bread, k);
|
||||
}
|
||||
|
||||
if (itemstack.size <= 0)
|
||||
if (itemstack.isEmpty())
|
||||
{
|
||||
inventorybasic.setInventorySlotContents(i, (ItemStack)null);
|
||||
}
|
||||
|
|
|
@ -84,8 +84,7 @@ public class EntityAITakePlace extends EntityAIBase
|
|||
(float)this.entity.getVerticalFaceSpeed());
|
||||
this.entity.swingItem();
|
||||
world.setState(blockpos, state, 3);
|
||||
--stack.size;
|
||||
if(stack.size <= 0)
|
||||
if(stack.decrSize())
|
||||
this.entity.setItemNoUpdate(0, null);
|
||||
}
|
||||
}
|
||||
|
@ -94,14 +93,14 @@ public class EntityAITakePlace extends EntityAIBase
|
|||
Block block = state.getBlock();
|
||||
|
||||
if (STEALABLE.containsKey(state) &&
|
||||
(this.entity.getHeldItem() == null || (STEALABLE.get(state) == this.entity.getHeldItem().getItem() && this.entity.getHeldItem().size < this.entity.getHeldItem().getMaxStackSize())))
|
||||
(this.entity.getHeldItem() == null || (STEALABLE.get(state) == this.entity.getHeldItem().getItem() && !this.entity.getHeldItem().isFull())))
|
||||
{
|
||||
this.entity.getLookHelper().setLookPosition((double)i + 0.5, (double)j + 0.5, (double)k + 0.5, 10.0F,
|
||||
(float)this.entity.getVerticalFaceSpeed());
|
||||
this.entity.swingItem();
|
||||
world.setState(blockpos, Blocks.air.getState());
|
||||
if(this.entity.getHeldItem() != null)
|
||||
++this.entity.getHeldItem().size;
|
||||
this.entity.getHeldItem().incrSize();
|
||||
else
|
||||
this.entity.setItemNoUpdate(0, new ItemStack(STEALABLE.get(state)));
|
||||
}
|
||||
|
|
|
@ -163,7 +163,7 @@ public class BlockFlowerPot extends Block
|
|||
// worldIn.markBlockForUpdate(pos);
|
||||
// playerIn.triggerAchievement(StatRegistry.flowerPottedStat);
|
||||
|
||||
if (/* !playerIn.creative && */ --itemstack.size <= 0)
|
||||
if (itemstack.decrSize())
|
||||
{
|
||||
playerIn.inventory.setInventorySlotContents(playerIn.inventory.currentItem, (ItemStack)null);
|
||||
}
|
||||
|
|
|
@ -59,7 +59,7 @@ public class BlockOre extends Block
|
|||
|
||||
public int quantityDropped(Random random)
|
||||
{
|
||||
return this.dropItem == null ? 1 : (this.dropItem.size + (this.dropChance > 0 ? random.zrange(this.dropChance + 1) : 0));
|
||||
return this.dropItem == null ? 1 : (this.dropItem.getSize() + (this.dropChance > 0 ? random.zrange(this.dropChance + 1) : 0));
|
||||
// this == Blocks.lapis_ore ? 4 + random.nextInt(5) : 1;
|
||||
}
|
||||
|
||||
|
|
|
@ -522,9 +522,8 @@ public class BlockCauldron extends Block
|
|||
}
|
||||
|
||||
// playerIn.triggerAchievement(StatRegistry.cauldronUsedStat);
|
||||
--itemstack.size;
|
||||
|
||||
if (itemstack.size <= 0)
|
||||
if (itemstack.decrSize())
|
||||
{
|
||||
playerIn.inventory.setInventorySlotContents(playerIn.inventory.currentItem, (ItemStack)null);
|
||||
}
|
||||
|
|
|
@ -143,7 +143,7 @@ public class BlockDispenser extends BlockContainer implements Directional
|
|||
ItemStack itemstack = tileentitydispenser.getStackInSlot(i);
|
||||
if(itemstack != null) {
|
||||
ItemStack itemstack1 = this.dispenseStack(itemstack, worldIn, pos);
|
||||
tileentitydispenser.setInventorySlotContents(i, itemstack1.size <= 0 ? null : itemstack1);
|
||||
tileentitydispenser.setInventorySlotContents(i, itemstack1.isEmpty() ? null : itemstack1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,7 +15,7 @@ public class BlockDropper extends BlockDispenser
|
|||
protected ItemStack dispenseStack(ItemStack stack, World world, BlockPos pos)
|
||||
{
|
||||
Facing facing = world.getState(pos).getValue(FACING);
|
||||
dispense(world, 6.0, facing, getDispensePosition(pos, facing), stack.splitStack(1));
|
||||
dispense(world, 6.0, facing, getDispensePosition(pos, facing), stack.split(1));
|
||||
world.playAuxSFX(1000, pos, 0);
|
||||
world.playAuxSFX(2000, pos, facing.getFrontOffsetX() + 1 + (facing.getFrontOffsetZ() + 1) * 3);
|
||||
return stack;
|
||||
|
@ -56,20 +56,20 @@ public class BlockDropper extends BlockDispenser
|
|||
{
|
||||
itemstack1 = this.dispenseStack(itemstack, worldIn, pos);
|
||||
|
||||
if (itemstack1 != null && itemstack1.size <= 0)
|
||||
if (itemstack1 != null && itemstack1.isEmpty())
|
||||
{
|
||||
itemstack1 = null;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
itemstack1 = TileEntityHopper.putStackInInventoryAllSlots(iinventory, itemstack.copy().splitStack(1), enumfacing.getOpposite());
|
||||
itemstack1 = TileEntityHopper.putStackInInventoryAllSlots(iinventory, itemstack.copy().split(1), enumfacing.getOpposite());
|
||||
|
||||
if (itemstack1 == null)
|
||||
{
|
||||
itemstack1 = itemstack.copy();
|
||||
|
||||
if (--itemstack1.size <= 0)
|
||||
if (itemstack1.decrSize())
|
||||
{
|
||||
itemstack1 = null;
|
||||
}
|
||||
|
|
|
@ -119,11 +119,11 @@ public class BlockTNT extends Block
|
|||
|
||||
if (item == Items.flint_and_steel)
|
||||
{
|
||||
playerIn.getCurrentEquippedItem().damageItem(1, playerIn);
|
||||
playerIn.getCurrentEquippedItem().damage(1, playerIn);
|
||||
}
|
||||
else // if (!playerIn.creative)
|
||||
{
|
||||
--playerIn.getCurrentEquippedItem().size;
|
||||
playerIn.getCurrentEquippedItem().decrSize();
|
||||
}
|
||||
|
||||
return true;
|
||||
|
|
|
@ -198,12 +198,12 @@ public enum Enchantment implements Displayable, Identifyable
|
|||
|
||||
if (itemstack != null)
|
||||
{
|
||||
itemstack.damageItem(3, user);
|
||||
itemstack.damage(3, user);
|
||||
}
|
||||
}
|
||||
else if (itemstack != null)
|
||||
{
|
||||
itemstack.damageItem(1, user);
|
||||
itemstack.damage(1, user);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
|
@ -1638,7 +1638,7 @@ public abstract class Entity
|
|||
*/
|
||||
public EntityItem entityDropItem(ItemStack itemStackIn, float offsetY)
|
||||
{
|
||||
if (itemStackIn.size != 0 && itemStackIn.getItem() != null)
|
||||
if (!itemStackIn.isEmpty() && itemStackIn.getItem() != null)
|
||||
{
|
||||
EntityItem entityitem = new EntityItem(this.worldObj, this.posX, this.posY + (double)offsetY, this.posZ, itemStackIn);
|
||||
entityitem.setDefaultPickupDelay();
|
||||
|
|
|
@ -124,7 +124,7 @@ public class EntityCow extends EntityAnimal
|
|||
|
||||
if (itemstack != null && itemstack.getItem() == Items.bucket /* && !player.creative */ && !this.isChild())
|
||||
{
|
||||
if (itemstack.size-- == 1)
|
||||
if (itemstack.decrSize())
|
||||
{
|
||||
player.inventory.setInventorySlotContents(player.inventory.currentItem, new ItemStack(Items.milk_bucket));
|
||||
}
|
||||
|
|
|
@ -935,7 +935,7 @@ public class EntityHorse extends EntityAnimal implements IInvBasic
|
|||
|
||||
if (!this.isTame() && !flag)
|
||||
{
|
||||
if (itemstack != null && itemstack.interactWithEntity(player, this))
|
||||
if (itemstack != null && itemstack.getItem().itemInteractionForEntity(itemstack, player, this))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
@ -960,7 +960,7 @@ public class EntityHorse extends EntityAnimal implements IInvBasic
|
|||
|
||||
if (flag)
|
||||
{
|
||||
if (/* !player.creative && */ --itemstack.size == 0)
|
||||
if (itemstack.decrSize())
|
||||
{
|
||||
player.inventory.setInventorySlotContents(player.inventory.currentItem, (ItemStack)null);
|
||||
}
|
||||
|
@ -971,7 +971,7 @@ public class EntityHorse extends EntityAnimal implements IInvBasic
|
|||
|
||||
if (this.func_110253_bW() && this.passenger == null)
|
||||
{
|
||||
if (itemstack != null && itemstack.interactWithEntity(player, this))
|
||||
if (itemstack != null && itemstack.getItem().itemInteractionForEntity(itemstack, player, this))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -30,7 +30,7 @@ public class EntityMooshroom extends EntityCow
|
|||
|
||||
if (itemstack != null && itemstack.getItem() == Items.bowl && !this.isChild())
|
||||
{
|
||||
if (itemstack.size == 1)
|
||||
if (itemstack.getSize() == 1)
|
||||
{
|
||||
player.inventory.setInventorySlotContents(player.inventory.currentItem, new ItemStack(Items.mushroom_stew));
|
||||
return true;
|
||||
|
@ -67,7 +67,7 @@ public class EntityMooshroom extends EntityCow
|
|||
this.worldObj.spawnEntityInWorld(new EntityItem(this.worldObj, this.posX, this.posY + (double)this.height, this.posZ, new ItemStack(Items.red_mushroom)));
|
||||
}
|
||||
|
||||
itemstack.damageItem(1, player);
|
||||
itemstack.damage(1, player);
|
||||
this.playSound(SoundEvent.CUT, 1.0F);
|
||||
}
|
||||
|
||||
|
|
|
@ -219,12 +219,7 @@ public class EntityOcelot extends EntityTameable
|
|||
}
|
||||
else if (this.aiTempt.isRunning() && itemstack != null && itemstack.getItem() instanceof ItemFishFood fish && !fish.isCooked() && player.getDistanceSqToEntity(this) < 9.0D)
|
||||
{
|
||||
// if (!player.creative)
|
||||
// {
|
||||
--itemstack.size;
|
||||
// }
|
||||
|
||||
if (itemstack.size <= 0)
|
||||
if (itemstack.decrSize())
|
||||
{
|
||||
player.inventory.setInventorySlotContents(player.inventory.currentItem, (ItemStack)null);
|
||||
}
|
||||
|
|
|
@ -199,7 +199,7 @@ public class EntitySheep extends EntityAnimal
|
|||
}
|
||||
}
|
||||
|
||||
itemstack.damageItem(1, player);
|
||||
itemstack.damage(1, player);
|
||||
this.playSound(SoundEvent.CUT, 1.0F);
|
||||
}
|
||||
|
||||
|
|
|
@ -360,14 +360,9 @@ public class EntityWolf extends EntityTameable
|
|||
|
||||
if (itemfood.isWolfsFavoriteMeat() && this.dataWatcher.getWatchableObjectInt(18) < 20)
|
||||
{
|
||||
// if (!player.creative)
|
||||
// {
|
||||
--itemstack.size;
|
||||
// }
|
||||
|
||||
this.heal(itemfood.getHealAmount(itemstack));
|
||||
|
||||
if (itemstack.size <= 0)
|
||||
if (itemstack.decrSize())
|
||||
{
|
||||
player.inventory.setInventorySlotContents(player.inventory.currentItem, (ItemStack)null);
|
||||
}
|
||||
|
@ -383,7 +378,7 @@ public class EntityWolf extends EntityTameable
|
|||
{
|
||||
this.setCollarColor(enumdyecolor);
|
||||
|
||||
if (/* !player.creative && */ --itemstack.size <= 0)
|
||||
if (itemstack.decrSize())
|
||||
{
|
||||
player.inventory.setInventorySlotContents(player.inventory.currentItem, (ItemStack)null);
|
||||
}
|
||||
|
@ -403,12 +398,7 @@ public class EntityWolf extends EntityTameable
|
|||
}
|
||||
else if (itemstack != null && itemstack.getItem() == Items.bone && !this.isAngry())
|
||||
{
|
||||
// if (!player.creative)
|
||||
// {
|
||||
--itemstack.size;
|
||||
// }
|
||||
|
||||
if (itemstack.size <= 0)
|
||||
if (itemstack.decrSize())
|
||||
{
|
||||
player.inventory.setInventorySlotContents(player.inventory.currentItem, (ItemStack)null);
|
||||
}
|
||||
|
|
|
@ -62,7 +62,7 @@ public abstract class EntityCartContainer extends EntityCart implements ILockabl
|
|||
{
|
||||
if (this.minecartContainerItems[index] != null)
|
||||
{
|
||||
if (this.minecartContainerItems[index].size <= count)
|
||||
if (this.minecartContainerItems[index].getSize() <= count)
|
||||
{
|
||||
ItemStack itemstack1 = this.minecartContainerItems[index];
|
||||
this.minecartContainerItems[index] = null;
|
||||
|
@ -70,9 +70,9 @@ public abstract class EntityCartContainer extends EntityCart implements ILockabl
|
|||
}
|
||||
else
|
||||
{
|
||||
ItemStack itemstack = this.minecartContainerItems[index].splitStack(count);
|
||||
ItemStack itemstack = this.minecartContainerItems[index].split(count);
|
||||
|
||||
if (this.minecartContainerItems[index].size == 0)
|
||||
if (this.minecartContainerItems[index].isEmpty())
|
||||
{
|
||||
this.minecartContainerItems[index] = null;
|
||||
}
|
||||
|
@ -110,9 +110,9 @@ public abstract class EntityCartContainer extends EntityCart implements ILockabl
|
|||
{
|
||||
this.minecartContainerItems[index] = stack;
|
||||
|
||||
if (stack != null && stack.size > this.getInventoryStackLimit())
|
||||
if (stack != null && stack.getSize() > this.getInventoryStackLimit())
|
||||
{
|
||||
stack.size = this.getInventoryStackLimit();
|
||||
stack.setSize(this.getInventoryStackLimit());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -212,39 +212,39 @@ public class EntityItem extends Entity
|
|||
}
|
||||
else if (other.isEntityAlive() && this.isEntityAlive())
|
||||
{
|
||||
ItemStack itemstack = this.getEntityItem();
|
||||
ItemStack itemstack1 = other.getEntityItem();
|
||||
ItemStack stack = this.getEntityItem();
|
||||
ItemStack otherStack = other.getEntityItem();
|
||||
|
||||
if (this.delayBeforeCanPickup != 32767 && other.delayBeforeCanPickup != 32767)
|
||||
{
|
||||
if (this.age != -32768 && other.age != -32768)
|
||||
{
|
||||
if (itemstack1.getItem() != itemstack.getItem())
|
||||
if (otherStack.getItem() != stack.getItem())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else if (!itemstack1.dataEquals(itemstack))
|
||||
else if (!otherStack.dataEquals(stack))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else if (itemstack1.getItem() == null)
|
||||
else if (otherStack.getItem() == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else if (itemstack1.size < itemstack.size)
|
||||
else if (otherStack.getSize() < stack.getSize())
|
||||
{
|
||||
return other.combineItems(this);
|
||||
}
|
||||
else if (itemstack1.size + itemstack.size > itemstack1.getMaxStackSize())
|
||||
else if (otherStack.getSize() + stack.getSize() > otherStack.getMaxStackSize())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
itemstack1.size += itemstack.size;
|
||||
otherStack.incrSize(stack.getSize());
|
||||
other.delayBeforeCanPickup = Math.max(other.delayBeforeCanPickup, this.delayBeforeCanPickup);
|
||||
other.age = Math.min(other.age, this.age);
|
||||
other.setEntityItemStack(itemstack1);
|
||||
other.setEntityItemStack(otherStack);
|
||||
this.setDead();
|
||||
return true;
|
||||
}
|
||||
|
@ -389,7 +389,7 @@ public class EntityItem extends Entity
|
|||
if (!this.worldObj.client)
|
||||
{
|
||||
ItemStack itemstack = this.getEntityItem();
|
||||
int i = itemstack.size;
|
||||
int i = itemstack.getSize();
|
||||
|
||||
if (this.delayBeforeCanPickup == 0 // && (this.owner == null || 6000 - this.age <= 200 || this.owner.equals(entityIn.getUser()))
|
||||
&& entityIn.inventory.addItemStackToInventory(itemstack))
|
||||
|
@ -436,7 +436,7 @@ public class EntityItem extends Entity
|
|||
|
||||
entityIn.onItemPickup(this, i);
|
||||
|
||||
if (itemstack.size <= 0)
|
||||
if (itemstack.isEmpty())
|
||||
{
|
||||
this.setDead();
|
||||
}
|
||||
|
@ -451,10 +451,8 @@ public class EntityItem extends Entity
|
|||
{
|
||||
if(this.hasCustomName())
|
||||
return this.getCustomNameTag();
|
||||
String comp = super.getTypeName();
|
||||
comp += " (" + this.getEntityItem().size + " * " +
|
||||
ItemRegistry.getName(this.getEntityItem().getItem()) + ")";
|
||||
return comp;
|
||||
ItemStack stack = this.getEntityItem();
|
||||
return super.getTypeName() + " (" + (stack.isStacked() ? stack.getSize() + " * " : "") + stack.getItem().getDisplay() + ")";
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -600,9 +598,9 @@ public class EntityItem extends Entity
|
|||
public String getDisplayName()
|
||||
{
|
||||
ItemStack stack = this.getEntityItem();
|
||||
if(stack.size <= 1)
|
||||
if(!stack.isStacked())
|
||||
return null;
|
||||
return TextColor.DGREEN + "" + stack.size;
|
||||
return TextColor.DGREEN + "" + stack.getSize();
|
||||
}
|
||||
|
||||
public EntityType getType() {
|
||||
|
|
|
@ -237,7 +237,7 @@ public class EntityHaunter extends EntityNPC {
|
|||
if (!this.worldObj.client)
|
||||
{
|
||||
this.ignite();
|
||||
itemstack.damageItem(1, player);
|
||||
itemstack.damage(1, player);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -564,19 +564,6 @@ public abstract class EntityNPC extends EntityLiving
|
|||
// return ;
|
||||
// }
|
||||
|
||||
protected void consumeItemFromStack(EntityNPC player, ItemStack stack)
|
||||
{
|
||||
// if (!player.creative)
|
||||
// {
|
||||
--stack.size;
|
||||
|
||||
if (stack.size <= 0)
|
||||
{
|
||||
player.inventory.setInventorySlotContents(player.inventory.currentItem, (ItemStack)null);
|
||||
}
|
||||
// }
|
||||
}
|
||||
|
||||
// protected boolean canDropLoot()
|
||||
// {
|
||||
// return true;
|
||||
|
@ -636,13 +623,14 @@ public abstract class EntityNPC extends EntityLiving
|
|||
|
||||
public boolean interact(EntityNPC player)
|
||||
{
|
||||
ItemStack itemstack = player.inventory.getCurrentItem();
|
||||
boolean flag = itemstack != null && !(itemstack.getItem() instanceof ItemTool || itemstack.getItem() instanceof ItemSword ||
|
||||
itemstack.getItem() instanceof ItemHoe || itemstack.getItem() instanceof ItemShears);
|
||||
ItemStack stack = player.inventory.getCurrentItem();
|
||||
boolean flag = stack != null && !(stack.getItem() instanceof ItemTool || stack.getItem() instanceof ItemSword ||
|
||||
stack.getItem() instanceof ItemHoe || stack.getItem() instanceof ItemShears);
|
||||
|
||||
if (itemstack != null && !this.isPlayer() && this.isBreedingItem(itemstack) && this.getGrowingAge() == 0 && !this.isMating())
|
||||
if (stack != null && !this.isPlayer() && this.isBreedingItem(stack) && this.getGrowingAge() == 0 && !this.isMating())
|
||||
{
|
||||
this.consumeItemFromStack(player, itemstack);
|
||||
if(stack.decrSize())
|
||||
player.inventory.setInventorySlotContents(player.inventory.currentItem, null);
|
||||
if (!this.worldObj.client)
|
||||
{
|
||||
this.setIsWillingToMate(true);
|
||||
|
@ -651,9 +639,10 @@ public abstract class EntityNPC extends EntityLiving
|
|||
}
|
||||
return true;
|
||||
}
|
||||
else if (itemstack != null && !this.isPlayer() && this.isBreedingItem(itemstack) && this.getGrowingAge() < 0)
|
||||
else if (stack != null && !this.isPlayer() && this.isBreedingItem(stack) && this.getGrowingAge() < 0)
|
||||
{
|
||||
this.consumeItemFromStack(player, itemstack);
|
||||
if(stack.decrSize())
|
||||
player.inventory.setInventorySlotContents(player.inventory.currentItem, null);
|
||||
if (!this.worldObj.client)
|
||||
{
|
||||
this.grow(this.rand.range(200, 250));
|
||||
|
@ -1437,7 +1426,7 @@ public abstract class EntityNPC extends EntityLiving
|
|||
}
|
||||
else
|
||||
{
|
||||
stack.size = remain.size;
|
||||
stack.setSize(remain.getSize());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1670,7 +1659,7 @@ public abstract class EntityNPC extends EntityLiving
|
|||
ItemStack itemstack = this.prevEquipment[j];
|
||||
ItemStack itemstack1 = this.getItem(j);
|
||||
|
||||
if (!ItemStack.areItemStacksEqual(itemstack1, itemstack))
|
||||
if (!ItemStack.allEquals(itemstack1, itemstack))
|
||||
{
|
||||
((AWorldServer)this.worldObj).sendToAllTrackingEntity(this, new SPacketEntityEquipment(this.getId(), j, itemstack1));
|
||||
|
||||
|
@ -1681,7 +1670,7 @@ public abstract class EntityNPC extends EntityLiving
|
|||
|
||||
if (itemstack1 != null)
|
||||
{
|
||||
this.attributes.add(itemstack1.getAttributeModifiers(UsageSlot.getByIndex(j)), -1 - j, itemstack1.size);
|
||||
this.attributes.add(itemstack1.getAttributeModifiers(UsageSlot.getByIndex(j)), -1 - j, itemstack1.getSize());
|
||||
}
|
||||
|
||||
this.prevEquipment[j] = itemstack1 == null ? null : itemstack1.copy();
|
||||
|
@ -1959,7 +1948,7 @@ public abstract class EntityNPC extends EntityLiving
|
|||
this.client.addToSendQueue(new CPacketBreak(c07packetplayerdigging$action, BlockPos.ORIGIN, Facing.DOWN));
|
||||
return null;
|
||||
}
|
||||
return this.dropItem(this.inventory.decrStackSize(this.inventory.currentItem, dropAll && this.inventory.getCurrentItem() != null ? this.inventory.getCurrentItem().size : 1), false, true);
|
||||
return this.dropItem(this.inventory.decrStackSize(this.inventory.currentItem, dropAll && this.inventory.getCurrentItem() != null ? this.inventory.getCurrentItem().getSize() : 1), false, true);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -2905,14 +2894,14 @@ public abstract class EntityNPC extends EntityLiving
|
|||
if (this.itemInUse != null)
|
||||
{
|
||||
this.updateItemUse(this.itemInUse, 16);
|
||||
int i = this.itemInUse.size;
|
||||
ItemStack itemstack = this.itemInUse.onItemUseFinish(this.worldObj, this);
|
||||
int i = this.itemInUse.getSize();
|
||||
ItemStack itemstack = this.itemInUse.getItem().onItemUseFinish(this.itemInUse, this.worldObj, this);
|
||||
|
||||
if (itemstack != this.itemInUse || itemstack != null && itemstack.size != i)
|
||||
if (itemstack != this.itemInUse || itemstack != null && itemstack.getSize() != i)
|
||||
{
|
||||
this.inventory.mainInventory[this.inventory.currentItem] = itemstack;
|
||||
|
||||
if (itemstack.size == 0)
|
||||
if (itemstack.isEmpty())
|
||||
{
|
||||
this.inventory.mainInventory[this.inventory.currentItem] = null;
|
||||
}
|
||||
|
@ -3035,7 +3024,7 @@ public abstract class EntityNPC extends EntityLiving
|
|||
{
|
||||
if (this.itemInUse != null)
|
||||
{
|
||||
this.itemInUse.onPlayerStoppedUsing(this.worldObj, this, this.itemInUseCount);
|
||||
this.itemInUse.getItem().onPlayerStoppedUsing(this.itemInUse, this.worldObj, this, this.itemInUseCount);
|
||||
}
|
||||
|
||||
this.clearItemInUse();
|
||||
|
@ -3210,7 +3199,7 @@ public abstract class EntityNPC extends EntityLiving
|
|||
{
|
||||
return null;
|
||||
}
|
||||
else if (droppedItem.size == 0)
|
||||
else if (droppedItem.isEmpty())
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
@ -3622,9 +3611,9 @@ public abstract class EntityNPC extends EntityLiving
|
|||
// itemstack = itemstack1;
|
||||
// }
|
||||
|
||||
if (itemstack.interactWithEntity(this, (EntityLiving)targetEntity))
|
||||
if (itemstack.getItem().itemInteractionForEntity(itemstack, this, (EntityLiving)targetEntity))
|
||||
{
|
||||
if (itemstack.size <= 0) // && !this.creative)
|
||||
if (itemstack.isEmpty()) // && !this.creative)
|
||||
{
|
||||
this.destroyCurrentEquippedItem();
|
||||
}
|
||||
|
@ -3639,7 +3628,7 @@ public abstract class EntityNPC extends EntityLiving
|
|||
{
|
||||
if (itemstack != null && itemstack == this.getCurrentEquippedItem())
|
||||
{
|
||||
if (itemstack.size <= 0) // && !this.creative)
|
||||
if (itemstack.isEmpty()) // && !this.creative)
|
||||
{
|
||||
this.destroyCurrentEquippedItem();
|
||||
}
|
||||
|
@ -3790,9 +3779,9 @@ public abstract class EntityNPC extends EntityLiving
|
|||
|
||||
if (itemstack != null && entity instanceof EntityLiving)
|
||||
{
|
||||
itemstack.hitEntity((EntityLiving)entity, this);
|
||||
itemstack.getItem().hitEntity(itemstack, (EntityLiving)entity, this);
|
||||
|
||||
if (itemstack.size <= 0)
|
||||
if (itemstack.isEmpty())
|
||||
{
|
||||
this.destroyCurrentEquippedItem();
|
||||
}
|
||||
|
|
|
@ -164,20 +164,22 @@ public abstract class EntityAnimal extends EntityLiving
|
|||
*/
|
||||
public boolean interact(EntityNPC player)
|
||||
{
|
||||
ItemStack itemstack = player.inventory.getCurrentItem();
|
||||
ItemStack stack = player.inventory.getCurrentItem();
|
||||
|
||||
if (itemstack != null)
|
||||
if (stack != null)
|
||||
{
|
||||
if (this.isBreedingItem(itemstack) && this.getGrowingAge() == 0 && !this.isInLove())
|
||||
if (this.isBreedingItem(stack) && this.getGrowingAge() == 0 && !this.isInLove())
|
||||
{
|
||||
this.consumeItemFromStack(player, itemstack);
|
||||
if(stack.decrSize())
|
||||
player.inventory.setInventorySlotContents(player.inventory.currentItem, null);
|
||||
this.setInLove(player);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (this.isChild() && this.isBreedingItem(itemstack))
|
||||
if (this.isChild() && this.isBreedingItem(stack))
|
||||
{
|
||||
this.consumeItemFromStack(player, itemstack);
|
||||
if(stack.decrSize())
|
||||
player.inventory.setInventorySlotContents(player.inventory.currentItem, null);
|
||||
if(!this.worldObj.client)
|
||||
this.grow((int)((float)(-this.getGrowingAge() / 20) * 0.1F));
|
||||
return true;
|
||||
|
@ -187,22 +189,6 @@ public abstract class EntityAnimal extends EntityLiving
|
|||
return super.interact(player);
|
||||
}
|
||||
|
||||
/**
|
||||
* Decreases ItemStack size by one
|
||||
*/
|
||||
protected void consumeItemFromStack(EntityNPC player, ItemStack stack)
|
||||
{
|
||||
// if (!player.creative)
|
||||
// {
|
||||
--stack.size;
|
||||
|
||||
if (stack.size <= 0)
|
||||
{
|
||||
player.inventory.setInventorySlotContents(player.inventory.currentItem, (ItemStack)null);
|
||||
}
|
||||
// }
|
||||
}
|
||||
|
||||
public void setInLove(EntityNPC player)
|
||||
{
|
||||
if(!this.worldObj.client) {
|
||||
|
|
|
@ -900,7 +900,7 @@ public abstract class EntityLiving extends Entity
|
|||
{
|
||||
if ((source == DamageSource.anvil || source == DamageSource.fallingBlock) && this.getItem(4) != null)
|
||||
{
|
||||
this.getItem(4).damageItem((int)(amount * 4.0F + this.rand.floatv() * (float)amount * 2.0F), this);
|
||||
this.getItem(4).damage((int)(amount * 4.0F + this.rand.floatv() * (float)amount * 2.0F), this);
|
||||
amount = (int)((float)amount * 0.75F);
|
||||
}
|
||||
|
||||
|
@ -2684,33 +2684,17 @@ public abstract class EntityLiving extends Entity
|
|||
|
||||
public boolean interactFirst(EntityNPC player) {
|
||||
if(this.getLeashed() && this.getLeashedTo() == player) {
|
||||
this.clearLeashed(true, true); // !player.creative);
|
||||
this.clearLeashed(true, true);
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
ItemStack stack = player.inventory.getCurrentItem();
|
||||
|
||||
if(stack != null && stack.getItem() == Items.lead && this.allowLeashing()) {
|
||||
if(!(this instanceof EntityTameable) || !((EntityTameable)this).isTamed()) {
|
||||
this.setLeashedTo(player, true);
|
||||
--stack.size;
|
||||
return true;
|
||||
}
|
||||
|
||||
if(((EntityTameable)this).isOwner(player)) {
|
||||
this.setLeashedTo(player, true);
|
||||
--stack.size;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
if(this.interact(player)) {
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
return super.interactFirst(player);
|
||||
}
|
||||
ItemStack stack = player.inventory.getCurrentItem();
|
||||
if(stack != null && stack.getItem() == Items.lead && this.allowLeashing() && (!(this instanceof EntityTameable tameable) || !tameable.isTamed() || tameable.isOwner(player))) {
|
||||
this.setLeashedTo(player, true);
|
||||
if(stack.decrSize())
|
||||
player.inventory.setInventorySlotContents(player.inventory.currentItem, null);
|
||||
return true;
|
||||
}
|
||||
return this.interact(player) || super.interactFirst(player);
|
||||
}
|
||||
|
||||
// protected boolean interact(EntityNPC player) {
|
||||
|
@ -3140,9 +3124,8 @@ public abstract class EntityLiving extends Entity
|
|||
|
||||
// if (!player.creative)
|
||||
// {
|
||||
--itemstack.size;
|
||||
|
||||
if (itemstack.size <= 0)
|
||||
if (itemstack.decrSize())
|
||||
{
|
||||
player.inventory.setInventorySlotContents(player.inventory.currentItem, (ItemStack)null);
|
||||
}
|
||||
|
|
|
@ -527,7 +527,7 @@ public abstract class CraftingRegistry
|
|||
{
|
||||
ItemStack itemstack1 = (ItemStack)list.get(0);
|
||||
|
||||
if (itemstack.getItem() != itemstack1.getItem() || itemstack1.size != 1 || itemstack.size != 1 || !itemstack1.getItem().isDamageable())
|
||||
if (itemstack.getItem() != itemstack1.getItem() || itemstack1.getSize() != 1 || itemstack.getSize() != 1 || !itemstack1.getItem().isDamageable())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
@ -557,7 +557,7 @@ public abstract class CraftingRegistry
|
|||
{
|
||||
ItemStack itemstack1 = (ItemStack)list.get(0);
|
||||
|
||||
if (itemstack.getItem() != itemstack1.getItem() || itemstack1.size != 1 || itemstack.size != 1 || !itemstack1.getItem().isDamageable())
|
||||
if (itemstack.getItem() != itemstack1.getItem() || itemstack1.getSize() != 1 || itemstack.getSize() != 1 || !itemstack1.getItem().isDamageable())
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
@ -570,7 +570,7 @@ public abstract class CraftingRegistry
|
|||
ItemStack itemstack2 = (ItemStack)list.get(0);
|
||||
ItemStack itemstack3 = (ItemStack)list.get(1);
|
||||
|
||||
if (itemstack2.getItem() == itemstack3.getItem() && itemstack2.size == 1 && itemstack3.size == 1 && itemstack2.getItem().isDamageable())
|
||||
if (itemstack2.getItem() == itemstack3.getItem() && itemstack2.getSize() == 1 && itemstack3.getSize() == 1 && itemstack2.getItem().isDamageable())
|
||||
{
|
||||
Item item = itemstack2.getItem();
|
||||
int j = item.getMaxDamage() - itemstack2.getItemDamage();
|
||||
|
@ -686,8 +686,7 @@ public abstract class CraftingRegistry
|
|||
return null;
|
||||
}
|
||||
|
||||
itemstack = itemstack1.copy();
|
||||
itemstack.size = 1;
|
||||
itemstack = itemstack1.copy(1);
|
||||
|
||||
if (itemstack1.hasColor())
|
||||
{
|
||||
|
|
|
@ -84,7 +84,7 @@ public abstract class Container
|
|||
ItemStack current = ((Slot)this.inventorySlots.get(i)).getStack();
|
||||
ItemStack last = (ItemStack)this.inventoryItemStacks.get(i);
|
||||
|
||||
if (!ItemStack.areItemStacksEqual(last, current))
|
||||
if (!ItemStack.allEquals(last, current))
|
||||
{
|
||||
last = current == null ? null : current.copy();
|
||||
this.inventoryItemStacks.set(i, last);
|
||||
|
@ -178,7 +178,7 @@ public abstract class Container
|
|||
{
|
||||
Slot slot = (Slot)this.inventorySlots.get(slotId);
|
||||
|
||||
if (slot != null && canAddItemToSlot(slot, inventoryplayer.getItemStack(), true) && slot.isItemValid(inventoryplayer.getItemStack()) && inventoryplayer.getItemStack().size > this.dragSlots.size() && this.canDragIntoSlot(slot))
|
||||
if (slot != null && canAddItemToSlot(slot, inventoryplayer.getItemStack(), true) && slot.isItemValid(inventoryplayer.getItemStack()) && inventoryplayer.getItemStack().getSize() > this.dragSlots.size() && this.canDragIntoSlot(slot))
|
||||
{
|
||||
this.dragSlots.add(slot);
|
||||
}
|
||||
|
@ -188,34 +188,34 @@ public abstract class Container
|
|||
if (!this.dragSlots.isEmpty())
|
||||
{
|
||||
ItemStack itemstack3 = inventoryplayer.getItemStack().copy();
|
||||
int j = inventoryplayer.getItemStack().size;
|
||||
int j = inventoryplayer.getItemStack().getSize();
|
||||
|
||||
for (Slot slot1 : this.dragSlots)
|
||||
{
|
||||
if (slot1 != null && canAddItemToSlot(slot1, inventoryplayer.getItemStack(), true) && slot1.isItemValid(inventoryplayer.getItemStack()) && inventoryplayer.getItemStack().size >= this.dragSlots.size() && this.canDragIntoSlot(slot1))
|
||||
if (slot1 != null && canAddItemToSlot(slot1, inventoryplayer.getItemStack(), true) && slot1.isItemValid(inventoryplayer.getItemStack()) && inventoryplayer.getItemStack().getSize() >= this.dragSlots.size() && this.canDragIntoSlot(slot1))
|
||||
{
|
||||
ItemStack itemstack1 = itemstack3.copy();
|
||||
int k = slot1.getHasStack() ? slot1.getStack().size : 0;
|
||||
int k = slot1.getHasStack() ? slot1.getStack().getSize() : 0;
|
||||
computeStackSize(this.dragSlots, this.dragMode, itemstack1, k);
|
||||
|
||||
if (itemstack1.size > itemstack1.getMaxStackSize())
|
||||
if (itemstack1.isOverLimit())
|
||||
{
|
||||
itemstack1.size = itemstack1.getMaxStackSize();
|
||||
itemstack1.setSize(itemstack1.getMaxStackSize());
|
||||
}
|
||||
|
||||
if (itemstack1.size > slot1.getItemStackLimit(itemstack1))
|
||||
if (itemstack1.getSize() > slot1.getItemStackLimit(itemstack1))
|
||||
{
|
||||
itemstack1.size = slot1.getItemStackLimit(itemstack1);
|
||||
itemstack1.setSize(slot1.getItemStackLimit(itemstack1));
|
||||
}
|
||||
|
||||
j -= itemstack1.size - k;
|
||||
j -= itemstack1.getSize() - k;
|
||||
slot1.putStack(itemstack1);
|
||||
}
|
||||
}
|
||||
|
||||
itemstack3.size = j;
|
||||
itemstack3.setSize(j);
|
||||
|
||||
if (itemstack3.size <= 0)
|
||||
if (itemstack3.isEmpty())
|
||||
{
|
||||
itemstack3 = null;
|
||||
}
|
||||
|
@ -248,9 +248,9 @@ public abstract class Container
|
|||
|
||||
if (clickedButton == 1)
|
||||
{
|
||||
playerIn.dropPlayerItemWithRandomChoice(inventoryplayer.getItemStack().splitStack(1), true);
|
||||
playerIn.dropPlayerItemWithRandomChoice(inventoryplayer.getItemStack().split(1), true);
|
||||
|
||||
if (inventoryplayer.getItemStack().size == 0)
|
||||
if (inventoryplayer.getItemStack().isEmpty())
|
||||
{
|
||||
inventoryplayer.setItemStack((ItemStack)null);
|
||||
}
|
||||
|
@ -305,19 +305,19 @@ public abstract class Container
|
|||
{
|
||||
if (itemstack10 != null && slot7.isItemValid(itemstack10))
|
||||
{
|
||||
int k2 = clickedButton == 0 ? itemstack10.size : 1;
|
||||
int k2 = clickedButton == 0 ? itemstack10.getSize() : 1;
|
||||
|
||||
if (k2 > slot7.getItemStackLimit(itemstack10))
|
||||
{
|
||||
k2 = slot7.getItemStackLimit(itemstack10);
|
||||
}
|
||||
|
||||
if (itemstack10.size >= k2)
|
||||
if (itemstack10.getSize() >= k2)
|
||||
{
|
||||
slot7.putStack(itemstack10.splitStack(k2));
|
||||
slot7.putStack(itemstack10.split(k2));
|
||||
}
|
||||
|
||||
if (itemstack10.size == 0)
|
||||
if (itemstack10.isEmpty())
|
||||
{
|
||||
inventoryplayer.setItemStack((ItemStack)null);
|
||||
}
|
||||
|
@ -327,11 +327,11 @@ public abstract class Container
|
|||
{
|
||||
if (itemstack10 == null)
|
||||
{
|
||||
int j2 = clickedButton == 0 ? itemstack9.size : (itemstack9.size + 1) / 2;
|
||||
int j2 = clickedButton == 0 ? itemstack9.getSize() : (itemstack9.getSize() + 1) / 2;
|
||||
ItemStack itemstack12 = slot7.decrStackSize(j2);
|
||||
inventoryplayer.setItemStack(itemstack12);
|
||||
|
||||
if (itemstack9.size == 0)
|
||||
if (itemstack9.isEmpty())
|
||||
{
|
||||
slot7.putStack((ItemStack)null);
|
||||
}
|
||||
|
@ -340,45 +340,45 @@ public abstract class Container
|
|||
}
|
||||
else if (slot7.isItemValid(itemstack10))
|
||||
{
|
||||
if (itemstack9.getItem() == itemstack10.getItem() && ItemStack.areItemStackTagsEqual(itemstack9, itemstack10))
|
||||
if (itemstack9.getItem() == itemstack10.getItem() && ItemStack.dataEquals(itemstack9, itemstack10))
|
||||
{
|
||||
int i2 = clickedButton == 0 ? itemstack10.size : 1;
|
||||
int i2 = clickedButton == 0 ? itemstack10.getSize() : 1;
|
||||
|
||||
if (i2 > slot7.getItemStackLimit(itemstack10) - itemstack9.size)
|
||||
if (i2 > slot7.getItemStackLimit(itemstack10) - itemstack9.getSize())
|
||||
{
|
||||
i2 = slot7.getItemStackLimit(itemstack10) - itemstack9.size;
|
||||
i2 = slot7.getItemStackLimit(itemstack10) - itemstack9.getSize();
|
||||
}
|
||||
|
||||
if (i2 > itemstack10.getMaxStackSize() - itemstack9.size)
|
||||
if (i2 > itemstack10.getMaxStackSize() - itemstack9.getSize())
|
||||
{
|
||||
i2 = itemstack10.getMaxStackSize() - itemstack9.size;
|
||||
i2 = itemstack10.getMaxStackSize() - itemstack9.getSize();
|
||||
}
|
||||
|
||||
itemstack10.splitStack(i2);
|
||||
itemstack10.split(i2);
|
||||
|
||||
if (itemstack10.size == 0)
|
||||
if (itemstack10.isEmpty())
|
||||
{
|
||||
inventoryplayer.setItemStack((ItemStack)null);
|
||||
}
|
||||
|
||||
itemstack9.size += i2;
|
||||
itemstack9.incrSize(i2);
|
||||
}
|
||||
else if (itemstack10.size <= slot7.getItemStackLimit(itemstack10))
|
||||
else if (itemstack10.getSize() <= slot7.getItemStackLimit(itemstack10))
|
||||
{
|
||||
slot7.putStack(itemstack10);
|
||||
inventoryplayer.setItemStack(itemstack9);
|
||||
}
|
||||
}
|
||||
else if (itemstack9.getItem() == itemstack10.getItem() && itemstack10.getMaxStackSize() > 1 && ItemStack.areItemStackTagsEqual(itemstack9, itemstack10))
|
||||
else if (itemstack9.getItem() == itemstack10.getItem() && itemstack10.getMaxStackSize() > 1 && ItemStack.dataEquals(itemstack9, itemstack10))
|
||||
{
|
||||
int l1 = itemstack9.size;
|
||||
int l1 = itemstack9.getSize();
|
||||
|
||||
if (l1 > 0 && l1 + itemstack10.size <= itemstack10.getMaxStackSize())
|
||||
if (l1 > 0 && l1 + itemstack10.getSize() <= itemstack10.getMaxStackSize())
|
||||
{
|
||||
itemstack10.size += l1;
|
||||
itemstack10.incrSize(l1);
|
||||
itemstack9 = slot7.decrStackSize(l1);
|
||||
|
||||
if (itemstack9.size == 0)
|
||||
if (itemstack9.isEmpty())
|
||||
{
|
||||
slot7.putStack((ItemStack)null);
|
||||
}
|
||||
|
@ -418,14 +418,14 @@ public abstract class Container
|
|||
if (k1 > -1)
|
||||
{
|
||||
inventoryplayer.addItemStackToInventory(itemstack7);
|
||||
slot5.decrStackSize(itemstack11.size);
|
||||
slot5.decrStackSize(itemstack11.getSize());
|
||||
slot5.putStack((ItemStack)null);
|
||||
slot5.onPickupFromSlot(playerIn, itemstack11);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
slot5.decrStackSize(itemstack11.size);
|
||||
slot5.decrStackSize(itemstack11.getSize());
|
||||
slot5.putStack(itemstack7);
|
||||
slot5.onPickupFromSlot(playerIn, itemstack11);
|
||||
}
|
||||
|
@ -454,7 +454,7 @@ public abstract class Container
|
|||
|
||||
if (slot3 != null && slot3.getHasStack() && slot3.canTakeStack(playerIn))
|
||||
{
|
||||
ItemStack itemstack5 = slot3.decrStackSize(clickedButton == 0 ? 1 : slot3.getStack().size);
|
||||
ItemStack itemstack5 = slot3.decrStackSize(clickedButton == 0 ? 1 : slot3.getStack().getSize());
|
||||
slot3.onPickupFromSlot(playerIn, itemstack5);
|
||||
playerIn.dropPlayerItemWithRandomChoice(itemstack5, true);
|
||||
}
|
||||
|
@ -471,17 +471,17 @@ public abstract class Container
|
|||
|
||||
for (int l2 = 0; l2 < 2; ++l2)
|
||||
{
|
||||
for (int i3 = i1; i3 >= 0 && i3 < this.inventorySlots.size() && itemstack4.size < itemstack4.getMaxStackSize(); i3 += j1)
|
||||
for (int i3 = i1; i3 >= 0 && i3 < this.inventorySlots.size() && !itemstack4.isFull(); i3 += j1)
|
||||
{
|
||||
Slot slot8 = (Slot)this.inventorySlots.get(i3);
|
||||
|
||||
if (slot8.getHasStack() && canAddItemToSlot(slot8, itemstack4, true) && slot8.canTakeStack(playerIn) && this.canMergeSlot(itemstack4, slot8) && (l2 != 0 || slot8.getStack().size != slot8.getStack().getMaxStackSize()))
|
||||
if (slot8.getHasStack() && canAddItemToSlot(slot8, itemstack4, true) && slot8.canTakeStack(playerIn) && this.canMergeSlot(itemstack4, slot8) && (l2 != 0 || !slot8.getStack().isFull()))
|
||||
{
|
||||
int l = Math.min(itemstack4.getMaxStackSize() - itemstack4.size, slot8.getStack().size);
|
||||
int l = Math.min(itemstack4.getMaxStackSize() - itemstack4.getSize(), slot8.getStack().getSize());
|
||||
ItemStack itemstack2 = slot8.decrStackSize(l);
|
||||
itemstack4.size += l;
|
||||
itemstack4.incrSize(l);
|
||||
|
||||
if (itemstack2.size <= 0)
|
||||
if (itemstack2.isEmpty())
|
||||
{
|
||||
slot8.putStack((ItemStack)null);
|
||||
}
|
||||
|
@ -611,26 +611,26 @@ public abstract class Container
|
|||
|
||||
if (stack.isStackable())
|
||||
{
|
||||
while (stack.size > 0 && (!reverseDirection && i < endIndex || reverseDirection && i >= startIndex))
|
||||
while (!stack.isEmpty() && (!reverseDirection && i < endIndex || reverseDirection && i >= startIndex))
|
||||
{
|
||||
Slot slot = (Slot)this.inventorySlots.get(i);
|
||||
ItemStack itemstack = slot.getStack();
|
||||
|
||||
if (itemstack != null && itemstack.getItem() == stack.getItem() && ItemStack.areItemStackTagsEqual(stack, itemstack))
|
||||
if (itemstack != null && itemstack.getItem() == stack.getItem() && ItemStack.dataEquals(stack, itemstack))
|
||||
{
|
||||
int j = itemstack.size + stack.size;
|
||||
int j = itemstack.getSize() + stack.getSize();
|
||||
|
||||
if (j <= stack.getMaxStackSize())
|
||||
{
|
||||
stack.size = 0;
|
||||
itemstack.size = j;
|
||||
stack.setSize(0);
|
||||
itemstack.setSize(j);
|
||||
slot.onSlotChanged();
|
||||
flag = true;
|
||||
}
|
||||
else if (itemstack.size < stack.getMaxStackSize())
|
||||
else if (itemstack.getSize() < stack.getMaxStackSize())
|
||||
{
|
||||
stack.size -= stack.getMaxStackSize() - itemstack.size;
|
||||
itemstack.size = stack.getMaxStackSize();
|
||||
stack.decrSize(stack.getMaxStackSize() - itemstack.getSize());
|
||||
itemstack.setSize(stack.getMaxStackSize());
|
||||
slot.onSlotChanged();
|
||||
flag = true;
|
||||
}
|
||||
|
@ -647,7 +647,7 @@ public abstract class Container
|
|||
}
|
||||
}
|
||||
|
||||
if (stack.size > 0)
|
||||
if (!stack.isEmpty())
|
||||
{
|
||||
if (reverseDirection)
|
||||
{
|
||||
|
@ -667,7 +667,7 @@ public abstract class Container
|
|||
{
|
||||
slot1.putStack(stack.copy());
|
||||
slot1.onSlotChanged();
|
||||
stack.size = 0;
|
||||
stack.setSize(0);
|
||||
flag = true;
|
||||
break;
|
||||
}
|
||||
|
@ -732,9 +732,9 @@ public abstract class Container
|
|||
{
|
||||
boolean flag = slotIn == null || !slotIn.getHasStack();
|
||||
|
||||
if (slotIn != null && slotIn.getHasStack() && stack != null && stack.isItemEqual(slotIn.getStack()) && ItemStack.areItemStackTagsEqual(slotIn.getStack(), stack))
|
||||
if (slotIn != null && slotIn.getHasStack() && stack != null && stack.itemEquals(slotIn.getStack()) && ItemStack.dataEquals(slotIn.getStack(), stack))
|
||||
{
|
||||
flag |= slotIn.getStack().size + (stackSizeMatters ? 0 : stack.size) <= stack.getMaxStackSize();
|
||||
flag |= slotIn.getStack().getSize() + (stackSizeMatters ? 0 : stack.getSize()) <= stack.getMaxStackSize();
|
||||
}
|
||||
|
||||
return flag;
|
||||
|
@ -749,18 +749,18 @@ public abstract class Container
|
|||
switch (p_94525_1_)
|
||||
{
|
||||
case 0:
|
||||
p_94525_2_.size = ExtMath.floorf((float)p_94525_2_.size / (float)p_94525_0_.size());
|
||||
p_94525_2_.setSize(ExtMath.floorf((float)p_94525_2_.getSize() / (float)p_94525_0_.size()));
|
||||
break;
|
||||
|
||||
case 1:
|
||||
p_94525_2_.size = 1;
|
||||
p_94525_2_.setSize(1);
|
||||
break;
|
||||
|
||||
case 2:
|
||||
p_94525_2_.size = p_94525_2_.getItem().getMaxAmount();
|
||||
p_94525_2_.setSize(p_94525_2_.getItem().getMaxAmount());
|
||||
}
|
||||
|
||||
p_94525_2_.size += p_94525_3_;
|
||||
p_94525_2_.incrSize(p_94525_3_);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -797,7 +797,7 @@ public abstract class Container
|
|||
|
||||
if (itemstack != null)
|
||||
{
|
||||
f += (float)itemstack.size / (float)Math.min(inv.getInventoryStackLimit(), itemstack.getMaxStackSize());
|
||||
f += (float)itemstack.getSize() / (float)Math.min(inv.getInventoryStackLimit(), itemstack.getMaxStackSize());
|
||||
++i;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -128,7 +128,7 @@ public class ContainerBrewingStand extends Container
|
|||
slot.onSlotChange(itemstack1, itemstack);
|
||||
}
|
||||
|
||||
if (itemstack1.size == 0)
|
||||
if (itemstack1.isEmpty())
|
||||
{
|
||||
slot.putStack((ItemStack)null);
|
||||
}
|
||||
|
@ -137,7 +137,7 @@ public class ContainerBrewingStand extends Container
|
|||
slot.onSlotChanged();
|
||||
}
|
||||
|
||||
if (itemstack1.size == itemstack.size)
|
||||
if (itemstack1.getSize() == itemstack.getSize())
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -67,7 +67,7 @@ public class ContainerChest extends Container
|
|||
return null;
|
||||
}
|
||||
|
||||
if (itemstack1.size == 0)
|
||||
if (itemstack1.isEmpty())
|
||||
{
|
||||
slot.putStack((ItemStack)null);
|
||||
}
|
||||
|
|
|
@ -63,7 +63,7 @@ public class ContainerDispenser extends Container
|
|||
return null;
|
||||
}
|
||||
|
||||
if (itemstack1.size == 0)
|
||||
if (itemstack1.isEmpty())
|
||||
{
|
||||
slot.putStack((ItemStack)null);
|
||||
}
|
||||
|
@ -72,7 +72,7 @@ public class ContainerDispenser extends Container
|
|||
slot.onSlotChanged();
|
||||
}
|
||||
|
||||
if (itemstack1.size == itemstack.size)
|
||||
if (itemstack1.getSize() == itemstack.getSize())
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -330,16 +330,15 @@ public class ContainerEnchantment extends Container
|
|||
return null;
|
||||
}
|
||||
|
||||
if (itemstack1.size >= 1)
|
||||
if (!itemstack1.isEmpty())
|
||||
{
|
||||
ItemStack st = itemstack1.copy();
|
||||
st.size = 1;
|
||||
ItemStack st = itemstack1.copy(1);
|
||||
((Slot)this.inventorySlots.get(0)).putStack(st);
|
||||
--itemstack1.size;
|
||||
itemstack1.decrSize();
|
||||
}
|
||||
}
|
||||
|
||||
if (itemstack1.size == 0)
|
||||
if (itemstack1.isEmpty())
|
||||
{
|
||||
slot.putStack((ItemStack)null);
|
||||
}
|
||||
|
@ -348,7 +347,7 @@ public class ContainerEnchantment extends Container
|
|||
slot.onSlotChanged();
|
||||
}
|
||||
|
||||
if (itemstack1.size == itemstack.size)
|
||||
if (itemstack1.getSize() == itemstack.getSize())
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -108,7 +108,7 @@ public class ContainerEntityInventory extends Container
|
|||
return null;
|
||||
}
|
||||
|
||||
if (itemstack1.size == 0)
|
||||
if (itemstack1.isEmpty())
|
||||
{
|
||||
slot.putStack((ItemStack)null);
|
||||
}
|
||||
|
|
|
@ -143,7 +143,7 @@ public class ContainerFurnace extends Container
|
|||
return null;
|
||||
}
|
||||
|
||||
if (itemstack1.size == 0)
|
||||
if (itemstack1.isEmpty())
|
||||
{
|
||||
slot.putStack((ItemStack)null);
|
||||
}
|
||||
|
@ -152,7 +152,7 @@ public class ContainerFurnace extends Container
|
|||
slot.onSlotChanged();
|
||||
}
|
||||
|
||||
if (itemstack1.size == itemstack.size)
|
||||
if (itemstack1.getSize() == itemstack.getSize())
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -62,7 +62,7 @@ public class ContainerHopper extends Container
|
|||
return null;
|
||||
}
|
||||
|
||||
if (itemstack1.size == 0)
|
||||
if (itemstack1.isEmpty())
|
||||
{
|
||||
slot.putStack((ItemStack)null);
|
||||
}
|
||||
|
|
|
@ -123,7 +123,7 @@ public class ContainerMerchant extends Container
|
|||
return null;
|
||||
}
|
||||
|
||||
if (itemstack1.size == 0)
|
||||
if (itemstack1.isEmpty())
|
||||
{
|
||||
slot.putStack((ItemStack)null);
|
||||
}
|
||||
|
@ -132,7 +132,7 @@ public class ContainerMerchant extends Container
|
|||
slot.onSlotChanged();
|
||||
}
|
||||
|
||||
if (itemstack1.size == itemstack.size)
|
||||
if (itemstack1.getSize() == itemstack.getSize())
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -95,7 +95,7 @@ public class ContainerPlayer extends Container {
|
|||
ItemStack current = slot.getStack();
|
||||
ItemStack last = (ItemStack)this.lastStacks.get(i - 9);
|
||||
|
||||
if (!ItemStack.areItemStacksEqual(last, current))
|
||||
if (!ItemStack.allEquals(last, current))
|
||||
{
|
||||
if (last != null)
|
||||
{
|
||||
|
@ -104,7 +104,7 @@ public class ContainerPlayer extends Container {
|
|||
|
||||
if (current != null)
|
||||
{
|
||||
this.attributes.add(current.getAttributeModifiers(UsageSlot.INVENTORY), slot.getIndex(), current.size);
|
||||
this.attributes.add(current.getAttributeModifiers(UsageSlot.INVENTORY), slot.getIndex(), current.getSize());
|
||||
}
|
||||
|
||||
last = current == null ? null : current.copy();
|
||||
|
@ -226,7 +226,7 @@ public class ContainerPlayer extends Container {
|
|||
return null;
|
||||
}
|
||||
|
||||
if (itemstack1.size == 0)
|
||||
if (itemstack1.isEmpty())
|
||||
{
|
||||
slot.putStack((ItemStack)null);
|
||||
}
|
||||
|
@ -235,7 +235,7 @@ public class ContainerPlayer extends Container {
|
|||
slot.onSlotChanged();
|
||||
}
|
||||
|
||||
if (itemstack1.size == itemstack.size)
|
||||
if (itemstack1.getSize() == itemstack.getSize())
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -89,9 +89,9 @@ public class ContainerRepair extends Container
|
|||
{
|
||||
ItemStack itemstack = ContainerRepair.this.inputSlots.getStackInSlot(1);
|
||||
|
||||
if (itemstack != null && itemstack.size > ContainerRepair.this.materialCost)
|
||||
if (itemstack != null && itemstack.getSize() > ContainerRepair.this.materialCost)
|
||||
{
|
||||
itemstack.size -= ContainerRepair.this.materialCost;
|
||||
itemstack.decrSize(ContainerRepair.this.materialCost);
|
||||
ContainerRepair.this.inputSlots.setInventorySlotContents(1, itemstack);
|
||||
}
|
||||
else
|
||||
|
@ -210,7 +210,7 @@ public class ContainerRepair extends Container
|
|||
|
||||
int cost;
|
||||
|
||||
for (cost = 0; damage > 0 && cost < repStack.size; ++cost)
|
||||
for (cost = 0; damage > 0 && cost < repStack.getSize(); ++cost)
|
||||
{
|
||||
int j5 = newStack.getItemDamage() - damage;
|
||||
newStack.setItemDamage(j5);
|
||||
|
@ -469,7 +469,7 @@ public class ContainerRepair extends Container
|
|||
return null;
|
||||
}
|
||||
|
||||
if (itemstack1.size == 0)
|
||||
if (itemstack1.isEmpty())
|
||||
{
|
||||
slot.putStack((ItemStack)null);
|
||||
}
|
||||
|
@ -478,7 +478,7 @@ public class ContainerRepair extends Container
|
|||
slot.onSlotChanged();
|
||||
}
|
||||
|
||||
if (itemstack1.size == itemstack.size)
|
||||
if (itemstack1.getSize() == itemstack.getSize())
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -77,7 +77,7 @@ public class ContainerTile extends Container
|
|||
return null;
|
||||
}
|
||||
|
||||
if (itemstack1.size == 0)
|
||||
if (itemstack1.isEmpty())
|
||||
{
|
||||
slot.putStack((ItemStack)null);
|
||||
}
|
||||
|
|
|
@ -129,7 +129,7 @@ public class ContainerWorkbench extends Container
|
|||
return null;
|
||||
}
|
||||
|
||||
if (itemstack1.size == 0)
|
||||
if (itemstack1.isEmpty())
|
||||
{
|
||||
slot.putStack((ItemStack)null);
|
||||
}
|
||||
|
@ -138,7 +138,7 @@ public class ContainerWorkbench extends Container
|
|||
slot.onSlotChanged();
|
||||
}
|
||||
|
||||
if (itemstack1.size == itemstack.size)
|
||||
if (itemstack1.getSize() == itemstack.getSize())
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -68,7 +68,7 @@ public class InventoryBasic implements IInventory
|
|||
{
|
||||
if (this.inventoryContents[index] != null)
|
||||
{
|
||||
if (this.inventoryContents[index].size <= count)
|
||||
if (this.inventoryContents[index].getSize() <= count)
|
||||
{
|
||||
ItemStack itemstack1 = this.inventoryContents[index];
|
||||
this.inventoryContents[index] = null;
|
||||
|
@ -77,9 +77,9 @@ public class InventoryBasic implements IInventory
|
|||
}
|
||||
else
|
||||
{
|
||||
ItemStack itemstack = this.inventoryContents[index].splitStack(count);
|
||||
ItemStack itemstack = this.inventoryContents[index].split(count);
|
||||
|
||||
if (this.inventoryContents[index].size == 0)
|
||||
if (this.inventoryContents[index].isEmpty())
|
||||
{
|
||||
this.inventoryContents[index] = null;
|
||||
}
|
||||
|
@ -109,17 +109,15 @@ public class InventoryBasic implements IInventory
|
|||
return null;
|
||||
}
|
||||
|
||||
if (ItemStack.areItemsEqual(itemstack1, itemstack))
|
||||
if (ItemStack.itemEquals(itemstack1, itemstack))
|
||||
{
|
||||
int j = Math.min(this.getInventoryStackLimit(), itemstack1.getMaxStackSize());
|
||||
int k = Math.min(itemstack.size, j - itemstack1.size);
|
||||
int k = Math.min(itemstack.getSize(), j - itemstack1.getSize());
|
||||
|
||||
if (k > 0)
|
||||
{
|
||||
itemstack1.size += k;
|
||||
itemstack.size -= k;
|
||||
|
||||
if (itemstack.size <= 0)
|
||||
itemstack1.incrSize(k);
|
||||
if (itemstack.decrSize(k))
|
||||
{
|
||||
this.markDirty();
|
||||
return null;
|
||||
|
@ -128,7 +126,7 @@ public class InventoryBasic implements IInventory
|
|||
}
|
||||
}
|
||||
|
||||
if (itemstack.size != stack.size)
|
||||
if (itemstack.getSize() != stack.getSize())
|
||||
{
|
||||
this.markDirty();
|
||||
}
|
||||
|
@ -160,9 +158,9 @@ public class InventoryBasic implements IInventory
|
|||
{
|
||||
this.inventoryContents[index] = stack;
|
||||
|
||||
if (stack != null && stack.size > this.getInventoryStackLimit())
|
||||
if (stack != null && stack.getSize() > this.getInventoryStackLimit())
|
||||
{
|
||||
stack.size = this.getInventoryStackLimit();
|
||||
stack.setSize(this.getInventoryStackLimit());
|
||||
}
|
||||
|
||||
this.markDirty();
|
||||
|
|
|
@ -98,7 +98,7 @@ public class InventoryCrafting implements IInventory
|
|||
{
|
||||
if (this.stackList[index] != null)
|
||||
{
|
||||
if (this.stackList[index].size <= count)
|
||||
if (this.stackList[index].getSize() <= count)
|
||||
{
|
||||
ItemStack itemstack1 = this.stackList[index];
|
||||
this.stackList[index] = null;
|
||||
|
@ -107,9 +107,9 @@ public class InventoryCrafting implements IInventory
|
|||
}
|
||||
else
|
||||
{
|
||||
ItemStack itemstack = this.stackList[index].splitStack(count);
|
||||
ItemStack itemstack = this.stackList[index].split(count);
|
||||
|
||||
if (this.stackList[index].size == 0)
|
||||
if (this.stackList[index].isEmpty())
|
||||
{
|
||||
this.stackList[index] = null;
|
||||
}
|
||||
|
|
|
@ -40,16 +40,16 @@ public class InventoryHelper
|
|||
float f1 = RANDOM.floatv() * 0.8F + 0.1F;
|
||||
float f2 = RANDOM.floatv() * 0.8F + 0.1F;
|
||||
|
||||
while (stack.size > 0)
|
||||
while (!stack.isEmpty())
|
||||
{
|
||||
int i = stack.size > 64 ? stack.size : (RANDOM.zrange(21) + 10);
|
||||
int i = stack.getSize() > 64 ? stack.getSize() : (RANDOM.zrange(21) + 10);
|
||||
|
||||
if (i > stack.size)
|
||||
if (i > stack.getSize())
|
||||
{
|
||||
i = stack.size;
|
||||
i = stack.getSize();
|
||||
}
|
||||
|
||||
stack.size -= i;
|
||||
stack.decrSize(i);
|
||||
EntityItem entityitem = new EntityItem(worldIn, x + (double)f, y + (double)f1, z + (double)f2, new ItemStack(stack.getItem(), i));
|
||||
|
||||
entityitem.getEntityItem().copyData(stack);
|
||||
|
|
|
@ -59,7 +59,7 @@ public class InventoryMerchant implements IInventory
|
|||
this.theInventory[index] = null;
|
||||
return itemstack2;
|
||||
}
|
||||
else if (this.theInventory[index].size <= count)
|
||||
else if (this.theInventory[index].getSize() <= count)
|
||||
{
|
||||
ItemStack itemstack1 = this.theInventory[index];
|
||||
this.theInventory[index] = null;
|
||||
|
@ -73,9 +73,9 @@ public class InventoryMerchant implements IInventory
|
|||
}
|
||||
else
|
||||
{
|
||||
ItemStack itemstack = this.theInventory[index].splitStack(count);
|
||||
ItemStack itemstack = this.theInventory[index].split(count);
|
||||
|
||||
if (this.theInventory[index].size == 0)
|
||||
if (this.theInventory[index].isEmpty())
|
||||
{
|
||||
this.theInventory[index] = null;
|
||||
}
|
||||
|
@ -126,9 +126,9 @@ public class InventoryMerchant implements IInventory
|
|||
{
|
||||
this.theInventory[index] = stack;
|
||||
|
||||
if (stack != null && stack.size > this.getInventoryStackLimit())
|
||||
if (stack != null && stack.getSize() > this.getInventoryStackLimit())
|
||||
{
|
||||
stack.size = this.getInventoryStackLimit();
|
||||
stack.setSize(this.getInventoryStackLimit());
|
||||
}
|
||||
|
||||
if (this.inventoryResetNeededOnSlotChange(index))
|
||||
|
|
|
@ -72,7 +72,7 @@ public class InventoryPlayer implements IInventory
|
|||
{
|
||||
for (int i = 0; i < this.mainInventory.length; ++i)
|
||||
{
|
||||
if (this.mainInventory[i] != null && this.mainInventory[i].getItem() == itemStackIn.getItem() && this.mainInventory[i].isStackable() && this.mainInventory[i].size < this.mainInventory[i].getMaxStackSize() && this.mainInventory[i].size < this.getInventoryStackLimit() && ItemStack.areItemStackTagsEqual(this.mainInventory[i], itemStackIn))
|
||||
if (this.mainInventory[i] != null && this.mainInventory[i].getItem() == itemStackIn.getItem() && this.mainInventory[i].isStackable() && !this.mainInventory[i].isFull() && this.mainInventory[i].getSize() < this.getInventoryStackLimit() && ItemStack.dataEquals(this.mainInventory[i], itemStackIn))
|
||||
{
|
||||
return i;
|
||||
}
|
||||
|
@ -183,7 +183,7 @@ public class InventoryPlayer implements IInventory
|
|||
private int storePartialItemStack(ItemStack itemStackIn)
|
||||
{
|
||||
Item item = itemStackIn.getItem();
|
||||
int i = itemStackIn.size;
|
||||
int i = itemStackIn.getSize();
|
||||
int j = this.storeItemStack(itemStackIn);
|
||||
|
||||
if (j < 0)
|
||||
|
@ -206,14 +206,14 @@ public class InventoryPlayer implements IInventory
|
|||
|
||||
int k = i;
|
||||
|
||||
if (i > this.mainInventory[j].getMaxStackSize() - this.mainInventory[j].size)
|
||||
if (i > this.mainInventory[j].getMaxStackSize() - this.mainInventory[j].getSize())
|
||||
{
|
||||
k = this.mainInventory[j].getMaxStackSize() - this.mainInventory[j].size;
|
||||
k = this.mainInventory[j].getMaxStackSize() - this.mainInventory[j].getSize();
|
||||
}
|
||||
|
||||
if (k > this.getInventoryStackLimit() - this.mainInventory[j].size)
|
||||
if (k > this.getInventoryStackLimit() - this.mainInventory[j].getSize())
|
||||
{
|
||||
k = this.getInventoryStackLimit() - this.mainInventory[j].size;
|
||||
k = this.getInventoryStackLimit() - this.mainInventory[j].getSize();
|
||||
}
|
||||
|
||||
if (k == 0)
|
||||
|
@ -223,7 +223,7 @@ public class InventoryPlayer implements IInventory
|
|||
else
|
||||
{
|
||||
i = i - k;
|
||||
this.mainInventory[j].size += k;
|
||||
this.mainInventory[j].incrSize(k);
|
||||
// this.mainInventory[j].animationsToGo = 5;
|
||||
return i;
|
||||
}
|
||||
|
@ -258,7 +258,7 @@ public class InventoryPlayer implements IInventory
|
|||
}
|
||||
else
|
||||
{
|
||||
if (--this.mainInventory[i].size <= 0)
|
||||
if (this.mainInventory[i].decrSize())
|
||||
{
|
||||
this.mainInventory[i] = null;
|
||||
}
|
||||
|
@ -281,7 +281,7 @@ public class InventoryPlayer implements IInventory
|
|||
*/
|
||||
public boolean addItemStackToInventory(final ItemStack itemStackIn)
|
||||
{
|
||||
if (itemStackIn != null && itemStackIn.size != 0 && itemStackIn.getItem() != null)
|
||||
if (itemStackIn != null && !itemStackIn.isEmpty() && itemStackIn.getItem() != null)
|
||||
{
|
||||
if (itemStackIn.isItemDamaged())
|
||||
{
|
||||
|
@ -289,9 +289,9 @@ public class InventoryPlayer implements IInventory
|
|||
|
||||
if (j >= 0)
|
||||
{
|
||||
this.mainInventory[j] = ItemStack.copyItemStack(itemStackIn);
|
||||
this.mainInventory[j] = ItemStack.copy(itemStackIn);
|
||||
// this.mainInventory[j].animationsToGo = 5;
|
||||
itemStackIn.size = 0;
|
||||
itemStackIn.setSize(0);
|
||||
return true;
|
||||
}
|
||||
// else if (this.player.creative)
|
||||
|
@ -310,10 +310,10 @@ public class InventoryPlayer implements IInventory
|
|||
|
||||
while (true)
|
||||
{
|
||||
i = itemStackIn.size;
|
||||
itemStackIn.size = this.storePartialItemStack(itemStackIn);
|
||||
i = itemStackIn.getSize();
|
||||
itemStackIn.setSize(this.storePartialItemStack(itemStackIn));
|
||||
|
||||
if (itemStackIn.size <= 0 || itemStackIn.size >= i)
|
||||
if (itemStackIn.isEmpty() || itemStackIn.getSize() >= i)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
@ -326,7 +326,7 @@ public class InventoryPlayer implements IInventory
|
|||
// }
|
||||
// else
|
||||
// {
|
||||
return itemStackIn.size < i;
|
||||
return itemStackIn.getSize() < i;
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
@ -351,7 +351,7 @@ public class InventoryPlayer implements IInventory
|
|||
|
||||
if (aitemstack[index] != null)
|
||||
{
|
||||
if (aitemstack[index].size <= count)
|
||||
if (aitemstack[index].getSize() <= count)
|
||||
{
|
||||
ItemStack itemstack1 = aitemstack[index];
|
||||
aitemstack[index] = null;
|
||||
|
@ -359,9 +359,9 @@ public class InventoryPlayer implements IInventory
|
|||
}
|
||||
else
|
||||
{
|
||||
ItemStack itemstack = aitemstack[index].splitStack(count);
|
||||
ItemStack itemstack = aitemstack[index].split(count);
|
||||
|
||||
if (aitemstack[index].size == 0)
|
||||
if (aitemstack[index].isEmpty())
|
||||
{
|
||||
aitemstack[index] = null;
|
||||
}
|
||||
|
@ -422,7 +422,7 @@ public class InventoryPlayer implements IInventory
|
|||
|
||||
if (this.mainInventory[this.currentItem] != null)
|
||||
{
|
||||
f *= this.mainInventory[this.currentItem].getStrVsBlock(blockIn);
|
||||
f *= this.mainInventory[this.currentItem].getItem().getStrVsBlock(this.mainInventory[this.currentItem], blockIn);
|
||||
}
|
||||
|
||||
return f;
|
||||
|
@ -541,7 +541,7 @@ public class InventoryPlayer implements IInventory
|
|||
if(!block.getMaterial().isToolRequired())
|
||||
return true;
|
||||
ItemStack stack = this.getStackInSlot(this.currentItem);
|
||||
return stack != null && stack.canHarvestBlock(block);
|
||||
return stack != null && stack.getItem().canHarvestBlock(block);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -589,9 +589,9 @@ public class InventoryPlayer implements IInventory
|
|||
{
|
||||
if (this.armorInventory[i] != null && this.armorInventory[i].getItem() instanceof ItemArmor)
|
||||
{
|
||||
this.armorInventory[i].damageItem(damage, this.player);
|
||||
this.armorInventory[i].damage(damage, this.player);
|
||||
|
||||
if (this.armorInventory[i].size == 0)
|
||||
if (this.armorInventory[i].isEmpty())
|
||||
{
|
||||
this.armorInventory[i] = null;
|
||||
}
|
||||
|
@ -663,7 +663,7 @@ public class InventoryPlayer implements IInventory
|
|||
{
|
||||
for (int i = 0; i < this.armorInventory.length; ++i)
|
||||
{
|
||||
if (this.armorInventory[i] != null && this.armorInventory[i].isItemEqual(itemStackIn))
|
||||
if (this.armorInventory[i] != null && this.armorInventory[i].itemEquals(itemStackIn))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
@ -671,7 +671,7 @@ public class InventoryPlayer implements IInventory
|
|||
|
||||
for (int j = 0; j < this.mainInventory.length; ++j)
|
||||
{
|
||||
if (this.mainInventory[j] != null && this.mainInventory[j].isItemEqual(itemStackIn))
|
||||
if (this.mainInventory[j] != null && this.mainInventory[j].itemEquals(itemStackIn))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
@ -703,12 +703,12 @@ public class InventoryPlayer implements IInventory
|
|||
{
|
||||
for (int i = 0; i < this.mainInventory.length; ++i)
|
||||
{
|
||||
this.mainInventory[i] = ItemStack.copyItemStack(playerInventory.mainInventory[i]);
|
||||
this.mainInventory[i] = ItemStack.copy(playerInventory.mainInventory[i]);
|
||||
}
|
||||
|
||||
for (int j = 0; j < this.armorInventory.length; ++j)
|
||||
{
|
||||
this.armorInventory[j] = ItemStack.copyItemStack(playerInventory.armorInventory[j]);
|
||||
this.armorInventory[j] = ItemStack.copy(playerInventory.armorInventory[j]);
|
||||
}
|
||||
|
||||
this.currentItem = playerInventory.currentItem;
|
||||
|
|
|
@ -37,7 +37,7 @@ public class Slot
|
|||
{
|
||||
if (p_75220_1_.getItem() == p_75220_2_.getItem())
|
||||
{
|
||||
int i = p_75220_2_.size - p_75220_1_.size;
|
||||
int i = p_75220_2_.getSize() - p_75220_1_.getSize();
|
||||
|
||||
if (i > 0)
|
||||
{
|
||||
|
|
|
@ -35,7 +35,7 @@ public class SlotFurnaceOutput extends Slot
|
|||
{
|
||||
if (this.getHasStack())
|
||||
{
|
||||
this.smelted += Math.min(amount, this.getStack().size);
|
||||
this.smelted += Math.min(amount, this.getStack().getSize());
|
||||
}
|
||||
|
||||
return super.decrStackSize(amount);
|
||||
|
|
|
@ -35,7 +35,7 @@ public class SlotMerchantResult extends Slot
|
|||
{
|
||||
if (this.getHasStack())
|
||||
{
|
||||
this.traded += Math.min(amount, this.getStack().size);
|
||||
this.traded += Math.min(amount, this.getStack().getSize());
|
||||
}
|
||||
|
||||
return super.decrStackSize(amount);
|
||||
|
@ -76,12 +76,12 @@ public class SlotMerchantResult extends Slot
|
|||
// this.theMerchant.useRecipe(merchantrecipe);
|
||||
// playerIn.triggerAchievement(StatRegistry.timesTradedWithNpcStat);
|
||||
|
||||
if (itemstack != null && itemstack.size <= 0)
|
||||
if (itemstack != null && itemstack.isEmpty())
|
||||
{
|
||||
itemstack = null;
|
||||
}
|
||||
|
||||
if (itemstack1 != null && itemstack1.size <= 0)
|
||||
if (itemstack1 != null && itemstack1.isEmpty())
|
||||
{
|
||||
itemstack1 = null;
|
||||
}
|
||||
|
@ -101,14 +101,14 @@ public class SlotMerchantResult extends Slot
|
|||
{
|
||||
if (itemstack1 != null && secondItem != null && itemstack1.getItem() == secondItem.getItem())
|
||||
{
|
||||
firstItem.size -= itemstack.size;
|
||||
secondItem.size -= itemstack1.size;
|
||||
firstItem.decrSize(itemstack.getSize());
|
||||
secondItem.decrSize(itemstack1.getSize());
|
||||
return true;
|
||||
}
|
||||
|
||||
if (itemstack1 == null && secondItem == null)
|
||||
{
|
||||
firstItem.size -= itemstack.size;
|
||||
firstItem.decrSize(itemstack.getSize());
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -141,7 +141,7 @@ public class Item {
|
|||
entity.setThrowableHeading((double)facing.getFrontOffsetX(), (double)((float)facing.getFrontOffsetY() + 0.1F),
|
||||
(double)facing.getFrontOffsetZ(), velocity, inaccuracy);
|
||||
world.spawnEntityInWorld((Entity)entity);
|
||||
stack.splitStack(1);
|
||||
stack.split(1);
|
||||
return stack;
|
||||
}
|
||||
|
||||
|
@ -274,7 +274,7 @@ public class Item {
|
|||
}
|
||||
|
||||
public ItemStack dispenseStack(World world, TileEntity source, Vec3 position, BlockPos blockpos, Facing facing, ItemStack stack) {
|
||||
BlockDispenser.dispense(world, 6.0, facing, position, stack.splitStack(1));
|
||||
BlockDispenser.dispense(world, 6.0, facing, position, stack.split(1));
|
||||
return stack;
|
||||
}
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -33,9 +33,7 @@ public class RngLoot extends RngItem
|
|||
public ItemStack getItem(Random rand) {
|
||||
if(this.item == null)
|
||||
return null;
|
||||
ItemStack stack = this.item.copy();
|
||||
stack.size = this.minStackSize + rand.zrange(this.maxStackSize - this.minStackSize + 1);
|
||||
return stack;
|
||||
return this.item.copy(this.minStackSize + rand.zrange(this.maxStackSize - this.minStackSize + 1));
|
||||
}
|
||||
|
||||
public static void generateChestContents(Random random, WeightedList<RngLoot> list, IInventory inv, int max)
|
||||
|
@ -47,17 +45,13 @@ public class RngLoot extends RngItem
|
|||
|
||||
if (loot.item.getMaxStackSize() >= j)
|
||||
{
|
||||
ItemStack itemstack1 = loot.item.copy();
|
||||
itemstack1.size = j;
|
||||
inv.setInventorySlotContents(random.zrange(inv.getSizeInventory()), itemstack1);
|
||||
inv.setInventorySlotContents(random.zrange(inv.getSizeInventory()), loot.item.copy(j));
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int k = 0; k < j; ++k)
|
||||
{
|
||||
ItemStack itemstack = loot.item.copy();
|
||||
itemstack.size = 1;
|
||||
inv.setInventorySlotContents(random.zrange(inv.getSizeInventory()), itemstack);
|
||||
inv.setInventorySlotContents(random.zrange(inv.getSizeInventory()), loot.item.copy(1));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -72,17 +66,13 @@ public class RngLoot extends RngItem
|
|||
|
||||
if (loot.item.getMaxStackSize() >= j)
|
||||
{
|
||||
ItemStack itemstack1 = loot.item.copy();
|
||||
itemstack1.size = j;
|
||||
dispenser.setInventorySlotContents(random.zrange(dispenser.getSizeInventory()), itemstack1);
|
||||
dispenser.setInventorySlotContents(random.zrange(dispenser.getSizeInventory()), loot.item.copy(j));
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int k = 0; k < j; ++k)
|
||||
{
|
||||
ItemStack itemstack = loot.item.copy();
|
||||
itemstack.size = 1;
|
||||
dispenser.setInventorySlotContents(random.zrange(dispenser.getSizeInventory()), itemstack);
|
||||
dispenser.setInventorySlotContents(random.zrange(dispenser.getSizeInventory()), loot.item.copy(1));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -73,7 +73,7 @@ public class ItemBed extends Item
|
|||
worldIn.setState(blockpos, iblockstate2, 3);
|
||||
}
|
||||
|
||||
--stack.size;
|
||||
stack.decrSize();
|
||||
return true;
|
||||
}
|
||||
else
|
||||
|
|
|
@ -61,7 +61,7 @@ public class ItemBlock extends Item
|
|||
pos = pos.offset(side);
|
||||
}
|
||||
|
||||
if (stack.size == 0)
|
||||
if (stack.isEmpty())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
@ -83,7 +83,7 @@ public class ItemBlock extends Item
|
|||
}
|
||||
|
||||
worldIn.playSound(this.block.sound.getPlaceSound(), (double)((float)pos.getX() + 0.5F), (double)((float)pos.getY() + 0.5F), (double)((float)pos.getZ() + 0.5F), 1.0F);
|
||||
--stack.size;
|
||||
stack.decrSize();
|
||||
}
|
||||
|
||||
return true;
|
||||
|
|
|
@ -61,7 +61,7 @@ public class ItemDoor extends Item
|
|||
else
|
||||
{
|
||||
placeDoor(worldIn, pos, Facing.fromAngle((double)playerIn.rotYaw), this.block, true);
|
||||
--stack.size;
|
||||
stack.decrSize();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -50,7 +50,7 @@ public class ItemLilyPad extends ItemColored
|
|||
|
||||
// if (!playerIn.creative)
|
||||
// {
|
||||
--itemStackIn.size;
|
||||
itemStackIn.decrSize();
|
||||
// }
|
||||
|
||||
// playerIn.triggerAchievement(StatRegistry.objectUseStats[ItemRegistry.getIdFromItem(this)]);
|
||||
|
|
|
@ -48,7 +48,7 @@ public class ItemMetalBlock extends ItemBlock {
|
|||
}
|
||||
|
||||
public float getRadiation(ItemStack stack) {
|
||||
return this.metal.radioactivity * (this.ore ? 0.5f : 2.0f) * (float)stack.size;
|
||||
return this.metal.radioactivity * (this.ore ? 0.5f : 2.0f) * (float)stack.getSize();
|
||||
}
|
||||
|
||||
public boolean isMagnetic() {
|
||||
|
|
|
@ -48,7 +48,7 @@ public class ItemRedstone extends Item
|
|||
}
|
||||
else if (this.block.canPlaceBlockAt(worldIn, blockpos))
|
||||
{
|
||||
--stack.size;
|
||||
stack.decrSize();
|
||||
worldIn.setState(blockpos, this.block.getState());
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -44,7 +44,7 @@ public class ItemSeedFood extends ItemFood
|
|||
else if (worldIn.getState(pos).getBlock() == this.soil && worldIn.isAirBlock(pos.up()))
|
||||
{
|
||||
worldIn.setState(pos.up(), this.crops.getState());
|
||||
--stack.size;
|
||||
stack.decrSize();
|
||||
return true;
|
||||
}
|
||||
else
|
||||
|
|
|
@ -44,7 +44,7 @@ public class ItemSeeds extends Item
|
|||
else if (worldIn.getState(pos).getBlock() == this.soil && worldIn.isAirBlock(pos.up()))
|
||||
{
|
||||
worldIn.setState(pos.up(), this.crops.getState());
|
||||
--stack.size;
|
||||
stack.decrSize();
|
||||
return true;
|
||||
}
|
||||
else
|
||||
|
|
|
@ -71,7 +71,7 @@ public class ItemSign extends Item
|
|||
worldIn.setState(pos, Blocks.wall_sign.getState().withProperty(BlockWallSign.FACING, side), 3);
|
||||
}
|
||||
|
||||
--stack.size;
|
||||
stack.decrSize();
|
||||
TileEntity tileentity = worldIn.getTileEntity(pos);
|
||||
|
||||
if (tileentity instanceof TileEntitySign)
|
||||
|
|
|
@ -18,7 +18,7 @@ public class ItemSlab extends ItemBlock {
|
|||
}
|
||||
|
||||
public boolean onItemUse(ItemStack stack, EntityNPC playerIn, World worldIn, BlockPos pos, Facing side, float hitX, float hitY, float hitZ) {
|
||||
return stack.size != 0 && playerIn.canPlayerEdit(pos.offset(side), side, stack) &&
|
||||
return !stack.isEmpty() && playerIn.canPlayerEdit(pos.offset(side), side, stack) &&
|
||||
(this.tryVerticalPlace(stack, playerIn, worldIn, pos, side, hitX, hitY, hitZ) || super.onItemUse(stack, playerIn, worldIn, pos, side, hitX, hitY, hitZ));
|
||||
}
|
||||
|
||||
|
@ -33,7 +33,7 @@ public class ItemSlab extends ItemBlock {
|
|||
if(worldIn.setState(pos, place, 3)) {
|
||||
worldIn.playSound(this.slab.sound.getPlaceSound(), (double)((float)pos.getX() + 0.5F), (double)((float)pos.getY() + 0.5F),
|
||||
(double)((float)pos.getZ() + 0.5F), 1.0F);
|
||||
--stack.size;
|
||||
stack.decrSize();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -31,7 +31,7 @@ public class ItemSmallBlock extends Item {
|
|||
else if(!block.isReplaceable(world, pos))
|
||||
pos = pos.offset(side);
|
||||
|
||||
if(!player.canPlayerEdit(pos, side, stack) || stack.size == 0)
|
||||
if(!player.canPlayerEdit(pos, side, stack) || stack.isEmpty())
|
||||
return false;
|
||||
if(world.canBlockBePlaced(this.block, pos, false, side, null, stack)) {
|
||||
State newState = this.block.onBlockPlaced(world, pos, side, hitX, hitY, hitZ, player);
|
||||
|
@ -45,7 +45,7 @@ public class ItemSmallBlock extends Item {
|
|||
|
||||
world.playSound(this.block.sound.getPlaceSound(), (double)((float)pos.getX() + 0.5F), (double)((float)pos.getY() + 0.5F),
|
||||
(double)((float)pos.getZ() + 0.5F), 1.0F);
|
||||
--stack.size;
|
||||
stack.decrSize();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,7 +19,7 @@ public class ItemSnow extends ItemBlock
|
|||
|
||||
public boolean onItemUse(ItemStack stack, EntityNPC playerIn, World worldIn, BlockPos pos, Facing side, float hitX, float hitY, float hitZ)
|
||||
{
|
||||
if (stack.size == 0)
|
||||
if (stack.isEmpty())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
@ -52,7 +52,7 @@ public class ItemSnow extends ItemBlock
|
|||
if (axisalignedbb != null && worldIn.checkNoEntityCollision(axisalignedbb) && worldIn.setState(blockpos, iblockstate1, 2))
|
||||
{
|
||||
worldIn.playSound(this.block.sound.getPlaceSound(), (double)((float)blockpos.getX() + 0.5F), (double)((float)blockpos.getY() + 0.5F), (double)((float)blockpos.getZ() + 0.5F), 1.0F);
|
||||
--stack.size;
|
||||
stack.decrSize();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,7 +26,7 @@ public class ItemTNT extends ItemBlock {
|
|||
EntityTnt entitytntprimed = new EntityTnt(world, (double)blockpos.getX() + 0.5D, (double)blockpos.getY(), (double)blockpos.getZ() + 0.5D, (EntityLiving)null, this.power);
|
||||
world.spawnEntityInWorld(entitytntprimed);
|
||||
world.playSoundAtEntity(entitytntprimed, SoundEvent.FUSE, 1.0F);
|
||||
--stack.size;
|
||||
stack.decrSize();
|
||||
return stack;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,15 +3,12 @@ package common.item.material;
|
|||
import common.item.Item;
|
||||
import common.item.ItemStack;
|
||||
|
||||
public class ItemBook extends Item
|
||||
{
|
||||
public boolean canEnchant(ItemStack stack)
|
||||
{
|
||||
return stack.size == 1;
|
||||
}
|
||||
public class ItemBook extends Item {
|
||||
public boolean canEnchant(ItemStack stack) {
|
||||
return stack.getSize() == 1;
|
||||
}
|
||||
|
||||
public int getItemEnchantability()
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
public int getItemEnchantability() {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -92,7 +92,7 @@ public class ItemDye extends Item {
|
|||
|
||||
// if (!playerIn.creative)
|
||||
// {
|
||||
--stack.size;
|
||||
stack.decrSize();
|
||||
// }
|
||||
}
|
||||
|
||||
|
@ -125,7 +125,7 @@ public class ItemDye extends Item {
|
|||
worldIn.setState(pos, iblockstate1, 2);
|
||||
}
|
||||
// if(!playerIn.creative)
|
||||
--stack.size;
|
||||
stack.decrSize();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -151,7 +151,7 @@ public class ItemDye extends Item {
|
|||
igrowable.grow((AWorldServer)worldIn, worldIn.rand, target, iblockstate);
|
||||
}
|
||||
|
||||
--stack.size;
|
||||
stack.decrSize();
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@ -196,7 +196,7 @@ public class ItemDye extends Item {
|
|||
if (!entitysheep.getSheared() && entitysheep.getFleeceColor() != this.color)
|
||||
{
|
||||
entitysheep.setFleeceColor(this.color);
|
||||
--stack.size;
|
||||
stack.decrSize();
|
||||
}
|
||||
|
||||
return true;
|
||||
|
|
|
@ -40,7 +40,7 @@ public class ItemMetal extends Item {
|
|||
}
|
||||
|
||||
public float getRadiation(ItemStack stack) {
|
||||
return this.metal.radioactivity * 0.25f * (float)stack.size;
|
||||
return this.metal.radioactivity * 0.25f * (float)stack.getSize();
|
||||
}
|
||||
|
||||
public boolean isMagnetic() {
|
||||
|
|
|
@ -106,7 +106,7 @@ public class ItemBoat extends Item
|
|||
|
||||
// if (!playerIn.creative)
|
||||
// {
|
||||
--itemStackIn.size;
|
||||
itemStackIn.decrSize();
|
||||
// }
|
||||
|
||||
// playerIn.triggerAchievement(StatRegistry.objectUseStats[ItemRegistry.getIdFromItem(this)]);
|
||||
|
@ -141,7 +141,7 @@ public class ItemBoat extends Item
|
|||
|
||||
EntityBoat entityboat = new EntityBoat(world, d0, d1 + d3, d2);
|
||||
world.spawnEntityInWorld(entityboat);
|
||||
stack.splitStack(1);
|
||||
stack.split(1);
|
||||
return stack;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -67,7 +67,7 @@ public class ItemMinecart extends Item
|
|||
// ((EntityMinecartCommandBlock)entityminecart).getCommandBlockLogic().setEnabled(((EntityNPCMP)playerIn).canUse(Permissions.CMDBLOCK));
|
||||
}
|
||||
|
||||
--stack.size;
|
||||
stack.decrSize();
|
||||
return true;
|
||||
}
|
||||
else
|
||||
|
@ -128,7 +128,7 @@ public class ItemMinecart extends Item
|
|||
}
|
||||
|
||||
world.spawnEntityInWorld(entityminecart);
|
||||
stack.splitStack(1);
|
||||
stack.split(1);
|
||||
return stack;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -108,7 +108,7 @@ public class ItemMonsterPlacer extends Item
|
|||
|
||||
// if (!playerIn.creative)
|
||||
// {
|
||||
--stack.size;
|
||||
stack.decrSize();
|
||||
// }
|
||||
}
|
||||
// }
|
||||
|
@ -170,7 +170,7 @@ public class ItemMonsterPlacer extends Item
|
|||
|
||||
// if (!playerIn.creative)
|
||||
// {
|
||||
--itemStackIn.size;
|
||||
itemStackIn.decrSize();
|
||||
// }
|
||||
|
||||
// if(z == 0)
|
||||
|
@ -239,7 +239,7 @@ public class ItemMonsterPlacer extends Item
|
|||
Entity entity = spawnCreature(world, this.entityId, d0, d1, d2, false);
|
||||
if (entity instanceof EntityLiving && stack.hasDisplayName())
|
||||
((EntityLiving)entity).setCustomNameTag(stack.getDisplayName());
|
||||
stack.splitStack(1);
|
||||
stack.split(1);
|
||||
return stack;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -106,7 +106,7 @@ public class ItemNpcSpawner extends Item
|
|||
|
||||
// if (!playerIn.creative)
|
||||
// {
|
||||
--stack.size;
|
||||
stack.decrSize();
|
||||
// }
|
||||
}
|
||||
// }
|
||||
|
@ -160,7 +160,7 @@ public class ItemNpcSpawner extends Item
|
|||
|
||||
// if (!playerIn.creative)
|
||||
// {
|
||||
--itemStackIn.size;
|
||||
itemStackIn.decrSize();
|
||||
// }
|
||||
|
||||
// if(z == 0)
|
||||
|
@ -228,7 +228,7 @@ public class ItemNpcSpawner extends Item
|
|||
Entity entity = spawnNpc(world, this.spawned, d0, d1, d2, false);
|
||||
if (entity instanceof EntityLiving && stack.hasDisplayName())
|
||||
((EntityLiving)entity).setCustomNameTag(stack.getDisplayName());
|
||||
stack.splitStack(1);
|
||||
stack.split(1);
|
||||
return stack;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -97,7 +97,7 @@ public class ItemArmor extends Item
|
|||
if (itemstack == null)
|
||||
{
|
||||
playerIn.setItem(i, itemStackIn.copy());
|
||||
itemStackIn.size = 0;
|
||||
itemStackIn.setSize(0);
|
||||
}
|
||||
|
||||
return itemStackIn;
|
||||
|
@ -180,11 +180,10 @@ public class ItemArmor extends Item
|
|||
EntityLiving entitylivingbase = (EntityLiving)list.get(0);
|
||||
int l = entitylivingbase.isPlayer() ? 1 : 0;
|
||||
int i1 = getArmorPosition(stack);
|
||||
ItemStack itemstack = stack.copy();
|
||||
itemstack.size = 1;
|
||||
ItemStack itemstack = stack.copy(1);
|
||||
entitylivingbase.setItem(i1 - l, itemstack);
|
||||
|
||||
--stack.size;
|
||||
stack.decrSize();
|
||||
return stack;
|
||||
}
|
||||
else
|
||||
|
|
|
@ -70,7 +70,7 @@ public class ItemBow extends Item
|
|||
entityarrow.setFire(100);
|
||||
}
|
||||
|
||||
stack.damageItem(1, playerIn);
|
||||
stack.damage(1, playerIn);
|
||||
worldIn.playSoundAtEntity(playerIn, SoundEvent.THROW, 1.0F);
|
||||
|
||||
if (flag)
|
||||
|
|
|
@ -185,7 +185,7 @@ public class ItemBucket extends Item
|
|||
setRecursive((AWorldServer)worldIn, blockpos, 4, null);
|
||||
// playerIn.triggerAchievement(StatRegistry.objectUseStats[ItemRegistry.getIdFromItem(this)]);
|
||||
// if(!playerIn.creative)
|
||||
--itemStackIn.size;
|
||||
itemStackIn.decrSize();
|
||||
return itemStackIn;
|
||||
}
|
||||
}
|
||||
|
@ -217,7 +217,7 @@ public class ItemBucket extends Item
|
|||
{
|
||||
// playerIn.triggerAchievement(StatRegistry.objectUseStats[ItemRegistry.getIdFromItem(this)]);
|
||||
if(this.recursive) {
|
||||
--itemStackIn.size;
|
||||
itemStackIn.decrSize();
|
||||
return itemStackIn;
|
||||
}
|
||||
return new ItemStack(Items.bucket);
|
||||
|
@ -236,7 +236,7 @@ public class ItemBucket extends Item
|
|||
// return emptyBuckets;
|
||||
// }
|
||||
// else
|
||||
if (--emptyBuckets.size <= 0)
|
||||
if (emptyBuckets.decrSize())
|
||||
{
|
||||
return fullBucket;
|
||||
}
|
||||
|
@ -346,10 +346,10 @@ public class ItemBucket extends Item
|
|||
|
||||
world.setBlockToAir(pos);
|
||||
|
||||
if (--stack.size == 0)
|
||||
if (stack.decrSize())
|
||||
{
|
||||
stack.setItem(item);
|
||||
stack.size = 1;
|
||||
stack.setSize(1);
|
||||
}
|
||||
else if (source instanceof TileEntityDispenser dispenser && dispenser.addItemStack(new ItemStack(item)) < 0)
|
||||
{
|
||||
|
@ -364,7 +364,7 @@ public class ItemBucket extends Item
|
|||
if (this.tryPlaceContainedLiquid(world, pos))
|
||||
{
|
||||
stack.setItem(Items.bucket);
|
||||
stack.size = 1;
|
||||
stack.setSize(1);
|
||||
return stack;
|
||||
}
|
||||
else
|
||||
|
|
|
@ -27,7 +27,7 @@ public class ItemBucketMilk extends Item
|
|||
{
|
||||
// if (!playerIn.creative)
|
||||
// {
|
||||
--stack.size;
|
||||
stack.decrSize();
|
||||
// }
|
||||
|
||||
if (!worldIn.client)
|
||||
|
@ -36,7 +36,7 @@ public class ItemBucketMilk extends Item
|
|||
}
|
||||
|
||||
// playerIn.triggerAchievement(StatRegistry.objectUseStats[ItemRegistry.getIdFromItem(this)]);
|
||||
return stack.size <= 0 ? new ItemStack(Items.bucket) : stack;
|
||||
return stack.isEmpty() ? new ItemStack(Items.bucket) : stack;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -46,9 +46,9 @@ public class ItemCarrotOnAStick extends Item
|
|||
if (entitypig.getAIControlledByPlayer().isControlledByPlayer() && itemStackIn.getMaxDamage() - itemStackIn.getItemDamage() >= 7)
|
||||
{
|
||||
entitypig.getAIControlledByPlayer().boostSpeed();
|
||||
itemStackIn.damageItem(7, playerIn);
|
||||
itemStackIn.damage(7, playerIn);
|
||||
|
||||
if (itemStackIn.size == 0)
|
||||
if (itemStackIn.isEmpty())
|
||||
{
|
||||
ItemStack itemstack = new ItemStack(Items.fishing_rod);
|
||||
itemstack.copyData(itemStackIn);
|
||||
|
|
|
@ -33,7 +33,7 @@ public class ItemChargedOrb extends ItemFragile
|
|||
// }
|
||||
if(itemStackIn.getItemDamage() >= this.getMaxDamage())
|
||||
return itemStackIn;
|
||||
itemStackIn.damageItem(1, playerIn);
|
||||
itemStackIn.damage(1, playerIn);
|
||||
worldIn.playSoundAtEntity(playerIn, SoundEvent.THROW, 0.5F);
|
||||
|
||||
if (!worldIn.client)
|
||||
|
@ -49,7 +49,7 @@ public class ItemChargedOrb extends ItemFragile
|
|||
{
|
||||
State iblockstate = worldIn.getState(pos);
|
||||
|
||||
if (stack.getItemDamage() == 0 && playerIn.canPlayerEdit(pos.offset(side), side, stack) /* && worldIn.dimension.getDimensionId() == 0 || worldIn.dimension.getDimensionId() == 1) */ && iblockstate.getBlock() == Blocks.portal_frame && !((Boolean)iblockstate.getValue(BlockPortalFrame.ORB)).booleanValue())
|
||||
if (!stack.isItemDamaged() && playerIn.canPlayerEdit(pos.offset(side), side, stack) /* && worldIn.dimension.getDimensionId() == 0 || worldIn.dimension.getDimensionId() == 1) */ && iblockstate.getBlock() == Blocks.portal_frame && !((Boolean)iblockstate.getValue(BlockPortalFrame.ORB)).booleanValue())
|
||||
{
|
||||
if (worldIn.client)
|
||||
{
|
||||
|
@ -59,7 +59,7 @@ public class ItemChargedOrb extends ItemFragile
|
|||
{
|
||||
worldIn.setState(pos, iblockstate.withProperty(BlockPortalFrame.ORB, Boolean.valueOf(true)), 2);
|
||||
worldIn.updateComparatorOutputLevel(pos, Blocks.portal_frame);
|
||||
--stack.size;
|
||||
stack.decrSize();
|
||||
|
||||
for (int i = 0; i < 16; ++i)
|
||||
{
|
||||
|
|
|
@ -66,7 +66,7 @@ public class ItemDie extends Item
|
|||
{
|
||||
// if (!playerIn.creative)
|
||||
// {
|
||||
--itemStackIn.size;
|
||||
itemStackIn.decrSize();
|
||||
// }
|
||||
|
||||
worldIn.playSoundAtEntity(playerIn, SoundEvent.THROW, 0.5F);
|
||||
|
|
|
@ -33,7 +33,7 @@ public class ItemDynamite extends Item {
|
|||
}
|
||||
|
||||
public ItemStack onItemRightClick(ItemStack stack, World world, EntityNPC player) {
|
||||
--stack.size;
|
||||
stack.decrSize();
|
||||
world.playSoundAtEntity(player, SoundEvent.THROW, 0.5F);
|
||||
if(!world.client)
|
||||
world.spawnEntityInWorld(new EntityDynamite(world, player, this.power));
|
||||
|
|
|
@ -26,7 +26,7 @@ public class ItemEgg extends Item
|
|||
{
|
||||
// if (!playerIn.creative)
|
||||
// {
|
||||
--itemStackIn.size;
|
||||
itemStackIn.decrSize();
|
||||
// }
|
||||
|
||||
worldIn.playSoundAtEntity(playerIn, SoundEvent.THROW, 0.5F);
|
||||
|
|
|
@ -31,7 +31,7 @@ public class ItemExpBottle extends Item
|
|||
{
|
||||
// if (!playerIn.creative)
|
||||
// {
|
||||
--itemStackIn.size;
|
||||
itemStackIn.decrSize();
|
||||
// }
|
||||
|
||||
worldIn.playSoundAtEntity(playerIn, SoundEvent.THROW, 0.5F);
|
||||
|
|
|
@ -47,7 +47,7 @@ public class ItemFireball extends Item
|
|||
|
||||
// if (!playerIn.creative)
|
||||
// {
|
||||
--stack.size;
|
||||
stack.decrSize();
|
||||
// }
|
||||
|
||||
return true;
|
||||
|
@ -63,7 +63,7 @@ public class ItemFireball extends Item
|
|||
double d4 = world.rand.gaussian() * 0.05D + (double)facing.getFrontOffsetY();
|
||||
double d5 = world.rand.gaussian() * 0.05D + (double)facing.getFrontOffsetZ();
|
||||
world.spawnEntityInWorld(new EntityFireCharge(world, d0, d1, d2, d3, d4, d5));
|
||||
stack.splitStack(1);
|
||||
stack.split(1);
|
||||
return stack;
|
||||
}
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@ public class ItemFirework extends Item
|
|||
|
||||
// if (!playerIn.creative)
|
||||
// {
|
||||
--stack.size;
|
||||
stack.decrSize();
|
||||
// }
|
||||
|
||||
return true;
|
||||
|
@ -38,7 +38,7 @@ public class ItemFirework extends Item
|
|||
double d2 = blockpos.getZ() + 0.5 + (double)facing.getFrontOffsetZ();
|
||||
EntityFireworks entityfireworkrocket = new EntityFireworks(world, d0, d1, d2);
|
||||
world.spawnEntityInWorld(entityfireworkrocket);
|
||||
stack.splitStack(1);
|
||||
stack.split(1);
|
||||
return stack;
|
||||
}
|
||||
|
||||
|
|
|
@ -42,7 +42,7 @@ public class ItemFishingRod extends Item
|
|||
if (playerIn.fishEntity != null)
|
||||
{
|
||||
int i = playerIn.fishEntity.handleHookRetraction();
|
||||
itemStackIn.damageItem(i, playerIn);
|
||||
itemStackIn.damage(i, playerIn);
|
||||
playerIn.swingItem();
|
||||
}
|
||||
else
|
||||
|
|
|
@ -44,7 +44,7 @@ public class ItemFlintAndSteel extends Item
|
|||
worldIn.setState(pos, this.fireBlock.getState());
|
||||
}
|
||||
|
||||
stack.damageItem(1, playerIn);
|
||||
stack.damage(1, playerIn);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -60,10 +60,7 @@ public class ItemFlintAndSteel extends Item
|
|||
{
|
||||
world.setState(pos, this.fireBlock.getState());
|
||||
|
||||
if (stack.attemptDamageItem(1, world.rand))
|
||||
{
|
||||
stack.size = 0;
|
||||
}
|
||||
stack.damage(1, null, world.rand);
|
||||
world.playAuxSFX(1000, blockpos, 0);
|
||||
}
|
||||
else if (world.getState(pos).getBlock() instanceof BlockTNT tnt)
|
||||
|
|
|
@ -35,7 +35,7 @@ public class ItemFood extends Item
|
|||
public ItemStack onItemUseFinish(ItemStack stack, World worldIn, EntityNPC playerIn)
|
||||
{
|
||||
// if(!playerIn.creative)
|
||||
--stack.size;
|
||||
stack.decrSize();
|
||||
worldIn.playSoundAtEntity(playerIn, SoundEvent.EAT, 0.5F);
|
||||
playerIn.heal((int)((float)this.getHealAmount(stack) * 0.5f * (1.0f + worldIn.rand.floatv())));
|
||||
this.onFoodEaten(stack, worldIn, playerIn);
|
||||
|
|
|
@ -48,10 +48,9 @@ public class ItemGlassBottle extends Item
|
|||
|
||||
if (worldIn.getState(blockpos).getBlock().getMaterial() == Material.WATER)
|
||||
{
|
||||
--itemStackIn.size;
|
||||
// playerIn.triggerAchievement(StatRegistry.objectUseStats[ItemRegistry.getIdFromItem(this)]);
|
||||
|
||||
if (itemStackIn.size <= 0)
|
||||
if (itemStackIn.decrSize())
|
||||
{
|
||||
return new ItemStack(Items.potion);
|
||||
}
|
||||
|
|
|
@ -58,7 +58,7 @@ public abstract class ItemGunBase extends Item
|
|||
// entityarrow.setFire(100);
|
||||
// }
|
||||
|
||||
stack.damageItem(1, playerIn);
|
||||
stack.damage(1, playerIn);
|
||||
worldIn.playSoundAtEntity(playerIn, SoundEvent.EXPLODE_ALT, 1.0F);
|
||||
|
||||
if(!flag)
|
||||
|
|
|
@ -74,7 +74,7 @@ public class ItemHoe extends Item
|
|||
else
|
||||
{
|
||||
worldIn.setState(target, newState);
|
||||
stack.damageItem(1, player);
|
||||
stack.damage(1, player);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -27,7 +27,7 @@ public class ItemNameTag extends Item
|
|||
EntityLiving entityliving = (EntityLiving)target;
|
||||
entityliving.setCustomNameTag(stack.getDisplayName());
|
||||
// entityliving.disableDespawn();
|
||||
--stack.size;
|
||||
stack.decrSize();
|
||||
return true;
|
||||
}
|
||||
else
|
||||
|
|
|
@ -77,7 +77,7 @@ public class ItemPotion extends Item
|
|||
{
|
||||
// if (!playerIn.creative)
|
||||
// {
|
||||
--stack.size;
|
||||
stack.decrSize();
|
||||
// }
|
||||
|
||||
if (!worldIn.client)
|
||||
|
@ -100,7 +100,7 @@ public class ItemPotion extends Item
|
|||
|
||||
// if (!playerIn.creative)
|
||||
// {
|
||||
if (stack.size <= 0)
|
||||
if (stack.isEmpty())
|
||||
{
|
||||
return new ItemStack(Items.glass_bottle);
|
||||
}
|
||||
|
@ -136,7 +136,7 @@ public class ItemPotion extends Item
|
|||
{
|
||||
// if (!playerIn.creative)
|
||||
// {
|
||||
--itemStackIn.size;
|
||||
itemStackIn.decrSize();
|
||||
// }
|
||||
|
||||
worldIn.playSoundAtEntity(playerIn, SoundEvent.THROW, 0.5F);
|
||||
|
|
|
@ -28,7 +28,7 @@ public class ItemSaddle extends Item
|
|||
{
|
||||
entitypig.setSaddled(true);
|
||||
// entitypig.worldObj.playSoundAtEntity(entitypig, "mob.horse.leather", 0.5F, 1.0F);
|
||||
--stack.size;
|
||||
stack.decrSize();
|
||||
}
|
||||
|
||||
return true;
|
||||
|
|
|
@ -30,7 +30,7 @@ public class ItemShears extends Item
|
|||
}
|
||||
else
|
||||
{
|
||||
stack.damageItem(1, playerIn);
|
||||
stack.damage(1, playerIn);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,7 +26,7 @@ public class ItemSnowball extends Item
|
|||
{
|
||||
// if (!playerIn.creative)
|
||||
// {
|
||||
--itemStackIn.size;
|
||||
itemStackIn.decrSize();
|
||||
// }
|
||||
|
||||
worldIn.playSoundAtEntity(playerIn, SoundEvent.THROW, 0.5F);
|
||||
|
|
|
@ -59,7 +59,7 @@ public class ItemSword extends Item
|
|||
*/
|
||||
public boolean hitEntity(ItemStack stack, EntityLiving target, EntityLiving attacker)
|
||||
{
|
||||
stack.damageItem(1, attacker);
|
||||
stack.damage(1, attacker);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -70,7 +70,7 @@ public class ItemSword extends Item
|
|||
{
|
||||
if ((double)blockIn.getBlockHardness(worldIn, pos) != 0.0D)
|
||||
{
|
||||
stack.damageItem(2, playerIn);
|
||||
stack.damage(2, playerIn);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
|
|
@ -30,13 +30,13 @@ public abstract class ItemTool extends Item {
|
|||
}
|
||||
|
||||
public boolean hitEntity(ItemStack stack, EntityLiving target, EntityLiving attacker) {
|
||||
stack.damageItem(2, attacker);
|
||||
stack.damage(2, attacker);
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean onBlockDestroyed(ItemStack stack, World world, Block block, BlockPos pos, EntityLiving player) {
|
||||
if(block.getBlockHardness(world, pos) != 0.0f)
|
||||
stack.damageItem(1, player);
|
||||
stack.damage(1, player);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@ public class ItemWeatherToken extends ItemMagnetic {
|
|||
{
|
||||
if(worldIn.dimension.getType().weather) {
|
||||
// if (!playerIn.creative)
|
||||
--itemStackIn.size;
|
||||
itemStackIn.decrSize();
|
||||
worldIn.playSoundAtEntity(playerIn, SoundEvent.SPELL, 0.5F);
|
||||
if (!worldIn.client)
|
||||
{
|
||||
|
|
|
@ -121,10 +121,10 @@ public class PacketBuffer {
|
|||
return;
|
||||
}
|
||||
this.writeShort(ItemRegistry.getId(stack.getItem()));
|
||||
this.writeVarInt(stack.size);
|
||||
if(stack.canBeDyed())
|
||||
this.writeVarInt(stack.getSize());
|
||||
if(stack.getItem().canBeDyed())
|
||||
this.writeVarInt(stack.getRawColor());
|
||||
if(stack.isItemStackDamageable())
|
||||
if(stack.getItem().isDamageable())
|
||||
this.writeVarInt(stack.getItemDamage());
|
||||
this.writeVarInt(stack.getRepairCost());
|
||||
this.writeString(stack.hasDisplayName() ? stack.getDisplayName() : "");
|
||||
|
@ -143,9 +143,9 @@ public class PacketBuffer {
|
|||
if(id < 0)
|
||||
return null;
|
||||
ItemStack stack = new ItemStack(ItemRegistry.byId(id), this.readVarInt());
|
||||
if(stack.canBeDyed())
|
||||
if(stack.getItem().canBeDyed())
|
||||
stack.setColor(this.readVarInt());
|
||||
if(stack.isItemStackDamageable())
|
||||
if(stack.getItem().isDamageable())
|
||||
stack.setItemDamage(this.readVarInt());
|
||||
stack.setRepairCost(this.readVarInt());
|
||||
stack.setStackDisplayName(this.readString(32));
|
||||
|
|
|
@ -129,7 +129,7 @@ public class TileEntityBrewingStand extends TileEntityLockable implements ITicka
|
|||
|
||||
private boolean canBrew()
|
||||
{
|
||||
if (this.brewingItemStacks[3] != null && this.brewingItemStacks[3].size > 0)
|
||||
if (this.brewingItemStacks[3] != null && !this.brewingItemStacks[3].isEmpty())
|
||||
{
|
||||
ItemStack itemstack = this.brewingItemStacks[3];
|
||||
|
||||
|
@ -207,9 +207,7 @@ public class TileEntityBrewingStand extends TileEntityLockable implements ITicka
|
|||
}
|
||||
else
|
||||
{
|
||||
--this.brewingItemStacks[3].size;
|
||||
|
||||
if (this.brewingItemStacks[3].size <= 0)
|
||||
if (this.brewingItemStacks[3].decrSize())
|
||||
{
|
||||
this.brewingItemStacks[3] = null;
|
||||
}
|
||||
|
|
|
@ -83,7 +83,7 @@ public class TileEntityChest extends TileEntityLockable implements ITickable, II
|
|||
{
|
||||
if (this.chestContents[index] != null)
|
||||
{
|
||||
if (this.chestContents[index].size <= count)
|
||||
if (this.chestContents[index].getSize() <= count)
|
||||
{
|
||||
ItemStack itemstack1 = this.chestContents[index];
|
||||
this.chestContents[index] = null;
|
||||
|
@ -92,9 +92,9 @@ public class TileEntityChest extends TileEntityLockable implements ITickable, II
|
|||
}
|
||||
else
|
||||
{
|
||||
ItemStack itemstack = this.chestContents[index].splitStack(count);
|
||||
ItemStack itemstack = this.chestContents[index].split(count);
|
||||
|
||||
if (this.chestContents[index].size == 0)
|
||||
if (this.chestContents[index].isEmpty())
|
||||
{
|
||||
this.chestContents[index] = null;
|
||||
}
|
||||
|
@ -133,9 +133,9 @@ public class TileEntityChest extends TileEntityLockable implements ITickable, II
|
|||
{
|
||||
this.chestContents[index] = stack;
|
||||
|
||||
if (stack != null && stack.size > this.getInventoryStackLimit())
|
||||
if (stack != null && stack.getSize() > this.getInventoryStackLimit())
|
||||
{
|
||||
stack.size = this.getInventoryStackLimit();
|
||||
stack.setSize(this.getInventoryStackLimit());
|
||||
}
|
||||
|
||||
this.markDirty();
|
||||
|
|
|
@ -142,15 +142,15 @@ public abstract class TileEntityDevice extends TileEntityLockable implements IHo
|
|||
|
||||
public ItemStack decrStackSize(int index, int count) {
|
||||
if(this.inventory[index] != null) {
|
||||
if(this.inventory[index].size <= count) {
|
||||
if(this.inventory[index].getSize() <= count) {
|
||||
ItemStack itemstack1 = this.inventory[index];
|
||||
this.inventory[index] = null;
|
||||
return itemstack1;
|
||||
}
|
||||
else {
|
||||
ItemStack itemstack = this.inventory[index].splitStack(count);
|
||||
ItemStack itemstack = this.inventory[index].split(count);
|
||||
|
||||
if(this.inventory[index].size == 0) {
|
||||
if(this.inventory[index].isEmpty()) {
|
||||
this.inventory[index] = null;
|
||||
}
|
||||
|
||||
|
@ -176,8 +176,8 @@ public abstract class TileEntityDevice extends TileEntityLockable implements IHo
|
|||
public void setInventorySlotContents(int index, ItemStack stack) {
|
||||
this.inventory[index] = stack;
|
||||
|
||||
if(stack != null && stack.size > this.getInventoryStackLimit()) {
|
||||
stack.size = this.getInventoryStackLimit();
|
||||
if(stack != null && stack.getSize() > this.getInventoryStackLimit()) {
|
||||
stack.setSize(this.getInventoryStackLimit());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -264,7 +264,7 @@ public abstract class TileEntityDevice extends TileEntityLockable implements IHo
|
|||
return true;
|
||||
}
|
||||
else {
|
||||
return this.inventory[slot] == null || this.inventory[slot].size <= 0;
|
||||
return this.inventory[slot] == null || this.inventory[slot].isEmpty();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -272,19 +272,19 @@ public abstract class TileEntityDevice extends TileEntityLockable implements IHo
|
|||
if(slot == -1) {
|
||||
int n = 0;
|
||||
for(ItemStack itemstack : this.inventory) {
|
||||
if(itemstack != null && itemstack.size >= 1)
|
||||
n += itemstack.size;
|
||||
if(itemstack != null && !itemstack.isEmpty())
|
||||
n += itemstack.getSize();
|
||||
}
|
||||
return n >= amount;
|
||||
}
|
||||
else {
|
||||
return this.inventory[slot] != null && this.inventory[slot].size >= amount;
|
||||
return this.inventory[slot] != null && this.inventory[slot].getSize() >= amount;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isFull() {
|
||||
for(ItemStack itemstack : this.inventory) {
|
||||
if(itemstack == null || itemstack.size != itemstack.getMaxStackSize()) {
|
||||
if(itemstack == null || !itemstack.isFull()) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -40,7 +40,7 @@ public class TileEntityDispenser extends TileEntityLockable implements IInventor
|
|||
{
|
||||
if (this.stacks[index] != null)
|
||||
{
|
||||
if (this.stacks[index].size <= count)
|
||||
if (this.stacks[index].getSize() <= count)
|
||||
{
|
||||
ItemStack itemstack1 = this.stacks[index];
|
||||
this.stacks[index] = null;
|
||||
|
@ -49,9 +49,9 @@ public class TileEntityDispenser extends TileEntityLockable implements IInventor
|
|||
}
|
||||
else
|
||||
{
|
||||
ItemStack itemstack = this.stacks[index].splitStack(count);
|
||||
ItemStack itemstack = this.stacks[index].split(count);
|
||||
|
||||
if (this.stacks[index].size == 0)
|
||||
if (this.stacks[index].isEmpty())
|
||||
{
|
||||
this.stacks[index] = null;
|
||||
}
|
||||
|
@ -106,9 +106,9 @@ public class TileEntityDispenser extends TileEntityLockable implements IInventor
|
|||
{
|
||||
this.stacks[index] = stack;
|
||||
|
||||
if (stack != null && stack.size > this.getInventoryStackLimit())
|
||||
if (stack != null && stack.getSize() > this.getInventoryStackLimit())
|
||||
{
|
||||
stack.size = this.getInventoryStackLimit();
|
||||
stack.setSize(this.getInventoryStackLimit());
|
||||
}
|
||||
|
||||
this.markDirty();
|
||||
|
|
|
@ -74,7 +74,7 @@ public class TileEntityFurnace extends TileEntityLockable implements ITickable,
|
|||
{
|
||||
if (this.furnaceItemStacks[index] != null)
|
||||
{
|
||||
if (this.furnaceItemStacks[index].size <= count)
|
||||
if (this.furnaceItemStacks[index].getSize() <= count)
|
||||
{
|
||||
ItemStack itemstack1 = this.furnaceItemStacks[index];
|
||||
this.furnaceItemStacks[index] = null;
|
||||
|
@ -82,9 +82,9 @@ public class TileEntityFurnace extends TileEntityLockable implements ITickable,
|
|||
}
|
||||
else
|
||||
{
|
||||
ItemStack itemstack = this.furnaceItemStacks[index].splitStack(count);
|
||||
ItemStack itemstack = this.furnaceItemStacks[index].split(count);
|
||||
|
||||
if (this.furnaceItemStacks[index].size == 0)
|
||||
if (this.furnaceItemStacks[index].isEmpty())
|
||||
{
|
||||
this.furnaceItemStacks[index] = null;
|
||||
}
|
||||
|
@ -120,12 +120,12 @@ public class TileEntityFurnace extends TileEntityLockable implements ITickable,
|
|||
*/
|
||||
public void setInventorySlotContents(int index, ItemStack stack)
|
||||
{
|
||||
boolean flag = stack != null && stack.isItemEqual(this.furnaceItemStacks[index]) && ItemStack.areItemStackTagsEqual(stack, this.furnaceItemStacks[index]);
|
||||
boolean flag = stack != null && stack.itemEquals(this.furnaceItemStacks[index]) && ItemStack.dataEquals(stack, this.furnaceItemStacks[index]);
|
||||
this.furnaceItemStacks[index] = stack;
|
||||
|
||||
if (stack != null && stack.size > this.getInventoryStackLimit())
|
||||
if (stack != null && stack.getSize() > this.getInventoryStackLimit())
|
||||
{
|
||||
stack.size = this.getInventoryStackLimit();
|
||||
stack.setSize(this.getInventoryStackLimit());
|
||||
}
|
||||
|
||||
if (index == 0 && !flag)
|
||||
|
@ -260,9 +260,7 @@ public class TileEntityFurnace extends TileEntityLockable implements ITickable,
|
|||
|
||||
if (this.furnaceItemStacks[1] != null)
|
||||
{
|
||||
--this.furnaceItemStacks[1].size;
|
||||
|
||||
if (this.furnaceItemStacks[1].size == 0)
|
||||
if (this.furnaceItemStacks[1].decrSize())
|
||||
{
|
||||
Item item = this.furnaceItemStacks[1].getItem().getContainerItem();
|
||||
this.furnaceItemStacks[1] = item != null ? new ItemStack(item) : null;
|
||||
|
@ -323,7 +321,7 @@ public class TileEntityFurnace extends TileEntityLockable implements ITickable,
|
|||
else
|
||||
{
|
||||
ItemStack itemstack = SmeltingRegistry.getResult(this.furnaceItemStacks[0]);
|
||||
return itemstack == null ? false : (this.furnaceItemStacks[2] == null ? true : (!this.furnaceItemStacks[2].isItemEqual(itemstack) ? false : (this.furnaceItemStacks[2].size < this.getInventoryStackLimit() && this.furnaceItemStacks[2].size < this.furnaceItemStacks[2].getMaxStackSize() ? true : this.furnaceItemStacks[2].size < itemstack.getMaxStackSize())));
|
||||
return itemstack == null ? false : (this.furnaceItemStacks[2] == null ? true : (!this.furnaceItemStacks[2].itemEquals(itemstack) ? false : (this.furnaceItemStacks[2].getSize() < this.getInventoryStackLimit() && !this.furnaceItemStacks[2].isFull() ? true : this.furnaceItemStacks[2].getSize() < itemstack.getMaxStackSize())));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -342,7 +340,7 @@ public class TileEntityFurnace extends TileEntityLockable implements ITickable,
|
|||
}
|
||||
else if (this.furnaceItemStacks[2].getItem() == itemstack.getItem())
|
||||
{
|
||||
++this.furnaceItemStacks[2].size;
|
||||
this.furnaceItemStacks[2].incrSize();
|
||||
}
|
||||
|
||||
// if (this.furnaceItemStacks[0].getItem() == Items.sponge && this.furnaceItemStacks[0].getMetadata() == 1 && this.furnaceItemStacks[1] != null && this.furnaceItemStacks[1].getItem() == Items.bucket)
|
||||
|
@ -350,9 +348,7 @@ public class TileEntityFurnace extends TileEntityLockable implements ITickable,
|
|||
// this.furnaceItemStacks[1] = new ItemStack(Items.water_bucket);
|
||||
// }
|
||||
|
||||
--this.furnaceItemStacks[0].size;
|
||||
|
||||
if (this.furnaceItemStacks[0].size <= 0)
|
||||
if (this.furnaceItemStacks[0].decrSize())
|
||||
{
|
||||
this.furnaceItemStacks[0] = null;
|
||||
}
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue