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
+4 -4
View File
@@ -66,7 +66,7 @@ public abstract class AEBaseInvTile extends AEBaseTile implements ISidedInventor
for( int x = 0; x < inv.getSizeInventory(); x++ )
{
final NBTTagCompound item = opt.getCompoundTag( "item" + x );
inv.setInventorySlotContents( x, ItemStack.loadItemStackFromNBT( item ) );
inv.setInventorySlotContents( x, new ItemStack( item ) );
}
}
@@ -136,11 +136,11 @@ public abstract class AEBaseInvTile extends AEBaseTile implements ISidedInventor
}
@Override
public boolean isUseableByPlayer( final EntityPlayer p )
public boolean isUsableByPlayer( final EntityPlayer p )
{
final double squaredMCReach = 64.0D;
return this.worldObj.getTileEntity( this.pos ) == this && p.getDistanceSq( this.pos.getX() + 0.5D, this.pos.getY() + 0.5D, this.pos.getZ() + 0.5D ) <= squaredMCReach;
return this.world.getTileEntity( this.pos ) == this && p.getDistanceSq( this.pos.getX() + 0.5D, this.pos.getY() + 0.5D, this.pos.getZ() + 0.5D ) <= squaredMCReach;
}
@Override
@@ -169,7 +169,7 @@ public abstract class AEBaseInvTile extends AEBaseTile implements ISidedInventor
@Override
public int[] getSlotsForFace( final EnumFacing side )
{
final Block blk = this.worldObj.getBlockState( this.pos ).getBlock();
final Block blk = this.world.getBlockState( this.pos ).getBlock();
if( blk instanceof AEBaseBlock )
{
return this.getAccessibleSlotsBySide( ( (AEBaseBlock) blk ).mapRotation( this, side ) );
+6 -6
View File
@@ -95,7 +95,7 @@ public class AEBaseTile extends TileEntity implements IOrientable, ICommonTile,
public boolean notLoaded()
{
return !this.worldObj.isBlockLoaded( this.pos );
return !this.world.isBlockLoaded( this.pos );
}
@Nonnull
@@ -120,7 +120,7 @@ public class AEBaseTile extends TileEntity implements IOrientable, ICommonTile,
{
if( state == null )
{
state = worldObj.getBlockState( getPos() );
state = world.getBlockState( getPos() );
}
return state;
}
@@ -337,10 +337,10 @@ public class AEBaseTile extends TileEntity implements IOrientable, ICommonTile,
else
{
// TODO: Optimize Network Load
if( this.worldObj != null )
if( this.world != null )
{
AELog.blockUpdate( this.pos, this );
this.worldObj.notifyBlockUpdate( this.pos, getBlockState(), getBlockState(), 3 );
this.world.notifyBlockUpdate( this.pos, getBlockState(), getBlockState(), 3 );
}
}
}
@@ -472,7 +472,7 @@ public class AEBaseTile extends TileEntity implements IOrientable, ICommonTile,
this.forward = inForward;
this.up = inUp;
this.markForUpdate();
Platform.notifyBlocksOfNeighbors( this.worldObj, this.pos );
Platform.notifyBlocksOfNeighbors( this.world, this.pos );
}
public void onPlacement( final ItemStack stack, final EntityPlayer player, final EnumFacing side )
@@ -618,7 +618,7 @@ public class AEBaseTile extends TileEntity implements IOrientable, ICommonTile,
public void securityBreak()
{
this.worldObj.destroyBlock( this.pos, true );
this.world.destroyBlock( this.pos, true );
this.disableDrops();
}
@@ -74,12 +74,12 @@ public class TileCraftingStorageTile extends TileCraftingTile
@Override
public int getStorageBytes()
{
if( this.worldObj == null || this.notLoaded() )
if( this.world == null || this.notLoaded() )
{
return 0;
}
final BlockCraftingUnit unit = (BlockCraftingUnit) this.worldObj.getBlockState( this.pos ).getBlock();
final BlockCraftingUnit unit = (BlockCraftingUnit) this.world.getBlockState( this.pos ).getBlock();
switch( unit.type )
{
default:
@@ -93,7 +93,7 @@ public class TileCraftingTile extends AENetworkTile implements IAEMultiBlock, IP
@Override
public boolean canBeRotated()
{
return true;// return BlockCraftingUnit.checkType( worldObj.getBlockMetadata( xCoord, yCoord, zCoord ),
return true;// return BlockCraftingUnit.checkType( world.getBlockMetadata( xCoord, yCoord, zCoord ),
// BlockCraftingUnit.BASE_MONITOR );
}
@@ -109,12 +109,12 @@ public class TileCraftingTile extends AENetworkTile implements IAEMultiBlock, IP
public boolean isAccelerator()
{
if( this.worldObj == null )
if( this.world == null )
{
return false;
}
final BlockCraftingUnit unit = (BlockCraftingUnit) this.worldObj.getBlockState( this.pos ).getBlock();
final BlockCraftingUnit unit = (BlockCraftingUnit) this.world.getBlockState( this.pos ).getBlock();
return unit.type == CraftingUnitType.ACCELERATOR;
}
@@ -128,7 +128,7 @@ public class TileCraftingTile extends AENetworkTile implements IAEMultiBlock, IP
public void updateMultiBlock()
{
this.calc.calculateMultiblock( this.worldObj, this.getLocation() );
this.calc.calculateMultiblock( this.world, this.getLocation() );
}
public void updateStatus( final CraftingCPUCluster c )
@@ -144,7 +144,7 @@ public class TileCraftingTile extends AENetworkTile implements IAEMultiBlock, IP
public void updateMeta( final boolean updateFormed )
{
if( this.worldObj == null || this.notLoaded() )
if( this.world == null || this.notLoaded() )
{
return;
}
@@ -157,7 +157,7 @@ public class TileCraftingTile extends AENetworkTile implements IAEMultiBlock, IP
power = this.getProxy().isActive();
}
final IBlockState current = this.worldObj.getBlockState( this.pos );
final IBlockState current = this.world.getBlockState( this.pos );
// The tile might try to update while being destroyed
if( current.getBlock() instanceof BlockCraftingUnit )
@@ -168,7 +168,7 @@ public class TileCraftingTile extends AENetworkTile implements IAEMultiBlock, IP
{
// Not using flag 2 here (only send to clients, prevent block update) will cause infinite loops
// In case there is an inconsistency in the crafting clusters.
this.worldObj.setBlockState( this.pos, newState, 2 );
this.world.setBlockState( this.pos, newState, 2 );
}
}
@@ -189,7 +189,7 @@ public class TileCraftingTile extends AENetworkTile implements IAEMultiBlock, IP
{
if( Platform.isClient() )
{
return (boolean) this.worldObj.getBlockState( this.pos ).getValue( BlockCraftingUnit.FORMED );
return (boolean) this.world.getBlockState( this.pos ).getValue( BlockCraftingUnit.FORMED );
}
return this.cluster != null;
}
@@ -298,7 +298,7 @@ public class TileCraftingTile extends AENetworkTile implements IAEMultiBlock, IP
{
final WorldCoord wc = new WorldCoord( te );
wc.add( d, 1 );
if( this.worldObj.isAirBlock( wc.getPos() ) )
if( this.world.isAirBlock( wc.getPos() ) )
{
places.add( wc );
}
@@ -328,7 +328,7 @@ public class TileCraftingTile extends AENetworkTile implements IAEMultiBlock, IP
final WorldCoord wc = places.poll();
places.add( wc );
Platform.spawnDrops( this.worldObj, wc.getPos(), Collections.singletonList( g.getItemStack() ) );
Platform.spawnDrops( this.world, wc.getPos(), Collections.singletonList( g.getItemStack() ) );
}
}
@@ -341,7 +341,7 @@ public class TileCraftingTile extends AENetworkTile implements IAEMultiBlock, IP
{
if( Platform.isClient() )
{
return (boolean) this.worldObj.getBlockState( this.pos ).getValue( BlockCraftingUnit.POWERED );
return (boolean) this.world.getBlockState( this.pos ).getValue( BlockCraftingUnit.POWERED );
}
return this.getProxy().isActive();
}
@@ -236,7 +236,7 @@ public class TileMolecularAssembler extends AENetworkInvTile implements IUpgrade
{
if( data.hasKey( "myPlan" ) )
{
final ItemStack myPat = ItemStack.loadItemStackFromNBT( data.getCompoundTag( "myPlan" ) );
final ItemStack myPat = new ItemStack( data.getCompoundTag( "myPlan" ) );
if( myPat != null && myPat.getItem() instanceof ItemEncodedPattern )
{
@@ -509,7 +509,7 @@ public class TileMolecularAssembler extends AENetworkInvTile implements IUpgrade
try
{
final TargetPoint where = new TargetPoint( this.worldObj.provider.getDimension(), this.pos.getX(), this.pos.getY(), this.pos.getZ(), 32 );
final TargetPoint where = new TargetPoint( this.world.provider.getDimension(), this.pos.getX(), this.pos.getY(), this.pos.getZ(), 32 );
final IAEItemStack item = AEItemStack.create( output );
NetworkHandler.instance().sendToAllAround( new PacketAssemblerAnimation( this.pos, (byte) speed, item ), where );
}
@@ -536,7 +536,7 @@ public class TileMolecularAssembler extends AENetworkInvTile implements IUpgrade
final ItemStack is = this.inv.getStackInSlot( x );
if( is != null )
{
if( this.myPlan == null || !this.myPlan.isValidItemForSlot( x, is, this.worldObj ) )
if( this.myPlan == null || !this.myPlan.isValidItemForSlot( x, is, this.world ) )
{
this.inv.setInventorySlotContents( 9, is );
this.inv.setInventorySlotContents( x, null );
@@ -604,9 +604,9 @@ public class TileMolecularAssembler extends AENetworkInvTile implements IUpgrade
return output;
}
final int size = output.stackSize;
final int size = output.getCount();
output = adaptor.addItems( output );
final int newSize = output == null ? 0 : output.stackSize;
final int newSize = output == null ? 0 : output.getCount();
if( size != newSize )
{
@@ -654,4 +654,11 @@ public class TileMolecularAssembler extends AENetworkInvTile implements IUpgrade
return this.isPowered;
}
@Override
public boolean isEmpty()
{
// TODO Auto-generated method stub
return false;
}
}
@@ -82,7 +82,7 @@ public class TileCrank extends AEBaseTile implements ICustomCollision, ITickable
}
final EnumFacing grinder = this.getUp().getOpposite();
final TileEntity te = this.worldObj.getTileEntity( this.pos.offset( grinder ) );
final TileEntity te = this.world.getTileEntity( this.pos.offset( grinder ) );
if( te instanceof ICrankable )
{
return (ICrankable) te;
@@ -107,8 +107,8 @@ public class TileCrank extends AEBaseTile implements ICustomCollision, ITickable
public void setOrientation( final EnumFacing inForward, final EnumFacing inUp )
{
super.setOrientation( inForward, inUp );
final IBlockState state = this.worldObj.getBlockState( this.pos );
this.getBlockType().neighborChanged( state, this.worldObj, this.pos, state.getBlock() );
final IBlockState state = this.world.getBlockState( this.pos );
this.getBlockType().neighborChanged( state, this.world, this.pos, state.getBlock(), this.pos );
}
@Override
@@ -144,7 +144,7 @@ public class TileCrank extends AEBaseTile implements ICustomCollision, ITickable
this.hits++;
if( this.hits > 10 )
{
this.worldObj.destroyBlock( this.pos, false );
this.world.destroyBlock( this.pos, false );
}
}
}
@@ -50,8 +50,8 @@ public class TileGrinder extends AEBaseInvTile implements ICrankable
public void setOrientation( final EnumFacing inForward, final EnumFacing inUp )
{
super.setOrientation( inForward, inUp );
final IBlockState state = this.worldObj.getBlockState( this.pos );
this.getBlockType().neighborChanged( state, this.worldObj, this.pos, state.getBlock() );
final IBlockState state = this.world.getBlockState( this.pos );
this.getBlockType().neighborChanged( state, this.world, this.pos, state.getBlock(), this.pos );
}
@Override
@@ -111,13 +111,13 @@ public class TileGrinder extends AEBaseInvTile implements ICrankable
final IGrinderRecipe r = AEApi.instance().registries().grinder().getRecipeForInput( item );
if( r != null )
{
if( item.stackSize >= r.getInput().stackSize )
if( item.getCount() >= r.getInput().getCount() )
{
item.stackSize -= r.getInput().stackSize;
item.grow( -r.getInput().getCount() );
final ItemStack ais = item.copy();
ais.stackSize = r.getInput().stackSize;
ais.setCount( r.getInput().getCount() );
if( item.stackSize <= 0 )
if( item.getCount() <= 0 )
{
item = null;
}
@@ -194,7 +194,7 @@ public class TileGrinder extends AEBaseInvTile implements ICrankable
final List<ItemStack> out = new ArrayList<ItemStack>();
out.add( notAdded );
Platform.spawnDrops( this.worldObj, this.pos.offset( this.getForward() ), out );
Platform.spawnDrops( this.world, this.pos.offset( this.getForward() ), out );
}
}
@@ -203,4 +203,11 @@ public class TileGrinder extends AEBaseInvTile implements ICrankable
{
return this.getUp() == directionToCrank;
}
@Override
public boolean isEmpty()
{
// TODO Auto-generated method stub
return false;
}
}
@@ -156,7 +156,7 @@ public class AppEngInternalAEInventory implements IInventory, Iterable<ItemStack
final ItemStack split = this.getStackInSlot( slot );
ItemStack ns = null;
if( qty >= split.stackSize )
if( qty >= split.getCount() )
{
ns = this.getStackInSlot( slot );
this.inv[slot] = null;
@@ -196,16 +196,16 @@ public class AppEngInternalAEInventory implements IInventory, Iterable<ItemStack
if( oldStack != null && newItemStack != null && Platform.itemComparisons().isEqualItem( oldStack, newItemStack ) )
{
if( oldStack.stackSize > newItemStack.stackSize )
if( oldStack.getCount() > newItemStack.getCount() )
{
removed = removed.copy();
removed.stackSize -= newItemStack.stackSize;
removed.grow( -newItemStack.getCount() );
added = null;
}
else if( oldStack.stackSize < newItemStack.stackSize )
else if( oldStack.getCount() < newItemStack.getCount() )
{
added = added.copy();
added.stackSize -= oldStack.stackSize;
added.grow( -oldStack.getCount() );
removed = null;
}
else
@@ -246,7 +246,7 @@ public class AppEngInternalAEInventory implements IInventory, Iterable<ItemStack
}
@Override
public boolean isUseableByPlayer( final EntityPlayer var1 )
public boolean isUsableByPlayer( final EntityPlayer var1 )
{
return true;
}
@@ -80,7 +80,7 @@ public class AppEngInternalInventory implements IInventory, Iterable<ItemStack>
final ItemStack split = this.getStackInSlot( slot );
ItemStack ns = null;
if( qty >= split.stackSize )
if( qty >= split.getCount() )
{
ns = this.inv[slot];
this.inv[slot] = null;
@@ -126,16 +126,16 @@ public class AppEngInternalInventory implements IInventory, Iterable<ItemStack>
if( oldStack != null && newItemStack != null && Platform.itemComparisons().isEqualItem( oldStack, newItemStack ) )
{
if( oldStack.stackSize > newItemStack.stackSize )
if( oldStack.getCount() > newItemStack.getCount() )
{
removed = removed.copy();
removed.stackSize -= newItemStack.stackSize;
removed.grow( -newItemStack.getCount() );
added = null;
}
else if( oldStack.stackSize < newItemStack.stackSize )
else if( oldStack.getCount() < newItemStack.getCount() )
{
added = added.copy();
added.stackSize -= oldStack.stackSize;
added.grow( -oldStack.getCount() );
removed = null;
}
else
@@ -178,7 +178,7 @@ public class AppEngInternalInventory implements IInventory, Iterable<ItemStack>
}
@Override
public boolean isUseableByPlayer( final EntityPlayer var1 )
public boolean isUsableByPlayer( final EntityPlayer var1 )
{
return true;
}
@@ -250,7 +250,7 @@ public class AppEngInternalInventory implements IInventory, Iterable<ItemStack>
if( c != null )
{
this.inv[x] = ItemStack.loadItemStackFromNBT( c );
this.inv[x] = new ItemStack( c );
}
}
catch( final Exception e )
@@ -92,7 +92,7 @@ public class AppEngNullInventory implements IInventory
}
@Override
public boolean isUseableByPlayer( final EntityPlayer var1 )
public boolean isUsableByPlayer( final EntityPlayer var1 )
{
return false;
}
@@ -144,4 +144,10 @@ public class AppEngNullInventory implements IInventory
{
}
@Override
public boolean isEmpty()
{
return true;
}
}
@@ -142,7 +142,7 @@ public class TileCharger extends AENetworkPowerTile implements ICrankable, IGrid
{
this.extractAEPower( this.getInternalMaxPower(), Actionable.MODULATE, PowerMultiplier.CONFIG );// 1500
materials.certusQuartzCrystalCharged().maybeStack( myItem.stackSize ).ifPresent( charged -> this.setInventorySlotContents( 0, charged ) );
materials.certusQuartzCrystalCharged().maybeStack( myItem.getCount() ).ifPresent( charged -> this.setInventorySlotContents( 0, charged ) );
}
}
}
@@ -232,7 +232,7 @@ public class TileCharger extends AENetworkPowerTile implements ICrankable, IGrid
final List<ItemStack> drops = new ArrayList<ItemStack>();
drops.add( myItem );
this.setInventorySlotContents( 0, null );
Platform.spawnDrops( this.worldObj, this.pos.offset( this.getForward() ), drops );
Platform.spawnDrops( this.world, this.pos.offset( this.getForward() ), drops );
}
}
@@ -296,10 +296,17 @@ public class TileCharger extends AENetworkPowerTile implements ICrankable, IGrid
{
this.extractAEPower( this.getInternalMaxPower(), Actionable.MODULATE, PowerMultiplier.CONFIG );// 1500
materials.certusQuartzCrystalCharged().maybeStack( myItem.stackSize ).ifPresent( charged -> this.setInventorySlotContents( 0, charged ) );
materials.certusQuartzCrystalCharged().maybeStack( myItem.getCount() ).ifPresent( charged -> this.setInventorySlotContents( 0, charged ) );
}
}
return true;
}
@Override
public boolean isEmpty()
{
// TODO Auto-generated method stub
return false;
}
}
@@ -135,7 +135,8 @@ public class TileCondenser extends AEBaseInvTile implements IConfigManagerHost,
private boolean canAddOutput( final ItemStack output )
{
final ItemStack outputStack = this.getStackInSlot( 1 );
return outputStack == null || ( Platform.itemComparisons().isEqualItem( outputStack, output ) && outputStack.stackSize < outputStack.getMaxStackSize() );
return outputStack == null || ( Platform.itemComparisons().isEqualItem( outputStack,
output ) && outputStack.getCount() < outputStack.getMaxStackSize() );
}
/**
@@ -152,7 +153,7 @@ public class TileCondenser extends AEBaseInvTile implements IConfigManagerHost,
}
else
{
outputStack.stackSize++;
outputStack.grow( 1 );
this.setInventorySlotContents( 1, outputStack );
}
}
@@ -193,7 +194,7 @@ public class TileCondenser extends AEBaseInvTile implements IConfigManagerHost,
{
if( itemstack != null )
{
this.addPower( itemstack.stackSize );
this.addPower( itemstack.getCount() );
}
}
else
@@ -216,7 +217,7 @@ public class TileCondenser extends AEBaseInvTile implements IConfigManagerHost,
final ItemStack is = inv.getStackInSlot( 0 );
if( is != null )
{
this.addPower( is.stackSize );
this.addPower( is.getCount() );
inv.setInventorySlotContents( 0, null );
}
}
@@ -325,7 +326,7 @@ public class TileCondenser extends AEBaseInvTile implements IConfigManagerHost,
}
if( !simulate && stack != null )
{
addPower( stack.stackSize );
addPower( stack.getCount() );
}
return null;
}
@@ -335,12 +336,16 @@ public class TileCondenser extends AEBaseInvTile implements IConfigManagerHost,
{
return null;
}
@Override
public int getSlotLimit( int slot )
{
return 0;
}
}
private static final IFluidTankProperties[] EMPTY = { new FluidTankProperties( null, 10, true, false ) };
/**
* A fluid handler that exposes a 10 bucket tank that can only be filled, and - when filled - will add power
* to this condenser.
@@ -380,10 +385,11 @@ public class TileCondenser extends AEBaseInvTile implements IConfigManagerHost,
}
}
/**
* This is used to expose a fake ME subnetwork that is only composed of this condenser tile. The purpose of this is to enable the condenser to
* override the {@link appeng.api.storage.IMEInventoryHandler#validForPass(int)} method to make sure a condenser is only ever used if an item
* This is used to expose a fake ME subnetwork that is only composed of this condenser tile. The purpose of this is
* to enable the condenser to
* override the {@link appeng.api.storage.IMEInventoryHandler#validForPass(int)} method to make sure a condenser is
* only ever used if an item
* can't go anywhere else.
*/
private class MEHandler implements IStorageMonitorableAccessor, IStorageMonitorable
@@ -411,4 +417,11 @@ public class TileCondenser extends AEBaseInvTile implements IConfigManagerHost,
return fluidInventory;
}
}
@Override
public boolean isEmpty()
{
// TODO Auto-generated method stub
return false;
}
}
@@ -344,17 +344,17 @@ public class TileInscriber extends AENetworkPowerTile implements IGridTickable,
final ItemStack plateB = this.getStackInSlot( 1 );
ItemStack renamedItem = this.getStackInSlot( 2 );
if( plateA != null && plateA.stackSize > 1 )
if( plateA != null && plateA.getCount() > 1 )
{
return null;
}
if( plateB != null && plateB.stackSize > 1 )
if( plateB != null && plateB.getCount() > 1 )
{
return null;
}
if( renamedItem != null && renamedItem.stackSize > 1 )
if( renamedItem != null && renamedItem.getCount() > 1 )
{
return null;
}
@@ -723,6 +723,20 @@ public class TileInscriber extends AENetworkPowerTile implements IGridTickable,
}
}
@Override
public int getSlotLimit( int slot )
{
// TODO Auto-generated method stub
return 0;
}
}
@Override
public boolean isEmpty()
{
// TODO Auto-generated method stub
return false;
}
}
@@ -361,4 +361,11 @@ public class TileInterface extends AENetworkInvTile implements IGridTickable, II
}
return super.getCapability( capability, facing );
}
@Override
public boolean isEmpty()
{
// TODO Auto-generated method stub
return false;
}
}
@@ -49,12 +49,12 @@ public class TileLightDetector extends AEBaseTile implements ITickable
public void updateLight()
{
final int val = this.worldObj.getLight( this.pos );
final int val = this.world.getLight( this.pos );
if( this.lastLight != val )
{
this.lastLight = val;
Platform.notifyBlocksOfNeighbors( this.worldObj, this.pos );
Platform.notifyBlocksOfNeighbors( this.world, this.pos );
}
}
@@ -130,9 +130,9 @@ public class TilePaint extends AEBaseTile
this.isLit = 14;
}
if( this.worldObj != null )
if( this.world != null )
{
this.worldObj.getLightFor( EnumSkyBlock.BLOCK, this.pos );
this.world.getLightFor( EnumSkyBlock.BLOCK, this.pos );
}
}
@@ -170,8 +170,8 @@ public class TilePaint extends AEBaseTile
public boolean isSideValid( final EnumFacing side )
{
final BlockPos p = this.pos.offset( side );
final IBlockState blk = this.worldObj.getBlockState( p );
return blk.getBlock().isSideSolid( this.worldObj.getBlockState( p ), this.worldObj, p, side.getOpposite() );
final IBlockState blk = this.world.getBlockState( p );
return blk.getBlock().isSideSolid( this.world.getBlockState( p ), this.world, p, side.getOpposite() );
}
private void removeSide( final EnumFacing side )
@@ -210,7 +210,7 @@ public class TilePaint extends AEBaseTile
if( this.dots == null )
{
this.worldObj.setBlockToAir( this.pos );
this.world.setBlockToAir( this.pos );
}
}
@@ -235,8 +235,8 @@ public class TilePaint extends AEBaseTile
{
final BlockPos p = this.pos.offset( side );
final IBlockState blk = this.worldObj.getBlockState( p );
if( blk.getBlock().isSideSolid( this.worldObj.getBlockState( p ), this.worldObj, p, side.getOpposite() ) )
final IBlockState blk = this.world.getBlockState( p );
if( blk.getBlock().isSideSolid( this.world.getBlockState( p ), this.world, p, side.getOpposite() ) )
{
final ItemPaintBall ipb = (ItemPaintBall) type.getItem();
@@ -194,7 +194,7 @@ public class TileSecurityStation extends AENetworkTile implements ITerminalHost,
final NBTBase obj = storedItems.getTag( (String) key );
if( obj instanceof NBTTagCompound )
{
this.inventory.getStoredItems().add( AEItemStack.create( ItemStack.loadItemStackFromNBT( (NBTTagCompound) obj ) ) );
this.inventory.getStoredItems().add( AEItemStack.create( new ItemStack( (NBTTagCompound) obj ) ) );
}
}
}
@@ -160,7 +160,7 @@ public class TileVibrationChamber extends AENetworkInvTile implements IGridTicka
if( is != null )
{
final int newBurnTime = TileEntityFurnace.getItemBurnTime( is );
if( newBurnTime > 0 && is.stackSize > 0 )
if( newBurnTime > 0 && is.getCount() > 0 )
{
return true;
}
@@ -247,12 +247,12 @@ public class TileVibrationChamber extends AENetworkInvTile implements IGridTicka
if( is != null )
{
final int newBurnTime = TileEntityFurnace.getItemBurnTime( is );
if( newBurnTime > 0 && is.stackSize > 0 )
if( newBurnTime > 0 && is.getCount() > 0 )
{
this.setBurnTime( this.getBurnTime() + newBurnTime );
this.setMaxBurnTime( this.getBurnTime() );
is.stackSize--;
if( is.stackSize <= 0 )
is.grow( -1 );
if( is.getCount() <= 0 )
{
ItemStack container = null;
@@ -290,9 +290,9 @@ public class TileVibrationChamber extends AENetworkInvTile implements IGridTicka
this.isOn = this.getBurnTime() > 0;
this.markForUpdate();
if( this.hasWorldObj() )
if( this.hasWorld() )
{
Platform.notifyBlocksOfNeighbors( this.worldObj, this.pos );
Platform.notifyBlocksOfNeighbors( this.world, this.pos );
}
}
}
@@ -326,4 +326,11 @@ public class TileVibrationChamber extends AENetworkInvTile implements IGridTicka
{
this.burnTime = burnTime;
}
@Override
public boolean isEmpty()
{
// TODO Auto-generated method stub
return false;
}
}
@@ -87,7 +87,7 @@ public class TileCableBus extends AEBaseTile implements AEMultiTile, ICustomColl
if( newLV != this.oldLV )
{
this.oldLV = newLV;
this.worldObj.checkLight( this.pos );
this.world.checkLight( this.pos );
}
this.updateTileSetting();
@@ -176,7 +176,7 @@ public class TileCableBus extends AEBaseTile implements AEMultiTile, ICustomColl
@Override
public void markForUpdate()
{
if( this.worldObj == null )
if( this.world == null )
{
return;
}
@@ -185,8 +185,8 @@ public class TileCableBus extends AEBaseTile implements AEMultiTile, ICustomColl
if( newLV != this.oldLV )
{
this.oldLV = newLV;
this.worldObj.checkLight( this.pos );
// worldObj.updateAllLightTypes( xCoord, yCoord, zCoord );
this.world.checkLight( this.pos );
// world.updateAllLightTypes( xCoord, yCoord, zCoord );
}
super.markForUpdate();
@@ -216,9 +216,9 @@ public class TileCableBus extends AEBaseTile implements AEMultiTile, ICustomColl
super.onReady();
if( this.getCableBus().isEmpty() )
{
if( this.worldObj.getTileEntity( this.pos ) == this )
if( this.world.getTileEntity( this.pos ) == this )
{
this.worldObj.destroyBlock( this.pos, true );
this.world.destroyBlock( this.pos, true );
}
}
else
@@ -354,9 +354,9 @@ public class TileCableBus extends AEBaseTile implements AEMultiTile, ICustomColl
@Override
public void notifyNeighbors()
{
if( this.worldObj != null && this.worldObj.isBlockLoaded( this.pos ) && !CableBusContainer.isLoading() )
if( this.world != null && this.world.isBlockLoaded( this.pos ) && !CableBusContainer.isLoading() )
{
Platform.notifyBlocksOfNeighbors( this.worldObj, this.pos );
Platform.notifyBlocksOfNeighbors( this.world, this.pos );
}
}
@@ -128,9 +128,9 @@ public class TileController extends AENetworkPowerTile
metaState = ControllerBlockState.offline;
}
if( this.checkController( this.pos ) && this.worldObj.getBlockState( this.pos ).getValue( BlockController.CONTROLLER_STATE ) != metaState )
if( this.checkController( this.pos ) && this.world.getBlockState( this.pos ).getValue( BlockController.CONTROLLER_STATE ) != metaState )
{
this.worldObj.setBlockState( this.pos, this.worldObj.getBlockState( this.pos ).withProperty( BlockController.CONTROLLER_STATE, metaState ) );
this.world.setBlockState( this.pos, this.world.getBlockState( this.pos ).withProperty( BlockController.CONTROLLER_STATE, metaState ) );
}
}
@@ -219,11 +219,18 @@ public class TileController extends AENetworkPowerTile
private boolean checkController( final BlockPos pos )
{
final BlockPos ownPos = this.getPos();
if( this.worldObj.getChunkProvider().getLoadedChunk( ownPos.getX() >> 4, ownPos.getZ() >> 4 ) != null )
if( this.world.getChunkProvider().getLoadedChunk( ownPos.getX() >> 4, ownPos.getZ() >> 4 ) != null )
{
return this.worldObj.getTileEntity( pos ) instanceof TileController;
return this.world.getTileEntity( pos ) instanceof TileController;
}
return false;
}
@Override
public boolean isEmpty()
{
// TODO Auto-generated method stub
return false;
}
}
@@ -119,4 +119,11 @@ public class TileEnergyAcceptor extends AENetworkPowerTile
return this.sides;
}
@Override
public boolean isEmpty()
{
// TODO Auto-generated method stub
return false;
}
}
@@ -60,7 +60,7 @@ public class TileEnergyCell extends AENetworkTile implements IAEPowerStorage
public void onReady()
{
super.onReady();
final int value = this.worldObj.getBlockState( this.pos ).getValue( BlockEnergyCell.ENERGY_STORAGE );
final int value = this.world.getBlockState( this.pos ).getValue( BlockEnergyCell.ENERGY_STORAGE );
this.currentMeta = (byte) value;
this.changePowerLevel();
}
@@ -95,14 +95,14 @@ public class TileEnergyCell extends AENetworkTile implements IAEPowerStorage
if( this.currentMeta != storageLevel )
{
this.currentMeta = (byte) storageLevel;
this.worldObj.setBlockState( this.pos, this.worldObj.getBlockState( this.pos ).withProperty( BlockEnergyCell.ENERGY_STORAGE, storageLevel ) );
this.world.setBlockState( this.pos, this.world.getBlockState( this.pos ).withProperty( BlockEnergyCell.ENERGY_STORAGE, storageLevel ) );
}
}
@TileEvent( TileEventType.WORLD_NBT_WRITE )
public void writeToNBT_TileEnergyCell( final NBTTagCompound data )
{
if( !this.worldObj.isRemote )
if( !this.world.isRemote )
{
data.setDouble( "internalCurrentPower", this.internalCurrentPower );
}
@@ -169,7 +169,7 @@ public class TileWireless extends AENetworkInvTile implements IWirelessAccessPoi
private int getBoosters()
{
final ItemStack boosters = this.inv.getStackInSlot( 0 );
return boosters == null ? 0 : boosters.stackSize;
return boosters == null ? 0 : boosters.getCount();
}
@Override
@@ -223,4 +223,11 @@ public class TileWireless extends AENetworkInvTile implements IWirelessAccessPoi
{
this.clientFlags = clientFlags;
}
@Override
public boolean isEmpty()
{
// TODO Auto-generated method stub
return false;
}
}
@@ -259,7 +259,7 @@ public class TileQuantumBridge extends AENetworkInvTile implements IAEMultiBlock
for( final EnumFacing d : EnumFacing.values() )
{
final TileEntity te = this.worldObj.getTileEntity( this.pos.offset( d ) );
final TileEntity te = this.world.getTileEntity( this.pos.offset( d ) );
if( te instanceof TileQuantumBridge )
{
set.add( d );
@@ -315,7 +315,7 @@ public class TileQuantumBridge extends AENetworkInvTile implements IAEMultiBlock
public void neighborUpdate()
{
this.calc.calculateMultiblock( this.worldObj, this.getLocation() );
this.calc.calculateMultiblock( this.world, this.getLocation() );
}
@Override
@@ -345,4 +345,11 @@ public class TileQuantumBridge extends AENetworkInvTile implements IAEMultiBlock
{
return this.corner;
}
@Override
public boolean isEmpty()
{
// TODO Auto-generated method stub
return false;
}
}
@@ -89,7 +89,7 @@ public class TileSpatialIOPort extends AENetworkInvTile implements IWorldCallabl
public void updateRedstoneState()
{
final YesNo currentState = this.worldObj.isBlockIndirectlyGettingPowered( this.pos ) != 0 ? YesNo.YES : YesNo.NO;
final YesNo currentState = this.world.isBlockIndirectlyGettingPowered( this.pos ) != 0 ? YesNo.YES : YesNo.NO;
if( this.lastRedstoneState != currentState )
{
this.lastRedstoneState = currentState;
@@ -143,7 +143,7 @@ public class TileSpatialIOPort extends AENetworkInvTile implements IWorldCallabl
final MENetworkEvent res = gi.postEvent( new MENetworkSpatialEvent( this, req ) );
if( !res.isCanceled() )
{
final TransitionResult tr = sc.doSpatialTransition( cell, this.worldObj, spc.getMin(), spc.getMax(), true );
final TransitionResult tr = sc.doSpatialTransition( cell, this.world, spc.getMin(), spc.getMax(), true );
if( tr.success )
{
energy.extractAEPower( req, Actionable.MODULATE, PowerMultiplier.CONFIG );
@@ -205,4 +205,11 @@ public class TileSpatialIOPort extends AENetworkInvTile implements IWorldCallabl
{
return this.sides;
}
@Override
public boolean isEmpty()
{
// TODO Auto-generated method stub
return false;
}
}
@@ -96,7 +96,7 @@ public class TileSpatialPylon extends AENetworkTile implements IAEMultiBlock
public void neighborChanged()
{
this.calc.calculateMultiblock( this.worldObj, this.getLocation() );
this.calc.calculateMultiblock( this.world, this.getLocation() );
}
@Override
@@ -197,8 +197,8 @@ public class TileSpatialPylon extends AENetworkTile implements IAEMultiBlock
if( hasLight != this.didHaveLight )
{
this.didHaveLight = hasLight;
this.worldObj.checkLight( this.pos );
// worldObj.updateAllLightTypes( xCoord, yCoord, zCoord );
this.world.checkLight( this.pos );
// world.updateAllLightTypes( xCoord, yCoord, zCoord );
}
}
@@ -35,10 +35,6 @@ import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.ITickable;
import net.minecraftforge.common.capabilities.Capability;
import net.minecraftforge.fluids.Fluid;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.FluidTankInfo;
import net.minecraftforge.fluids.IFluidHandler;
import appeng.api.AEApi;
import appeng.api.config.AccessRestriction;
@@ -95,10 +91,9 @@ import appeng.tile.inventory.InvOperation;
import appeng.util.ConfigManager;
import appeng.util.IConfigManagerHost;
import appeng.util.Platform;
import appeng.util.item.AEFluidStack;
public class TileChest extends AENetworkPowerTile implements IMEChest, IFluidHandler, ITerminalHost, IPriorityHost, IConfigManagerHost, IColorableTile, ITickable
public class TileChest extends AENetworkPowerTile implements IMEChest, ITerminalHost, IPriorityHost, IConfigManagerHost, IColorableTile, ITickable
{
private static final ChestNoHandler NO_HANDLER = new ChestNoHandler();
@@ -336,7 +331,7 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, IFluidHan
@Override
public boolean isCellBlinking( final int slot )
{
final long now = this.worldObj.getTotalWorldTime();
final long now = this.world.getTotalWorldTime();
if( now - this.lastStateChange > 8 )
{
return false;
@@ -371,7 +366,7 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, IFluidHan
@Override
public void update()
{
if( this.worldObj.isRemote )
if( this.world.isRemote )
{
return;
}
@@ -407,7 +402,7 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, IFluidHan
@TileEvent( TileEventType.NETWORK_WRITE )
public void writeToStream_TileChest( final ByteBuf data )
{
if( this.worldObj.getTotalWorldTime() - this.lastStateChange > 8 )
if( this.world.getTotalWorldTime() - this.lastStateChange > 8 )
{
this.state = 0;
}
@@ -466,7 +461,7 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, IFluidHan
this.storageType = new ItemStack( Item.getItemById( item & 0xffff ), 1, item >> Platform.DEF_OFFSET );
}
this.lastStateChange = this.worldObj.getTotalWorldTime();
this.lastStateChange = this.world.getTotalWorldTime();
return oldPaintedColor != this.paintedColor || ( this.state & 0xDB6DB6DB ) != ( oldState & 0xDB6DB6DB ) || !Platform.itemComparisons().isSameItem( oldType, this.storageType );
}
@@ -549,9 +544,9 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, IFluidHan
}
// update the neighbors
if( this.worldObj != null )
if( this.world != null )
{
Platform.notifyBlocksOfNeighbors( this.worldObj, this.pos );
Platform.notifyBlocksOfNeighbors( this.world, this.pos );
this.markForUpdate();
}
}
@@ -577,7 +572,7 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, IFluidHan
{
final IMEInventory<IAEItemStack> cell = this.getHandler( StorageChannel.ITEMS );
final IAEItemStack returns = cell.injectItems( AEApi.instance().storage().createItemStack( this.inv.getStackInSlot( 0 ) ), Actionable.SIMULATE, this.mySrc );
return returns == null || returns.getStackSize() != insertingItem.stackSize;
return returns == null || returns.getStackSize() != insertingItem.getCount();
}
catch( final ChestNoHandler ignored )
{
@@ -687,7 +682,7 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, IFluidHan
@Override
public void blinkCell( final int slot )
{
final long now = this.worldObj.getTotalWorldTime();
final long now = this.world.getTotalWorldTime();
if( now - this.lastStateChange > 8 )
{
this.state = 0;
@@ -699,84 +694,6 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, IFluidHan
this.recalculateDisplay();
}
@Override
public int fill( final EnumFacing from, final FluidStack resource, final boolean doFill )
{
final double req = resource.amount / 500.0;
final double available = this.extractAEPower( req, Actionable.SIMULATE, PowerMultiplier.CONFIG );
if( available >= req - 0.01 )
{
try
{
final IMEInventoryHandler h = this.getHandler( StorageChannel.FLUIDS );
this.extractAEPower( req, Actionable.MODULATE, PowerMultiplier.CONFIG );
final IAEStack results = h.injectItems( AEFluidStack.create( resource ), doFill ? Actionable.MODULATE : Actionable.SIMULATE, this.mySrc );
if( results == null )
{
return resource.amount;
}
return resource.amount - (int) results.getStackSize();
}
catch( final ChestNoHandler ignored )
{
}
}
return 0;
}
@Override
public FluidStack drain( final EnumFacing from, final FluidStack resource, final boolean doDrain )
{
return null;
}
@Override
public FluidStack drain( final EnumFacing from, final int maxDrain, final boolean doDrain )
{
return null;
}
@Override
public boolean canFill( final EnumFacing from, final Fluid fluid )
{
try
{
final IMEInventoryHandler h = this.getHandler( StorageChannel.FLUIDS );
return h.canAccept( AEFluidStack.create( new FluidStack( fluid, 1 ) ) );
}
catch( final ChestNoHandler ignored )
{
}
return false;
}
@Override
public boolean canDrain( final EnumFacing from, final Fluid fluid )
{
return false;
}
@Override
public FluidTankInfo[] getTankInfo( final EnumFacing from )
{
try
{
final IMEInventoryHandler h = this.getHandler( StorageChannel.FLUIDS );
if( h.getChannel() == StorageChannel.FLUIDS )
{
return new FluidTankInfo[] { new FluidTankInfo( null, 1 ) }; // eh?
}
}
catch( final ChestNoHandler ignored )
{
}
return null;
}
public ItemStack getStorageType()
{
if( this.isPowered() )
@@ -854,7 +771,7 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, IFluidHan
@Override
public void saveChanges( final IMEInventory cellInventory )
{
this.worldObj.markChunkDirty( this.pos, this );
this.world.markChunkDirty( this.pos, this );
}
private static class ChestNoHandler extends Exception
@@ -1022,4 +939,11 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, IFluidHan
}
}
@Override
public boolean isEmpty()
{
// TODO Auto-generated method stub
return false;
}
}
@@ -407,6 +407,13 @@ public class TileDrive extends AENetworkInvTile implements IChestOrDrive, IPrior
@Override
public void saveChanges( final IMEInventory cellInventory )
{
this.worldObj.markChunkDirty( this.pos, this );
this.world.markChunkDirty( this.pos, this );
}
@Override
public boolean isEmpty()
{
// TODO Auto-generated method stub
return false;
}
}
@@ -175,7 +175,7 @@ public class TileIOPort extends AENetworkInvTile implements IUpgradeableHost, IC
public void updateRedstoneState()
{
final YesNo currentState = this.worldObj.isBlockIndirectlyGettingPowered( this.pos ) != 0 ? YesNo.YES : YesNo.NO;
final YesNo currentState = this.world.isBlockIndirectlyGettingPowered( this.pos ) != 0 ? YesNo.YES : YesNo.NO;
if( this.lastRedstoneState != currentState )
{
this.lastRedstoneState = currentState;
@@ -578,4 +578,11 @@ public class TileIOPort extends AENetworkInvTile implements IUpgradeableHost, IC
}
}
}
@Override
public boolean isEmpty()
{
// TODO Auto-generated method stub
return false;
}
}
@@ -128,9 +128,9 @@ public class TileSkyChest extends AEBaseInvTile implements ITickable
if( !player.isSpectator() )
{
this.setPlayerOpen( this.getPlayerOpen() + 1 );
this.worldObj.addBlockEvent( this.pos, this.getBlockType(), 1, this.numPlayersUsing );
this.worldObj.notifyNeighborsOfStateChange( this.pos, this.getBlockType() );
this.worldObj.notifyNeighborsOfStateChange( this.pos.down(), this.getBlockType() );
this.world.addBlockEvent( this.pos, this.getBlockType(), 1, this.numPlayersUsing );
this.world.notifyNeighborsOfStateChange( this.pos, this.getBlockType(), true );
this.world.notifyNeighborsOfStateChange( this.pos.down(), this.getBlockType(), true );
if( this.getPlayerOpen() == 1 )
{
@@ -146,9 +146,9 @@ public class TileSkyChest extends AEBaseInvTile implements ITickable
if( !player.isSpectator() )
{
this.setPlayerOpen( this.getPlayerOpen() - 1 );
this.worldObj.addBlockEvent( this.pos, this.getBlockType(), 1, this.numPlayersUsing );
this.worldObj.notifyNeighborsOfStateChange( this.pos, this.getBlockType() );
this.worldObj.notifyNeighborsOfStateChange( this.pos.down(), this.getBlockType() );
this.world.addBlockEvent( this.pos, this.getBlockType(), 1, this.numPlayersUsing );
this.world.notifyNeighborsOfStateChange( this.pos, this.getBlockType(), true );
this.world.notifyNeighborsOfStateChange( this.pos.down(), this.getBlockType(), true );
if( this.getPlayerOpen() < 0 )
{
@@ -252,4 +252,11 @@ public class TileSkyChest extends AEBaseInvTile implements ITickable
{
this.lastEvent = lastEvent;
}
@Override
public boolean isEmpty()
{
// TODO Auto-generated method stub
return false;
}
}