Port to 1.11

This commit is contained in:
yueh
2016-12-08 12:42:00 +01:00
parent 589730bfad
commit ed9e6dd21c
262 changed files with 4027 additions and 3954 deletions
@@ -53,9 +53,9 @@ public class AdaptorIInventory extends InventoryAdaptor
if( is != null && this.canRemoveStackFromSlot( x, is ) && ( filter == null || Platform.itemComparisons().isSameItem( is, filter ) ) )
{
int boundAmounts = amount;
if( boundAmounts > is.stackSize )
if( boundAmounts > is.getCount() )
{
boundAmounts = is.stackSize;
boundAmounts = is.getCount();
}
if( destination != null && !destination.canInsert( is ) )
{
@@ -68,16 +68,16 @@ public class AdaptorIInventory extends InventoryAdaptor
{
rv = is.copy();
filter = rv;
rv.stackSize = boundAmounts;
rv.setCount( boundAmounts );
amount -= boundAmounts;
}
else
{
rv.stackSize += boundAmounts;
rv.grow( boundAmounts );
amount -= boundAmounts;
}
if( is.stackSize == boundAmounts )
if( is.getCount() == boundAmounts )
{
this.i.setInventorySlotContents( x, null );
this.i.markDirty();
@@ -85,7 +85,7 @@ public class AdaptorIInventory extends InventoryAdaptor
else
{
final ItemStack po = is.copy();
po.stackSize -= boundAmounts;
po.grow( -boundAmounts );
this.i.setInventorySlotContents( x, po );
this.i.markDirty();
}
@@ -111,9 +111,9 @@ public class AdaptorIInventory extends InventoryAdaptor
if( is != null && this.canRemoveStackFromSlot( x, is ) && ( filter == null || Platform.itemComparisons().isSameItem( is, filter ) ) )
{
int boundAmount = amount;
if( boundAmount > is.stackSize )
if( boundAmount > is.getCount() )
{
boundAmount = is.stackSize;
boundAmount = is.getCount();
}
if( destination != null && !destination.canInsert( is ) )
{
@@ -125,12 +125,12 @@ public class AdaptorIInventory extends InventoryAdaptor
if( rv == null )
{
rv = is.copy();
rv.stackSize = boundAmount;
rv.setCount( boundAmount );
amount -= boundAmount;
}
else
{
rv.stackSize += boundAmount;
rv.grow( boundAmount );
amount -= boundAmount;
}
}
@@ -147,12 +147,13 @@ public class AdaptorIInventory extends InventoryAdaptor
for( int x = 0; x < s; x++ )
{
final ItemStack is = this.i.getStackInSlot( x );
if( is != null && this.canRemoveStackFromSlot( x, is ) && ( filter == null || Platform.itemComparisons().isFuzzyEqualItem( is, filter, fuzzyMode ) ) )
if( is != null && this.canRemoveStackFromSlot( x,
is ) && ( filter == null || Platform.itemComparisons().isFuzzyEqualItem( is, filter, fuzzyMode ) ) )
{
int newAmount = amount;
if( newAmount > is.stackSize )
if( newAmount > is.getCount() )
{
newAmount = is.stackSize;
newAmount = is.getCount();
}
if( destination != null && !destination.canInsert( is ) )
{
@@ -163,9 +164,9 @@ public class AdaptorIInventory extends InventoryAdaptor
if( newAmount > 0 )
{
rv = is.copy();
rv.stackSize = newAmount;
rv.setCount( newAmount );
if( is.stackSize == rv.stackSize )
if( is.getCount() == rv.getCount() )
{
this.i.setInventorySlotContents( x, null );
this.i.markDirty();
@@ -173,7 +174,7 @@ public class AdaptorIInventory extends InventoryAdaptor
else
{
final ItemStack po = is.copy();
po.stackSize -= rv.stackSize;
po.grow( -rv.getCount() );
this.i.setInventorySlotContents( x, po );
this.i.markDirty();
}
@@ -197,12 +198,13 @@ public class AdaptorIInventory extends InventoryAdaptor
{
final ItemStack is = this.i.getStackInSlot( x );
if( is != null && this.canRemoveStackFromSlot( x, is ) && ( filter == null || Platform.itemComparisons().isFuzzyEqualItem( is, filter, fuzzyMode ) ) )
if( is != null && this.canRemoveStackFromSlot( x,
is ) && ( filter == null || Platform.itemComparisons().isFuzzyEqualItem( is, filter, fuzzyMode ) ) )
{
int boundAmount = amount;
if( boundAmount > is.stackSize )
if( boundAmount > is.getCount() )
{
boundAmount = is.stackSize;
boundAmount = is.getCount();
}
if( destination != null && !destination.canInsert( is ) )
{
@@ -212,7 +214,7 @@ public class AdaptorIInventory extends InventoryAdaptor
if( boundAmount > 0 )
{
final ItemStack rv = is.copy();
rv.stackSize = boundAmount;
rv.setCount( boundAmount );
return rv;
}
}
@@ -260,7 +262,7 @@ public class AdaptorIInventory extends InventoryAdaptor
*/
private ItemStack addItems( final ItemStack itemsToAdd, final boolean modulate )
{
if( itemsToAdd == null || itemsToAdd.stackSize == 0 )
if( itemsToAdd == null || itemsToAdd.getCount() == 0 )
{
return null;
}
@@ -273,14 +275,14 @@ public class AdaptorIInventory extends InventoryAdaptor
for( int slot = 0; slot < inventorySize; slot++ )
{
final ItemStack next = left.copy();
next.stackSize = Math.min( perOperationLimit, next.stackSize );
next.setCount( Math.min( perOperationLimit, next.getCount() ) );
if( this.i.isItemValidForSlot( slot, next ) )
{
final ItemStack is = this.i.getStackInSlot( slot );
if( is == null )
{
left.stackSize -= next.stackSize;
left.grow( -next.getCount() );
if( modulate )
{
@@ -288,25 +290,25 @@ public class AdaptorIInventory extends InventoryAdaptor
this.i.markDirty();
}
if( left.stackSize <= 0 )
if( left.getCount() <= 0 )
{
return null;
}
}
else if( Platform.itemComparisons().isSameItem( is, left ) && is.stackSize < perOperationLimit )
else if( Platform.itemComparisons().isSameItem( is, left ) && is.getCount() < perOperationLimit )
{
final int room = perOperationLimit - is.stackSize;
final int used = Math.min( left.stackSize, room );
final int room = perOperationLimit - is.getCount();
final int used = Math.min( left.getCount(), room );
if( modulate )
{
is.stackSize += used;
is.grow( used );
this.i.setInventorySlotContents( slot, is );
this.i.markDirty();
}
left.stackSize -= used;
if( left.stackSize <= 0 )
left.grow( -used );
if( left.getCount() <= 0 )
{
return null;
}