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
+1 -1
View File
@@ -37,7 +37,7 @@ public class BlockUpdate implements IWorldCallable<Boolean>
{
if( world.isBlockLoaded( this.pos ) )
{
world.notifyNeighborsOfStateChange( this.pos, Platform.AIR_BLOCK );
world.notifyNeighborsOfStateChange( this.pos, Platform.AIR_BLOCK, true );
}
return true;
+18 -15
View File
@@ -537,13 +537,14 @@ public class Platform
{
if( i != null )
{
if( i.stackSize > 0 )
if( i.getCount() > 0 )
{
final double offset_x = ( getRandomInt() % 32 - 16 ) / 82;
final double offset_y = ( getRandomInt() % 32 - 16 ) / 82;
final double offset_z = ( getRandomInt() % 32 - 16 ) / 82;
final EntityItem ei = new EntityItem( w, 0.5 + offset_x + pos.getX(), 0.5 + offset_y + pos.getY(), 0.2 + offset_z + pos.getZ(), i.copy() );
w.spawnEntityInWorld( ei );
final EntityItem ei = new EntityItem( w, 0.5 + offset_x + pos.getX(), 0.5 + offset_y + pos.getY(), 0.2 + offset_z + pos.getZ(), i
.copy() );
w.spawnEntity( ei );
}
}
}
@@ -664,9 +665,9 @@ public class Platform
return false;
}
public static ItemStack findMatchingRecipeOutput( final InventoryCrafting ic, final World worldObj )
public static ItemStack findMatchingRecipeOutput( final InventoryCrafting ic, final World world )
{
return CraftingManager.getInstance().findMatchingRecipe( ic, worldObj );
return CraftingManager.getInstance().findMatchingRecipe( ic, world );
}
@SideOnly( Side.CLIENT )
@@ -694,7 +695,7 @@ public class Platform
try
{
return itemStack.getTooltip( Minecraft.getMinecraft().thePlayer, false );
return itemStack.getTooltip( Minecraft.getMinecraft().player, false );
}
catch( final Exception errB )
{
@@ -1493,7 +1494,8 @@ public class Platform
if( AEConfig.instance().isFeatureEnabled( AEFeature.LOG_SECURITY_AUDITS ) )
{
AELog.info(
"Audit: " + a_isSecure + " : " + b_isSecure + " @ " + a.getLastSecurityKey() + " vs " + b.getLastSecurityKey() + " & " + a.getPlayerID() + " vs " + b.getPlayerID() );
"Audit: " + a_isSecure + " : " + b_isSecure + " @ " + a.getLastSecurityKey() + " vs " + b.getLastSecurityKey() + " & " + a
.getPlayerID() + " vs " + b.getPlayerID() );
}
// can't do that son...
@@ -1644,7 +1646,8 @@ public class Platform
}
}
final boolean checkFuzzy = ae_req.isOre() || providedTemplate.getItemDamage() == OreDictionary.WILDCARD_VALUE || providedTemplate.hasTagCompound() || providedTemplate.isItemStackDamageable();
final boolean checkFuzzy = ae_req.isOre() || providedTemplate.getItemDamage() == OreDictionary.WILDCARD_VALUE || providedTemplate
.hasTagCompound() || providedTemplate.isItemStackDamageable();
if( items != null && checkFuzzy )
{
@@ -1655,7 +1658,7 @@ public class Platform
sh ) || ae_req.sameOre( x ) ) && !Platform.itemComparisons().isEqualItem( sh, output ) )
{ // Platform.isSameItemType( sh, providedTemplate )
final ItemStack cp = Platform.cloneItemStack( sh );
cp.stackSize = 1;
cp.setCount( 1 );
ci.setInventorySlotContents( slot, cp );
if( r.matches( ci, w ) && Platform.itemComparisons().isEqualItem( r.getCraftingResult( ci ), output ) )
{
@@ -1694,9 +1697,9 @@ public class Platform
final Item i = stackInSlot.getItem();
if( i == null || !i.hasContainerItem( stackInSlot ) )
{
if( stackInSlot.stackSize > 1 )
if( stackInSlot.getCount() > 1 )
{
stackInSlot.stackSize--;
stackInSlot.setCount( stackInSlot.getCount() - 1 );
return stackInSlot;
}
return null;
@@ -1711,11 +1714,11 @@ public class Platform
return ci;
}
public static void notifyBlocksOfNeighbors( final World worldObj, final BlockPos pos )
public static void notifyBlocksOfNeighbors( final World world, final BlockPos pos )
{
if( !worldObj.isRemote )
if( !world.isRemote )
{
TickHandler.INSTANCE.addCallable( worldObj, new BlockUpdate( pos ) );
TickHandler.INSTANCE.addCallable( world, new BlockUpdate( pos ) );
}
}
@@ -1792,7 +1795,7 @@ public class Platform
public static float getEyeOffset( final EntityPlayer player )
{
assert player.worldObj.isRemote : "Valid only on client";
assert player.world.isRemote : "Valid only on client";
return (float) ( player.posY + player.getEyeHeight() - player.getDefaultEyeHeight() );
}
@@ -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;
}
@@ -79,13 +79,13 @@ public class AdaptorItemHandler extends InventoryAdaptor
// Use the first stack as a template for the result
rv = extracted;
filter = extracted;
amount -= extracted.stackSize;
amount -= extracted.getCount();
}
else
{
// Subsequent stacks will just increase the extracted size
rv.stackSize += extracted.stackSize;
amount -= extracted.stackSize;
rv.grow( extracted.getCount() );
amount -= extracted.getCount();
}
}
@@ -123,13 +123,13 @@ public class AdaptorItemHandler extends InventoryAdaptor
// Use the first stack as a template for the result
rv = extracted.copy();
filter = extracted;
amount -= extracted.stackSize;
amount -= extracted.getCount();
}
else
{
// Subsequent stacks will just increase the extracted size
rv.stackSize += extracted.stackSize;
amount -= extracted.stackSize;
rv.grow( extracted.getCount() );
amount -= extracted.getCount();
}
}
}
@@ -138,7 +138,8 @@ public class AdaptorItemHandler extends InventoryAdaptor
}
/**
* For fuzzy extract, we will only ever extract one slot, since we're afraid of merging two item stacks with different damage values.
* For fuzzy extract, we will only ever extract one slot, since we're afraid of merging two item stacks with
* different damage values.
*/
@Override
public ItemStack removeSimilarItems( int amount, ItemStack filter, FuzzyMode fuzzyMode, IInventoryDestination destination )
@@ -218,7 +219,7 @@ public class AdaptorItemHandler extends InventoryAdaptor
private ItemStack addItems( final ItemStack itemsToAdd, final boolean simulate )
{
if( itemsToAdd == null || itemsToAdd.stackSize == 0 )
if( itemsToAdd == null || itemsToAdd.getCount() == 0 )
{
return null;
}
@@ -233,7 +234,7 @@ public class AdaptorItemHandler extends InventoryAdaptor
{
left = itemHandler.insertItem( slot, left, simulate );
if( left == null || left.stackSize <= 0 )
if( left == null || left.getCount() <= 0 )
{
return null;
}
+18 -18
View File
@@ -49,9 +49,9 @@ public class AdaptorList extends InventoryAdaptor
final ItemStack is = this.i.get( x );
if( is != null && ( filter == null || Platform.itemComparisons().isSameItem( is, filter ) ) )
{
if( amount > is.stackSize )
if( amount > is.getCount() )
{
amount = is.stackSize;
amount = is.getCount();
}
if( destination != null && !destination.canInsert( is ) )
{
@@ -61,11 +61,11 @@ public class AdaptorList extends InventoryAdaptor
if( amount > 0 )
{
final ItemStack rv = is.copy();
rv.stackSize = amount;
is.stackSize -= amount;
rv.setCount( amount );
is.grow( -amount );
// remove it..
if( is.stackSize <= 0 )
if( is.getCount() <= 0 )
{
this.i.remove( x );
}
@@ -84,9 +84,9 @@ public class AdaptorList extends InventoryAdaptor
{
if( is != null && ( filter == null || Platform.itemComparisons().isSameItem( is, filter ) ) )
{
if( amount > is.stackSize )
if( amount > is.getCount() )
{
amount = is.stackSize;
amount = is.getCount();
}
if( destination != null && !destination.canInsert( is ) )
{
@@ -96,7 +96,7 @@ public class AdaptorList extends InventoryAdaptor
if( amount > 0 )
{
final ItemStack rv = is.copy();
rv.stackSize = amount;
rv.setCount( amount );
return rv;
}
}
@@ -113,9 +113,9 @@ public class AdaptorList extends InventoryAdaptor
final ItemStack is = this.i.get( x );
if( is != null && ( filter == null || Platform.itemComparisons().isFuzzyEqualItem( is, filter, fuzzyMode ) ) )
{
if( amount > is.stackSize )
if( amount > is.getCount() )
{
amount = is.stackSize;
amount = is.getCount();
}
if( destination != null && !destination.canInsert( is ) )
{
@@ -125,11 +125,11 @@ public class AdaptorList extends InventoryAdaptor
if( amount > 0 )
{
final ItemStack rv = is.copy();
rv.stackSize = amount;
is.stackSize -= amount;
rv.setCount( amount );
is.grow( -amount );
// remove it..
if( is.stackSize <= 0 )
if( is.getCount() <= 0 )
{
this.i.remove( x );
}
@@ -148,9 +148,9 @@ public class AdaptorList extends InventoryAdaptor
{
if( is != null && ( filter == null || Platform.itemComparisons().isFuzzyEqualItem( is, filter, fuzzyMode ) ) )
{
if( amount > is.stackSize )
if( amount > is.getCount() )
{
amount = is.stackSize;
amount = is.getCount();
}
if( destination != null && !destination.canInsert( is ) )
{
@@ -160,7 +160,7 @@ public class AdaptorList extends InventoryAdaptor
if( amount > 0 )
{
final ItemStack rv = is.copy();
rv.stackSize = amount;
rv.setCount( amount );
return rv;
}
}
@@ -175,7 +175,7 @@ public class AdaptorList extends InventoryAdaptor
{
return null;
}
if( toBeAdded.stackSize == 0 )
if( toBeAdded.getCount() == 0 )
{
return null;
}
@@ -186,7 +186,7 @@ public class AdaptorList extends InventoryAdaptor
{
if( Platform.itemComparisons().isEqualItem( is, left ) )
{
is.stackSize += left.stackSize;
is.grow( left.getCount() );
return null;
}
}
@@ -55,9 +55,9 @@ public class AdaptorPlayerHand extends InventoryAdaptor
if( filter == null || Platform.itemComparisons().isSameItem( filter, hand ) )
{
final ItemStack result = hand.copy();
result.stackSize = hand.stackSize > amount ? amount : hand.stackSize;
hand.stackSize -= amount;
if( hand.stackSize <= 0 )
result.setCount( hand.getCount() > amount ? amount : hand.getCount() );
hand.grow( -amount );
if( hand.getCount() <= 0 )
{
this.player.inventory.setItemStack( null );
}
@@ -80,7 +80,7 @@ public class AdaptorPlayerHand extends InventoryAdaptor
if( filter == null || Platform.itemComparisons().isSameItem( filter, hand ) )
{
final ItemStack result = hand.copy();
result.stackSize = hand.stackSize > amount ? amount : hand.stackSize;
result.setCount( hand.getCount() > amount ? amount : hand.getCount() );
return result;
}
@@ -99,9 +99,9 @@ public class AdaptorPlayerHand extends InventoryAdaptor
if( filter == null || Platform.itemComparisons().isFuzzyEqualItem( filter, hand, fuzzyMode ) )
{
final ItemStack result = hand.copy();
result.stackSize = hand.stackSize > amount ? amount : hand.stackSize;
hand.stackSize -= amount;
if( hand.stackSize <= 0 )
result.setCount( hand.getCount() > amount ? amount : hand.getCount() );
hand.grow( -amount );
if( hand.getCount() <= 0 )
{
this.player.inventory.setItemStack( null );
}
@@ -124,7 +124,7 @@ public class AdaptorPlayerHand extends InventoryAdaptor
if( filter == null || Platform.itemComparisons().isFuzzyEqualItem( filter, hand, fuzzyMode ) )
{
final ItemStack result = hand.copy();
result.stackSize = hand.stackSize > amount ? amount : hand.stackSize;
result.setCount( hand.getCount() > amount ? amount : hand.getCount() );
return result;
}
@@ -139,7 +139,7 @@ public class AdaptorPlayerHand extends InventoryAdaptor
{
return null;
}
if( toBeAdded.stackSize == 0 )
if( toBeAdded.getCount() == 0 )
{
return null;
}
@@ -168,15 +168,15 @@ public class AdaptorPlayerHand extends InventoryAdaptor
else
{
newHand = hand;
original = hand.stackSize;
newHand.stackSize += toBeAdded.stackSize;
original = hand.getCount();
newHand.grow( toBeAdded.getCount() );
}
if( newHand.stackSize > newHand.getMaxStackSize() )
if( newHand.getCount() > newHand.getMaxStackSize() )
{
newHand.stackSize = newHand.getMaxStackSize();
newHand.setCount( newHand.getMaxStackSize() );
final ItemStack B = toBeAdded.copy();
B.stackSize -= newHand.stackSize - original;
B.grow( -( newHand.getCount() - original ) );
this.player.inventory.setItemStack( newHand );
return B;
}
@@ -208,15 +208,15 @@ public class AdaptorPlayerHand extends InventoryAdaptor
else
{
newHand = hand.copy();
original = hand.stackSize;
newHand.stackSize += toBeSimulated.stackSize;
original = hand.getCount();
newHand.grow( toBeSimulated.getCount() );
}
if( newHand.stackSize > newHand.getMaxStackSize() )
if( newHand.getCount() > newHand.getMaxStackSize() )
{
newHand.stackSize = newHand.getMaxStackSize();
newHand.setCount( newHand.getMaxStackSize() );
final ItemStack B = toBeSimulated.copy();
B.stackSize -= newHand.stackSize - original;
B.grow( -( newHand.getCount() - original ) );
return B;
}
@@ -100,9 +100,9 @@ public class AdaptorPlayerInventory implements IInventory
}
@Override
public boolean isUseableByPlayer( final EntityPlayer var1 )
public boolean isUsableByPlayer( final EntityPlayer var1 )
{
return this.src.isUseableByPlayer( var1 );
return this.src.isUsableByPlayer( var1 );
}
@Override
@@ -153,4 +153,10 @@ public class AdaptorPlayerInventory implements IInventory
{
this.src.clear();
}
@Override
public boolean isEmpty()
{
return this.src.isEmpty();
}
}
@@ -52,6 +52,6 @@ public class IMEInventoryDestination implements IInventoryDestination
{
return true;
}
return failed.getStackSize() != stack.stackSize;
return failed.getStackSize() != stack.getCount();
}
}
@@ -202,7 +202,7 @@ public class WrapperChainedInventory implements IInventory
}
@Override
public boolean isUseableByPlayer( final EntityPlayer var1 )
public boolean isUsableByPlayer( final EntityPlayer var1 )
{
return false;
}
@@ -265,4 +265,11 @@ public class WrapperChainedInventory implements IInventory
{
}
@Override
public boolean isEmpty()
{
// TODO Auto-generated method stub
return false;
}
}
@@ -100,9 +100,9 @@ public class WrapperInvSlot
}
@Override
public boolean isUseableByPlayer( final EntityPlayer entityplayer )
public boolean isUsableByPlayer( final EntityPlayer entityplayer )
{
return this.inv.isUseableByPlayer( entityplayer );
return this.inv.isUsableByPlayer( entityplayer );
}
@Override
@@ -164,5 +164,12 @@ public class WrapperInvSlot
{
this.inv.setField( id, value );
}
@Override
public boolean isEmpty()
{
// TODO Auto-generated method stub
return false;
}
}
}
@@ -117,9 +117,9 @@ public class WrapperInventoryRange implements IInventory
}
@Override
public boolean isUseableByPlayer( final EntityPlayer var1 )
public boolean isUsableByPlayer( final EntityPlayer var1 )
{
return this.src.isUseableByPlayer( var1 );
return this.src.isUsableByPlayer( var1 );
}
@Override
@@ -206,4 +206,11 @@ public class WrapperInventoryRange implements IInventory
{
this.slots = slots;
}
@Override
public boolean isEmpty()
{
// TODO Auto-generated method stub
return false;
}
}
@@ -82,7 +82,7 @@ public final class AEFluidStack extends AEStack<IAEFluidStack> implements IAEFlu
public static IAEFluidStack loadFluidStackFromNBT( final NBTTagCompound i )
{
final ItemStack itemstack = ItemStack.loadItemStackFromNBT( i );
final ItemStack itemstack = new ItemStack( i );
if( itemstack == null )
{
return null;
@@ -108,7 +108,7 @@ public final class AEItemStack extends AEStack<IAEItemStack> implements IAEItemS
this.getDefinition().setTagCompound( (AESharedNBT) AESharedNBT.getSharedTagCompound( tagCompound, is ) );
}
this.setStackSize( is.stackSize );
this.setStackSize( is.getCount() );
this.setCraftable( false );
this.setCountRequestable( 0 );
@@ -123,7 +123,7 @@ public final class AEItemStack extends AEStack<IAEItemStack> implements IAEItemS
return null;
}
final ItemStack itemstack = ItemStack.loadItemStackFromNBT( i );
final ItemStack itemstack = new ItemStack( i );
if( itemstack == null )
{
return null;
@@ -181,7 +181,7 @@ public final class AEItemStack extends AEStack<IAEItemStack> implements IAEItemS
final long stackSize = getPacketValue( stackType, data );
final long countRequestable = getPacketValue( countReqType, data );
final ItemStack itemstack = ItemStack.loadItemStackFromNBT( d );
final ItemStack itemstack = new ItemStack( d );
if( itemstack == null )
{
return null;