Reduces visibility of internal fields/methods

Reduces the visibility of all fields to private and create setters/getters
when necessary. Exceptions are fields with GuiSync as these need to be
public.

Reduces the visibility of internal methods to private/protected/default when possible.
This commit is contained in:
yueh
2015-10-08 15:42:42 +02:00
parent f054bd699b
commit e94a0cfccf
497 changed files with 7865 additions and 6908 deletions
+15 -14
View File
@@ -65,12 +65,12 @@ import appeng.util.SettingsFrom;
public class AEBaseTile extends TileEntity implements IOrientable, ICommonTile, ICustomNameObject
{
public static final ThreadLocal<WeakReference<AEBaseTile>> DROP_NO_ITEMS = new ThreadLocal<WeakReference<AEBaseTile>>();
private static final ThreadLocal<WeakReference<AEBaseTile>> DROP_NO_ITEMS = new ThreadLocal<WeakReference<AEBaseTile>>();
private static final Map<Class<? extends AEBaseTile>, Map<TileEventType, List<AETileEventHandler>>> HANDLERS = new HashMap<Class<? extends AEBaseTile>, Map<TileEventType, List<AETileEventHandler>>>();
private static final Map<Class<? extends TileEntity>, IStackSrc> ITEM_STACKS = new HashMap<Class<? extends TileEntity>, IStackSrc>();
private int renderFragment = 0;
@Nullable
public String customName;
private String customName;
private EnumFacing forward = null;
private EnumFacing up = null;
@@ -83,7 +83,7 @@ public class AEBaseTile extends TileEntity implements IOrientable, ICommonTile,
{
return newSate.getBlock() != oldState.getBlock(); // state dosn't change tile entities in AE2.
}
public static void registerTileItem( final Class<? extends TileEntity> c, final IStackSrc wat )
{
ITEM_STACKS.put( c, wat );
@@ -247,7 +247,7 @@ public class AEBaseTile extends TileEntity implements IOrientable, ICommonTile,
}
}
public final boolean readFromStream( final ByteBuf data )
private final boolean readFromStream( final ByteBuf data )
{
boolean output = false;
@@ -260,8 +260,8 @@ public class AEBaseTile extends TileEntity implements IOrientable, ICommonTile,
final EnumFacing old_Up = this.up;
final byte orientation = data.readByte();
this.forward = EnumFacing.VALUES[ orientation & 0x7 ];
this.up = EnumFacing.VALUES[ orientation >> 3 ];
this.forward = EnumFacing.VALUES[orientation & 0x7];
this.up = EnumFacing.VALUES[orientation >> 3];
output = this.forward != old_Forward || this.up != old_Up;
}
@@ -306,7 +306,7 @@ public class AEBaseTile extends TileEntity implements IOrientable, ICommonTile,
}
}
public final void writeToStream( final ByteBuf data )
private final void writeToStream( final ByteBuf data )
{
try
{
@@ -353,7 +353,7 @@ public class AEBaseTile extends TileEntity implements IOrientable, ICommonTile,
final Class<? extends AEBaseTile> clazz = this.getClass();
final Map<TileEventType, List<AETileEventHandler>> storedHandlers = HANDLERS.get( clazz );
if ( storedHandlers == null )
if( storedHandlers == null )
{
final Map<TileEventType, List<AETileEventHandler>> newStoredHandlers = new EnumMap<TileEventType, List<AETileEventHandler>>( TileEventType.class );
@@ -377,7 +377,8 @@ public class AEBaseTile extends TileEntity implements IOrientable, ICommonTile,
}
@Nonnull
private List<AETileEventHandler> getHandlers( final Map<TileEventType, List<AETileEventHandler>> eventToHandlers, final TileEventType event ) {
private List<AETileEventHandler> getHandlers( final Map<TileEventType, List<AETileEventHandler>> eventToHandlers, final TileEventType event )
{
final List<AETileEventHandler> oldHandlers = eventToHandlers.get( event );
if( oldHandlers == null )
@@ -438,7 +439,7 @@ public class AEBaseTile extends TileEntity implements IOrientable, ICommonTile,
/**
* depending on the from, different settings will be accepted, don't call this with null
*
* @param from source of settings
* @param from source of settings
* @param compound compound of source
*/
public void uploadSettings( final SettingsFrom from, final NBTTagCompound compound )
@@ -477,10 +478,10 @@ public class AEBaseTile extends TileEntity implements IOrientable, ICommonTile,
/**
* returns the contents of the tile entity, into the world, defaults to dropping everything in the inventory.
*
* @param w world
* @param x x pos of tile entity
* @param y y pos of tile entity
* @param z z pos of tile entity
* @param w world
* @param x x pos of tile entity
* @param y y pos of tile entity
* @param z z pos of tile entity
* @param drops drops of tile entity
*/
@Override
@@ -40,13 +40,13 @@ public class TileCraftingMonitorTile extends TileCraftingTile implements IColora
{
@SideOnly( Side.CLIENT )
public Integer dspList;
private Integer dspList;
@SideOnly( Side.CLIENT )
public boolean updateList;
private boolean updateList;
IAEItemStack dspPlay;
AEColor paintedColor = AEColor.Transparent;
private IAEItemStack dspPlay;
private AEColor paintedColor = AEColor.Transparent;
@TileEvent( TileEventType.NETWORK_READ )
public boolean readFromStream_TileCraftingMonitorTile( final ByteBuf data ) throws IOException
@@ -65,7 +65,7 @@ public class TileCraftingMonitorTile extends TileCraftingTile implements IColora
this.dspPlay = null;
}
this.updateList = true;
this.setUpdateList( true );
return oldPaintedColor != this.paintedColor; // tesr!
}
@@ -159,4 +159,24 @@ public class TileCraftingMonitorTile extends TileCraftingTile implements IColora
this.markForUpdate();
return true;
}
public Integer getDisplayList()
{
return this.dspList;
}
public void setDisplayList( final Integer dspList )
{
this.dspList = dspList;
}
public boolean isUpdateList()
{
return this.updateList;
}
public void setUpdateList( final boolean updateList )
{
this.updateList = updateList;
}
}
@@ -27,7 +27,7 @@ import appeng.block.crafting.BlockCraftingUnit;
public class TileCraftingStorageTile extends TileCraftingTile
{
public static final int KILO_SCALAR = 1024;
private static final int KILO_SCALAR = 1024;
@Override
protected ItemStack getItemFromTile( final Object obj )
@@ -57,17 +57,16 @@ import appeng.util.Platform;
public class TileCraftingTile extends AENetworkTile implements IAEMultiBlock, IPowerChannelState
{
private final CraftingCPUCalculator calc = new CraftingCPUCalculator( this );
public NBTTagCompound previousState = null;
public boolean isCoreBlock = false;
CraftingCPUCluster cluster;
private final CraftingCPUCalculator calc = new CraftingCPUCalculator( this );
private NBTTagCompound previousState = null;
private boolean isCoreBlock = false;
private CraftingCPUCluster cluster;
public TileCraftingTile()
{
this.gridProxy.setFlags( GridFlags.MULTIBLOCK, GridFlags.REQUIRE_CHANNEL );
this.gridProxy.setValidSides( EnumSet.noneOf( EnumFacing.class ) );
this.getProxy().setFlags( GridFlags.MULTIBLOCK, GridFlags.REQUIRE_CHANNEL );
this.getProxy().setValidSides( EnumSet.noneOf( EnumFacing.class ) );
}
@Override
@@ -113,8 +112,8 @@ public class TileCraftingTile extends AENetworkTile implements IAEMultiBlock, IP
{
return false;
}
final BlockCraftingUnit unit = (BlockCraftingUnit)this.worldObj.getBlockState( this.pos ).getBlock();
final BlockCraftingUnit unit = (BlockCraftingUnit) this.worldObj.getBlockState( this.pos ).getBlock();
return unit.type == CraftingUnitType.ACCELERATOR;
}
@@ -122,7 +121,7 @@ public class TileCraftingTile extends AENetworkTile implements IAEMultiBlock, IP
public void onReady()
{
super.onReady();
this.gridProxy.setVisualRepresentation( this.getItemFromTile( this ) );
this.getProxy().setVisualRepresentation( this.getItemFromTile( this ) );
this.updateMultiBlock();
}
@@ -152,9 +151,9 @@ public class TileCraftingTile extends AENetworkTile implements IAEMultiBlock, IP
final boolean formed = this.isFormed();
boolean power = false;
if( this.gridProxy.isReady() )
if( this.getProxy().isReady() )
{
power = this.gridProxy.isActive();
power = this.getProxy().isActive();
}
final IBlockState current = this.worldObj.getBlockState( this.pos );
@@ -169,11 +168,11 @@ public class TileCraftingTile extends AENetworkTile implements IAEMultiBlock, IP
{
if( formed )
{
this.gridProxy.setValidSides( EnumSet.allOf( EnumFacing.class ) );
this.getProxy().setValidSides( EnumSet.allOf( EnumFacing.class ) );
}
else
{
this.gridProxy.setValidSides( EnumSet.noneOf( EnumFacing.class ) );
this.getProxy().setValidSides( EnumSet.noneOf( EnumFacing.class ) );
}
}
}
@@ -182,7 +181,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.worldObj.getBlockState( this.pos ).getValue( BlockCraftingUnit.FORMED );
}
return this.cluster != null;
}
@@ -190,8 +189,8 @@ public class TileCraftingTile extends AENetworkTile implements IAEMultiBlock, IP
@TileEvent( TileEventType.WORLD_NBT_WRITE )
public void writeToNBT_TileCraftingTile( final NBTTagCompound data )
{
data.setBoolean( "core", this.isCoreBlock );
if( this.isCoreBlock && this.cluster != null )
data.setBoolean( "core", this.isCoreBlock() );
if( this.isCoreBlock() && this.cluster != null )
{
this.cluster.writeToNBT( data );
}
@@ -200,8 +199,8 @@ public class TileCraftingTile extends AENetworkTile implements IAEMultiBlock, IP
@TileEvent( TileEventType.WORLD_NBT_READ )
public void readFromNBT_TileCraftingTile( final NBTTagCompound data )
{
this.isCoreBlock = data.getBoolean( "core" );
if( this.isCoreBlock )
this.setCoreBlock( data.getBoolean( "core" ) );
if( this.isCoreBlock() )
{
if( this.cluster != null )
{
@@ -209,7 +208,7 @@ public class TileCraftingTile extends AENetworkTile implements IAEMultiBlock, IP
}
else
{
this.previousState = (NBTTagCompound) data.copy();
this.setPreviousState( (NBTTagCompound) data.copy() );
}
}
}
@@ -334,9 +333,9 @@ public class TileCraftingTile extends AENetworkTile implements IAEMultiBlock, IP
{
if( Platform.isClient() )
{
return (boolean)this.worldObj.getBlockState( this.pos ).getValue( BlockCraftingUnit.POWERED );
return (boolean) this.worldObj.getBlockState( this.pos ).getValue( BlockCraftingUnit.POWERED );
}
return this.gridProxy.isActive();
return this.getProxy().isActive();
}
@Override
@@ -344,8 +343,28 @@ public class TileCraftingTile extends AENetworkTile implements IAEMultiBlock, IP
{
if( Platform.isServer() )
{
return this.gridProxy.isActive();
return this.getProxy().isActive();
}
return this.isPowered() && this.isFormed();
}
public boolean isCoreBlock()
{
return this.isCoreBlock;
}
public void setCoreBlock( final boolean isCoreBlock )
{
this.isCoreBlock = isCoreBlock;
}
public NBTTagCompound getPreviousState()
{
return this.previousState;
}
public void setPreviousState( final NBTTagCompound previousState )
{
this.previousState = previousState;
}
}
@@ -100,12 +100,12 @@ public class TileMolecularAssembler extends AENetworkInvTile implements IUpgrade
this.settings = new ConfigManager( this );
this.settings.registerSetting( Settings.REDSTONE_CONTROLLED, RedstoneMode.IGNORE );
this.inv.setMaxStackSize( 1 );
this.gridProxy.setIdlePowerUsage( 0.0 );
this.getProxy().setIdlePowerUsage( 0.0 );
this.upgrades = new DefinitionUpgradeInventory( assembler, this, this.getUpgradeSlots() );
this.craftingInv = new InventoryCrafting( new ContainerNull(), 3, 3 );
}
protected int getUpgradeSlots()
private int getUpgradeSlots()
{
return 5;
}
@@ -150,11 +150,11 @@ public class TileMolecularAssembler extends AENetworkInvTile implements IUpgrade
{
if( this.isAwake )
{
this.gridProxy.getTick().wakeDevice( this.gridProxy.getNode() );
this.getProxy().getTick().wakeDevice( this.getProxy().getNode() );
}
else
{
this.gridProxy.getTick().sleepDevice( this.gridProxy.getNode() );
this.getProxy().getTick().sleepDevice( this.getProxy().getNode() );
}
}
catch( final GridAccessException e )
@@ -554,7 +554,7 @@ public class TileMolecularAssembler extends AENetworkInvTile implements IUpgrade
{
try
{
return (int) ( this.gridProxy.getEnergy().extractAEPower( ticksPassed * bonusValue * acceleratorTax, Actionable.MODULATE, PowerMultiplier.CONFIG ) / acceleratorTax );
return (int) ( this.getProxy().getEnergy().extractAEPower( ticksPassed * bonusValue * acceleratorTax, Actionable.MODULATE, PowerMultiplier.CONFIG ) / acceleratorTax );
}
catch( final GridAccessException e )
{
@@ -630,7 +630,7 @@ public class TileMolecularAssembler extends AENetworkInvTile implements IUpgrade
try
{
newState = this.gridProxy.isActive() && this.gridProxy.getEnergy().extractAEPower( 1, Actionable.SIMULATE, PowerMultiplier.CONFIG ) > 0.0001;
newState = this.getProxy().isActive() && this.getProxy().getEnergy().extractAEPower( 1, Actionable.SIMULATE, PowerMultiplier.CONFIG ) > 0.0001;
}
catch( final GridAccessException ignored )
{
@@ -655,4 +655,5 @@ public class TileMolecularAssembler extends AENetworkInvTile implements IUpgrade
{
return this.isPowered;
}
}
@@ -33,24 +33,24 @@ import appeng.tile.events.TileEventType;
public abstract class AENetworkInvTile extends AEBaseInvTile implements IActionHost, IGridProxyable
{
protected final AENetworkProxy gridProxy = new AENetworkProxy( this, "proxy", this.getItemFromTile( this ), true );
private final AENetworkProxy gridProxy = new AENetworkProxy( this, "proxy", this.getItemFromTile( this ), true );
@TileEvent( TileEventType.WORLD_NBT_READ )
public void readFromNBT_AENetwork( final NBTTagCompound data )
{
this.gridProxy.readFromNBT( data );
this.getProxy().readFromNBT( data );
}
@TileEvent( TileEventType.WORLD_NBT_WRITE )
public void writeToNBT_AENetwork( final NBTTagCompound data )
{
this.gridProxy.writeToNBT( data );
this.getProxy().writeToNBT( data );
}
@Override
public AENetworkProxy getProxy()
{
return this.gridProxy;
return this.getProxy();
}
@Override
@@ -62,54 +62,54 @@ public abstract class AENetworkInvTile extends AEBaseInvTile implements IActionH
@Override
public IGridNode getGridNode( final AEPartLocation dir )
{
return this.gridProxy.getNode();
return this.getProxy().getNode();
}
@Override
public void onChunkUnload()
{
super.onChunkUnload();
this.gridProxy.onChunkUnload();
this.getProxy().onChunkUnload();
}
@Override
public void onReady()
{
super.onReady();
this.gridProxy.onReady();
this.getProxy().onReady();
}
@Override
public void invalidate()
{
super.invalidate();
this.gridProxy.invalidate();
this.getProxy().invalidate();
}
@Override
public void validate()
{
super.validate();
this.gridProxy.validate();
this.getProxy().validate();
}
@Override
public IGridNode getActionableNode()
{
return this.gridProxy.getNode();
return this.getProxy().getNode();
}
@Override
public int getField(
final int id )
{
return 0;
}
@Override
public int getFieldCount()
{
return 0;
}
}
@@ -35,18 +35,18 @@ import appeng.tile.powersink.AEBasePoweredTile;
public abstract class AENetworkPowerTile extends AEBasePoweredTile implements IActionHost, IGridProxyable
{
protected final AENetworkProxy gridProxy = new AENetworkProxy( this, "proxy", this.getItemFromTile( this ), true );
private final AENetworkProxy gridProxy = new AENetworkProxy( this, "proxy", this.getItemFromTile( this ), true );
@TileEvent( TileEventType.WORLD_NBT_READ )
public void readFromNBT_AENetwork( final NBTTagCompound data )
{
this.gridProxy.readFromNBT( data );
this.getProxy().readFromNBT( data );
}
@TileEvent( TileEventType.WORLD_NBT_WRITE )
public void writeToNBT_AENetwork( final NBTTagCompound data )
{
this.gridProxy.writeToNBT( data );
this.getProxy().writeToNBT( data );
}
@Override
@@ -70,7 +70,7 @@ public abstract class AENetworkPowerTile extends AEBasePoweredTile implements IA
@Override
public IGridNode getGridNode( final AEPartLocation dir )
{
return this.gridProxy.getNode();
return this.getProxy().getNode();
}
@Override
@@ -83,33 +83,34 @@ public abstract class AENetworkPowerTile extends AEBasePoweredTile implements IA
public void validate()
{
super.validate();
this.gridProxy.validate();
this.getProxy().validate();
}
@Override
public void invalidate()
{
super.invalidate();
this.gridProxy.invalidate();
this.getProxy().invalidate();
}
@Override
public void onChunkUnload()
{
super.onChunkUnload();
this.gridProxy.onChunkUnload();
this.getProxy().onChunkUnload();
}
@Override
public void onReady()
{
super.onReady();
this.gridProxy.onReady();
this.getProxy().onReady();
}
@Override
public IGridNode getActionableNode()
{
return this.gridProxy.getNode();
return this.getProxy().getNode();
}
}
@@ -35,18 +35,18 @@ import appeng.tile.events.TileEventType;
public class AENetworkTile extends AEBaseTile implements IActionHost, IGridProxyable
{
protected final AENetworkProxy gridProxy = this.createProxy();
private final AENetworkProxy gridProxy = this.createProxy();
@TileEvent( TileEventType.WORLD_NBT_READ )
public void readFromNBT_AENetwork( final NBTTagCompound data )
{
this.gridProxy.readFromNBT( data );
this.getProxy().readFromNBT( data );
}
@TileEvent( TileEventType.WORLD_NBT_WRITE )
public void writeToNBT_AENetwork( final NBTTagCompound data )
{
this.gridProxy.writeToNBT( data );
this.getProxy().writeToNBT( data );
}
protected AENetworkProxy createProxy()
@@ -57,7 +57,7 @@ public class AENetworkTile extends AEBaseTile implements IActionHost, IGridProxy
@Override
public IGridNode getGridNode( final AEPartLocation dir )
{
return this.gridProxy.getNode();
return this.getProxy().getNode();
}
@Override
@@ -70,28 +70,28 @@ public class AENetworkTile extends AEBaseTile implements IActionHost, IGridProxy
public void onChunkUnload()
{
super.onChunkUnload();
this.gridProxy.onChunkUnload();
this.getProxy().onChunkUnload();
}
@Override
public void onReady()
{
super.onReady();
this.gridProxy.onReady();
this.getProxy().onReady();
}
@Override
public void invalidate()
{
super.invalidate();
this.gridProxy.invalidate();
this.getProxy().invalidate();
}
@Override
public void validate()
{
super.validate();
this.gridProxy.validate();
this.getProxy().validate();
}
@Override
@@ -115,6 +115,6 @@ public class AENetworkTile extends AEBaseTile implements IActionHost, IGridProxy
@Override
public IGridNode getActionableNode()
{
return this.gridProxy.getNode();
return this.getProxy().getNode();
}
}
@@ -43,21 +43,21 @@ import appeng.util.Platform;
public class TileCrank extends AEBaseTile implements ICustomCollision, IUpdatePlayerListBox
{
final int ticksPerRotation = 18;
private final int ticksPerRotation = 18;
// sided values..
public float visibleRotation = 0;
public int charge = 0;
private float visibleRotation = 0;
private int charge = 0;
public int hits = 0;
public int rotation = 0;
private int hits = 0;
private int rotation = 0;
@TileEvent( TileEventType.TICK )
public void Tick_TileCrank()
{
if( this.rotation > 0 )
{
this.visibleRotation -= 360 / ( this.ticksPerRotation );
this.setVisibleRotation( this.getVisibleRotation() - 360 / ( this.ticksPerRotation ) );
this.charge++;
if( this.charge >= this.ticksPerRotation )
{
@@ -73,7 +73,7 @@ public class TileCrank extends AEBaseTile implements ICustomCollision, IUpdatePl
}
}
public ICrankable getGrinder()
private ICrankable getGrinder()
{
if( Platform.isClient() )
{
@@ -179,4 +179,14 @@ public class TileCrank extends AEBaseTile implements ICustomCollision, IUpdatePl
out.add( AxisAlignedBB.fromBounds( xOff + 0.15, yOff + 0.15, zOff + 0.15,// ahh
xOff + 0.85, yOff + 0.85, zOff + 0.85 ) );
}
public float getVisibleRotation()
{
return this.visibleRotation;
}
private void setVisibleRotation( final float visibleRotation )
{
this.visibleRotation = visibleRotation;
}
}
@@ -40,10 +40,10 @@ import appeng.util.inv.WrapperInventoryRange;
public class TileGrinder extends AEBaseInvTile implements ICrankable
{
final int[] inputs = { 0, 1, 2 };
final int[] sides = { 0, 1, 2, 3, 4, 5 };
final AppEngInternalInventory inv = new AppEngInternalInventory( this, 7 );
int points;
private final int[] inputs = { 0, 1, 2 };
private final int[] sides = { 0, 1, 2, 3, 4, 5 };
private final AppEngInternalInventory inv = new AppEngInternalInventory( this, 7 );
private int points;
@Override
public void setOrientation( final EnumFacing inForward, final EnumFacing inUp )
@@ -38,10 +38,10 @@ import appeng.util.iterators.InvIterator;
public class AppEngInternalAEInventory implements IInventory, Iterable<ItemStack>
{
protected final IAEAppEngInventory te;
protected final IAEItemStack[] inv;
final int size;
int maxStack;
private final IAEAppEngInventory te;
private final IAEItemStack[] inv;
private final int size;
private int maxStack;
public AppEngInternalAEInventory( final IAEAppEngInventory te, final int s )
{
@@ -80,7 +80,7 @@ public class AppEngInternalAEInventory implements IInventory, Iterable<ItemStack
data.setTag( name, c );
}
public void writeToNBT( final NBTTagCompound target )
private void writeToNBT( final NBTTagCompound target )
{
for( int x = 0; x < this.size; x++ )
{
@@ -110,7 +110,7 @@ public class AppEngInternalAEInventory implements IInventory, Iterable<ItemStack
}
}
public void readFromNBT( final NBTTagCompound target )
private void readFromNBT( final NBTTagCompound target )
{
for( int x = 0; x < this.size; x++ )
{
@@ -35,15 +35,15 @@ import appeng.util.iterators.InvIterator;
public class AppEngInternalInventory implements IInventory, Iterable<ItemStack>
{
protected final int size;
protected final ItemStack[] inv;
public boolean enableClientEvents = false;
protected IAEAppEngInventory te;
protected int maxStack;
private final int size;
private final ItemStack[] inv;
private boolean enableClientEvents = false;
private IAEAppEngInventory te;
private int maxStack;
public AppEngInternalInventory( final IAEAppEngInventory inventory, final int size )
{
this.te = inventory;
this.setTileEntity( inventory );
this.size = size;
this.maxStack = 64;
this.inv = new ItemStack[size];
@@ -96,9 +96,9 @@ public class AppEngInternalInventory implements IInventory, Iterable<ItemStack>
ns = split.splitStack( qty );
}
if( this.te != null && this.eventsEnabled() )
if( this.getTileEntity() != null && this.eventsEnabled() )
{
this.te.onChangeInventory( this, slot, InvOperation.decreaseStackSize, ns, null );
this.getTileEntity().onChangeInventory( this, slot, InvOperation.decreaseStackSize, ns, null );
}
this.markDirty();
@@ -110,7 +110,7 @@ public class AppEngInternalInventory implements IInventory, Iterable<ItemStack>
protected boolean eventsEnabled()
{
return Platform.isServer() || this.enableClientEvents;
return Platform.isServer() || this.isEnableClientEvents();
}
@Override
@@ -125,7 +125,7 @@ public class AppEngInternalInventory implements IInventory, Iterable<ItemStack>
final ItemStack oldStack = this.inv[slot];
this.inv[slot] = newItemStack;
if( this.te != null && this.eventsEnabled() )
if( this.getTileEntity() != null && this.eventsEnabled() )
{
ItemStack removed = oldStack;
ItemStack added = newItemStack;
@@ -150,7 +150,7 @@ public class AppEngInternalInventory implements IInventory, Iterable<ItemStack>
}
}
this.te.onChangeInventory( this, slot, InvOperation.setInventorySlotContents, removed, added );
this.getTileEntity().onChangeInventory( this, slot, InvOperation.setInventorySlotContents, removed, added );
this.markDirty();
}
@@ -177,9 +177,9 @@ public class AppEngInternalInventory implements IInventory, Iterable<ItemStack>
@Override
public void markDirty()
{
if( this.te != null && this.eventsEnabled() )
if( this.getTileEntity() != null && this.eventsEnabled() )
{
this.te.onChangeInventory( this, -1, InvOperation.markDirty, null, null );
this.getTileEntity().onChangeInventory( this, -1, InvOperation.markDirty, null, null );
}
}
@@ -203,9 +203,9 @@ public class AppEngInternalInventory implements IInventory, Iterable<ItemStack>
// for guis...
public void markDirty( final int slotIndex )
{
if( this.te != null && this.eventsEnabled() )
if( this.getTileEntity() != null && this.eventsEnabled() )
{
this.te.onChangeInventory( this, slotIndex, InvOperation.markDirty, null, null );
this.getTileEntity().onChangeInventory( this, slotIndex, InvOperation.markDirty, null, null );
}
}
@@ -216,7 +216,7 @@ public class AppEngInternalInventory implements IInventory, Iterable<ItemStack>
data.setTag( name, c );
}
public void writeToNBT( final NBTTagCompound target )
private void writeToNBT( final NBTTagCompound target )
{
for( int x = 0; x < this.size; x++ )
{
@@ -282,14 +282,14 @@ public class AppEngInternalInventory implements IInventory, Iterable<ItemStack>
public void openInventory(
final EntityPlayer player )
{
}
@Override
public void closeInventory(
final EntityPlayer player )
{
}
@Override
@@ -303,7 +303,7 @@ public class AppEngInternalInventory implements IInventory, Iterable<ItemStack>
public void setField(
final int id,
final int value )
{
{
}
@Override
@@ -317,7 +317,27 @@ public class AppEngInternalInventory implements IInventory, Iterable<ItemStack>
{
for( int x = 0; x < this.size; x++ )
{
this.setInventorySlotContents( x,null );
this.setInventorySlotContents( x, null );
}
}
private boolean isEnableClientEvents()
{
return this.enableClientEvents;
}
public void setEnableClientEvents( final boolean enableClientEvents )
{
this.enableClientEvents = enableClientEvents;
}
private IAEAppEngInventory getTileEntity()
{
return this.te;
}
public void setTileEntity( final IAEAppEngInventory te )
{
this.te = te;
}
}
@@ -46,18 +46,18 @@ import appeng.util.IConfigManagerHost;
public class TileCellWorkbench extends AEBaseTile implements IUpgradeableHost, IAEAppEngInventory, IConfigManagerHost
{
final AppEngInternalInventory cell = new AppEngInternalInventory( this, 1 );
final AppEngInternalAEInventory config = new AppEngInternalAEInventory( this, 63 );
final ConfigManager manager = new ConfigManager( this );
private final AppEngInternalInventory cell = new AppEngInternalInventory( this, 1 );
private final AppEngInternalAEInventory config = new AppEngInternalAEInventory( this, 63 );
private final ConfigManager manager = new ConfigManager( this );
IInventory cacheUpgrades = null;
IInventory cacheConfig = null;
private IInventory cacheUpgrades = null;
private IInventory cacheConfig = null;
private boolean locked = false;
public TileCellWorkbench()
{
this.manager.registerSetting( Settings.COPY_MODE, CopyMode.CLEAR_ON_REMOVE );
this.cell.enableClientEvents = true;
this.cell.setEnableClientEvents( true );
}
public IInventory getCellUpgradeInventory()
+21 -21
View File
@@ -56,19 +56,19 @@ import appeng.util.item.AEItemStack;
public class TileCharger extends AENetworkPowerTile implements ICrankable, IUpdatePlayerListBox
{
final int[] sides = { 0 };
final AppEngInternalInventory inv = new AppEngInternalInventory( this, 1 );
int tickTickTimer = 0;
private final int[] sides = { 0 };
private final AppEngInternalInventory inv = new AppEngInternalInventory( this, 1 );
private int tickTickTimer = 0;
int lastUpdate = 0;
boolean requiresUpdate = false;
private int lastUpdate = 0;
private boolean requiresUpdate = false;
public TileCharger()
{
this.gridProxy.setValidSides( EnumSet.noneOf( EnumFacing.class ) );
this.gridProxy.setFlags();
this.internalMaxPower = 1500;
this.gridProxy.setIdlePowerUsage( 0 );
this.getProxy().setValidSides( EnumSet.noneOf( EnumFacing.class ) );
this.getProxy().setFlags();
this.setInternalMaxPower( 1500 );
this.getProxy().setIdlePowerUsage( 0 );
}
@Override
@@ -124,11 +124,11 @@ public class TileCharger extends AENetworkPowerTile implements ICrankable, IUpda
final ItemStack myItem = this.getStackInSlot( 0 );
// charge from the network!
if( this.internalCurrentPower < 1499 )
if( this.getInternalCurrentPower() < 1499 )
{
try
{
this.injectExternalPower( PowerUnits.AE, this.gridProxy.getEnergy().extractAEPower( Math.min( 150.0, 1500.0 - this.internalCurrentPower ), Actionable.MODULATE, PowerMultiplier.ONE ) );
this.injectExternalPower( PowerUnits.AE, this.getProxy().getEnergy().extractAEPower( Math.min( 150.0, 1500.0 - this.getInternalCurrentPower() ), Actionable.MODULATE, PowerMultiplier.ONE ) );
this.tickTickTimer = 20; // keep ticking...
}
catch( final GridAccessException e )
@@ -144,27 +144,27 @@ public class TileCharger extends AENetworkPowerTile implements ICrankable, IUpda
final IMaterials materials = AEApi.instance().definitions().materials();
if( this.internalCurrentPower > 149 && Platform.isChargeable( myItem ) )
if( this.getInternalCurrentPower() > 149 && Platform.isChargeable( myItem ) )
{
final IAEItemPowerStorage ps = (IAEItemPowerStorage) myItem.getItem();
if( ps.getAEMaxPower( myItem ) > ps.getAECurrentPower( myItem ) )
{
final double oldPower = this.internalCurrentPower;
final double oldPower = this.getInternalCurrentPower();
final double adjustment = ps.injectAEPower( myItem, this.extractAEPower( 150.0, Actionable.MODULATE, PowerMultiplier.CONFIG ) );
this.internalCurrentPower += adjustment;
if( oldPower > this.internalCurrentPower )
this.setInternalCurrentPower( this.getInternalCurrentPower() + adjustment );
if( oldPower > this.getInternalCurrentPower() )
{
this.requiresUpdate = true;
}
this.tickTickTimer = 20; // keep ticking...
}
}
else if( this.internalCurrentPower > 1499 && materials.certusQuartzCrystal().isSameAs( myItem ) )
else if( this.getInternalCurrentPower() > 1499 && materials.certusQuartzCrystal().isSameAs( myItem ) )
{
if( Platform.getRandomFloat() > 0.8f ) // simulate wait
{
this.extractAEPower( this.internalMaxPower, Actionable.MODULATE, PowerMultiplier.CONFIG );// 1500
this.extractAEPower( this.getInternalMaxPower(), Actionable.MODULATE, PowerMultiplier.CONFIG );// 1500
for( final ItemStack charged : materials.certusQuartzCrystalCharged().maybeStack( myItem.stackSize ).asSet() )
{
@@ -178,7 +178,7 @@ public class TileCharger extends AENetworkPowerTile implements ICrankable, IUpda
public void setOrientation( final EnumFacing inForward, final EnumFacing inUp )
{
super.setOrientation( inForward, inUp );
this.gridProxy.setValidSides( EnumSet.of( this.getUp(), this.getUp().getOpposite() ) );
this.getProxy().setValidSides( EnumSet.of( this.getUp(), this.getUp().getOpposite() ) );
this.setPowerSides( EnumSet.of( this.getUp(), this.getUp().getOpposite() ) );
}
@@ -191,7 +191,7 @@ public class TileCharger extends AENetworkPowerTile implements ICrankable, IUpda
@Override
public boolean canTurn()
{
return this.internalCurrentPower < this.internalMaxPower;
return this.getInternalCurrentPower() < this.getInternalMaxPower();
}
@Override
@@ -200,13 +200,13 @@ public class TileCharger extends AENetworkPowerTile implements ICrankable, IUpda
this.injectExternalPower( PowerUnits.AE, 150 );
final ItemStack myItem = this.getStackInSlot( 0 );
if( this.internalCurrentPower > 1499 )
if( this.getInternalCurrentPower() > 1499 )
{
final IMaterials materials = AEApi.instance().definitions().materials();
if( materials.certusQuartzCrystal().isSameAs( myItem ) )
{
this.extractAEPower( this.internalMaxPower, Actionable.MODULATE, PowerMultiplier.CONFIG );// 1500
this.extractAEPower( this.getInternalMaxPower(), Actionable.MODULATE, PowerMultiplier.CONFIG );// 1500
for( final ItemStack charged : materials.certusQuartzCrystalCharged().maybeStack( myItem.stackSize ).asSet() )
{
@@ -48,11 +48,11 @@ public class TileCondenser extends AEBaseInvTile implements IFluidHandler, IConf
{
private static final FluidTankInfo[] EMPTY = { new FluidTankInfo( null, 10 ) };
final int[] sides = { 0, 1 };
final AppEngInternalInventory inv = new AppEngInternalInventory( this, 3 );
final ConfigManager cm = new ConfigManager( this );
private final int[] sides = { 0, 1 };
private final AppEngInternalInventory inv = new AppEngInternalInventory( this, 3 );
private final ConfigManager cm = new ConfigManager( this );
public double storedPower = 0;
private double storedPower = 0;
public TileCondenser()
{
@@ -63,14 +63,14 @@ public class TileCondenser extends AEBaseInvTile implements IFluidHandler, IConf
public void writeToNBT_TileCondenser( final NBTTagCompound data )
{
this.cm.writeToNBT( data );
data.setDouble( "storedPower", this.storedPower );
data.setDouble( "storedPower", this.getStoredPower() );
}
@TileEvent( TileEventType.WORLD_NBT_READ )
public void readFromNBT_TileCondenser( final NBTTagCompound data )
{
this.cm.readFromNBT( data );
this.storedPower = data.getDouble( "storedPower" );
this.setStoredPower( data.getDouble( "storedPower" ) );
}
public double getStorage()
@@ -92,16 +92,16 @@ public class TileCondenser extends AEBaseInvTile implements IFluidHandler, IConf
public void addPower( final double rawPower )
{
this.storedPower += rawPower;
this.storedPower = Math.max( 0.0, Math.min( this.getStorage(), this.storedPower ) );
this.setStoredPower( this.getStoredPower() + rawPower );
this.setStoredPower( Math.max( 0.0, Math.min( this.getStorage(), this.getStoredPower() ) ) );
final double requiredPower = this.getRequiredPower();
final ItemStack output = this.getOutput();
while( requiredPower <= this.storedPower && output != null && requiredPower > 0 )
while( requiredPower <= this.getStoredPower() && output != null && requiredPower > 0 )
{
if( this.canAddOutput( output ) )
{
this.storedPower -= requiredPower;
this.setStoredPower( this.getStoredPower() - requiredPower );
this.addOutput( output );
}
else
@@ -277,4 +277,14 @@ public class TileCondenser extends AEBaseInvTile implements IFluidHandler, IConf
{
return this.cm;
}
public double getStoredPower()
{
return this.storedPower;
}
private void setStoredPower( final double storedPower )
{
this.storedPower = storedPower;
}
}
@@ -81,32 +81,32 @@ import com.google.common.collect.Lists;
public class TileInscriber extends AENetworkPowerTile implements IGridTickable, IUpgradeableHost, IConfigManagerHost
{
public final int maxProcessingTime = 100;
final int[] top = { 0 };
final int[] bottom = { 1 };
final int[] sides = { 2, 3 };
final AppEngInternalInventory inv = new AppEngInternalInventory( this, 4 );
private final int maxProcessingTime = 100;
private final int[] top = { 0 };
private final int[] bottom = { 1 };
private final int[] sides = { 2, 3 };
private final AppEngInternalInventory inv = new AppEngInternalInventory( this, 4 );
private final IConfigManager settings;
private final UpgradeInventory upgrades;
public int processingTime = 0;
private int processingTime = 0;
// cycles from 0 - 16, at 8 it preforms the action, at 16 it re-enables the normal routine.
public boolean smash;
public int finalStep;
public long clientStart;
private boolean smash;
private int finalStep;
private long clientStart;
@Reflected
public TileInscriber()
{
this.gridProxy.setValidSides( EnumSet.noneOf( EnumFacing.class ) );
this.internalMaxPower = 1500;
this.gridProxy.setIdlePowerUsage( 0 );
this.getProxy().setValidSides( EnumSet.noneOf( EnumFacing.class ) );
this.setInternalMaxPower( 1500 );
this.getProxy().setIdlePowerUsage( 0 );
this.settings = new ConfigManager( this );
final ITileDefinition inscriberDefinition = AEApi.instance().definitions().blocks().inscriber();
this.upgrades = new DefinitionUpgradeInventory( inscriberDefinition, this, this.getUpgradeSlots() );
}
protected int getUpgradeSlots()
private int getUpgradeSlots()
{
return 3;
}
@@ -138,13 +138,13 @@ public class TileInscriber extends AENetworkPowerTile implements IGridTickable,
{
final int slot = data.readByte();
final boolean oldSmash = this.smash;
final boolean oldSmash = this.isSmash();
final boolean newSmash = ( slot & 64 ) == 64;
if( oldSmash != newSmash && newSmash )
{
this.smash = true;
this.clientStart = System.currentTimeMillis();
this.setSmash( true );
this.setClientStart( System.currentTimeMillis() );
}
for( int num = 0; num < this.inv.getSizeInventory(); num++ )
@@ -165,7 +165,7 @@ public class TileInscriber extends AENetworkPowerTile implements IGridTickable,
@TileEvent( TileEventType.NETWORK_WRITE )
public void writeToStream_TileInscriber( final ByteBuf data ) throws IOException
{
int slot = this.smash ? 64 : 0;
int slot = this.isSmash() ? 64 : 0;
for( int num = 0; num < this.inv.getSizeInventory(); num++ )
{
@@ -190,7 +190,7 @@ public class TileInscriber extends AENetworkPowerTile implements IGridTickable,
public void setOrientation( final EnumFacing inForward, final EnumFacing inUp )
{
super.setOrientation( inForward, inUp );
this.gridProxy.setValidSides( EnumSet.complementOf( EnumSet.of( this.getForward() ) ) );
this.getProxy().setValidSides( EnumSet.complementOf( EnumSet.of( this.getForward() ) ) );
this.setPowerSides( EnumSet.complementOf( EnumSet.of( this.getForward() ) ) );
}
@@ -233,7 +233,7 @@ public class TileInscriber extends AENetworkPowerTile implements IGridTickable,
@Override
public boolean isItemValidForSlot( final int i, final ItemStack itemstack )
{
if( this.smash )
if( this.isSmash() )
{
return false;
}
@@ -266,15 +266,15 @@ public class TileInscriber extends AENetworkPowerTile implements IGridTickable,
{
if( slot != 3 )
{
this.processingTime = 0;
this.setProcessingTime( 0 );
}
if( !this.smash )
if( !this.isSmash() )
{
this.markForUpdate();
}
this.gridProxy.getTick().wakeDevice( this.gridProxy.getNode() );
this.getProxy().getTick().wakeDevice( this.getProxy().getNode() );
}
}
catch( final GridAccessException e )
@@ -286,7 +286,7 @@ public class TileInscriber extends AENetworkPowerTile implements IGridTickable,
@Override
public boolean canExtractItem( final int slotIndex, final ItemStack extractedItem, final EnumFacing side )
{
if( this.smash )
if( this.isSmash() )
{
return false;
}
@@ -313,7 +313,7 @@ public class TileInscriber extends AENetworkPowerTile implements IGridTickable,
@Override
public TickingRequest getTickingRequest( final IGridNode node )
{
return new TickingRequest( TickRates.Inscriber.min, TickRates.Inscriber.max, !this.hasWork(), false );
return new TickingRequest( TickRates.Inscriber.getMin(), TickRates.Inscriber.getMax(), !this.hasWork(), false );
}
private boolean hasWork()
@@ -323,8 +323,8 @@ public class TileInscriber extends AENetworkPowerTile implements IGridTickable,
return true;
}
this.processingTime = 0;
return this.smash;
this.setProcessingTime( 0 );
return this.isSmash();
}
@Nullable
@@ -402,10 +402,10 @@ public class TileInscriber extends AENetworkPowerTile implements IGridTickable,
{
final boolean matchA = ( plateA == null && !recipe.getTopOptional().isPresent() ) || ( Platform.isSameItemPrecise( plateA, recipe.getTopOptional().orNull() ) ) && // and...
( plateB == null && !recipe.getBottomOptional().isPresent() ) | ( Platform.isSameItemPrecise( plateB, recipe.getBottomOptional().orNull() ) );
( plateB == null && !recipe.getBottomOptional().isPresent() ) | ( Platform.isSameItemPrecise( plateB, recipe.getBottomOptional().orNull() ) );
final boolean matchB = ( plateB == null && !recipe.getTopOptional().isPresent() ) || ( Platform.isSameItemPrecise( plateB, recipe.getTopOptional().orNull() ) ) && // and...
( plateA == null && !recipe.getBottomOptional().isPresent() ) | ( Platform.isSameItemPrecise( plateA, recipe.getBottomOptional().orNull() ) );
( plateA == null && !recipe.getBottomOptional().isPresent() ) | ( Platform.isSameItemPrecise( plateA, recipe.getBottomOptional().orNull() ) );
if( matchA || matchB )
{
@@ -424,7 +424,7 @@ public class TileInscriber extends AENetworkPowerTile implements IGridTickable,
@Override
public TickRateModulation tickingRequest( final IGridNode node, final int ticksSinceLastCall )
{
if( this.smash )
if( this.isSmash() )
{
this.finalStep++;
if( this.finalStep == 8 )
@@ -437,7 +437,7 @@ public class TileInscriber extends AENetworkPowerTile implements IGridTickable,
if( ad.addItems( outputCopy ) == null )
{
this.processingTime = 0;
this.setProcessingTime( 0 );
if( out.getProcessType() == InscriberProcessType.Press )
{
this.setInventorySlotContents( 0, null );
@@ -452,7 +452,7 @@ public class TileInscriber extends AENetworkPowerTile implements IGridTickable,
else if( this.finalStep == 16 )
{
this.finalStep = 0;
this.smash = false;
this.setSmash( false );
this.markForUpdate();
}
}
@@ -460,7 +460,7 @@ public class TileInscriber extends AENetworkPowerTile implements IGridTickable,
{
try
{
final IEnergyGrid eg = this.gridProxy.getEnergy();
final IEnergyGrid eg = this.getProxy().getEnergy();
IEnergySource src = this;
// Base 1, increase by 1 for each card
@@ -479,13 +479,13 @@ public class TileInscriber extends AENetworkPowerTile implements IGridTickable,
{
src.extractAEPower( powerConsumption, Actionable.MODULATE, PowerMultiplier.CONFIG );
if( this.processingTime == 0 )
if( this.getProcessingTime() == 0 )
{
this.processingTime += speedFactor;
this.setProcessingTime( this.getProcessingTime() + speedFactor );
}
else
{
this.processingTime += ticksSinceLastCall * speedFactor;
this.setProcessingTime( this.getProcessingTime() + ticksSinceLastCall * speedFactor );
}
}
}
@@ -494,9 +494,9 @@ public class TileInscriber extends AENetworkPowerTile implements IGridTickable,
// :P
}
if( this.processingTime > this.maxProcessingTime )
if( this.getProcessingTime() > this.getMaxProcessingTime() )
{
this.processingTime = this.maxProcessingTime;
this.setProcessingTime( this.getMaxProcessingTime() );
final IInscriberRecipe out = this.getTask();
if( out != null )
{
@@ -504,7 +504,7 @@ public class TileInscriber extends AENetworkPowerTile implements IGridTickable,
final InventoryAdaptor ad = InventoryAdaptor.getAdaptor( new WrapperInventoryRange( this.inv, 3, 1, true ), EnumFacing.UP );
if( ad.simulateAdd( outputCopy ) == null )
{
this.smash = true;
this.setSmash( true );
this.finalStep = 0;
this.markForUpdate();
}
@@ -547,4 +547,39 @@ public class TileInscriber extends AENetworkPowerTile implements IGridTickable,
public void updateSetting( final IConfigManager manager, final Enum settingName, final Enum newValue )
{
}
public long getClientStart()
{
return this.clientStart;
}
private void setClientStart( final long clientStart )
{
this.clientStart = clientStart;
}
public boolean isSmash()
{
return this.smash;
}
public void setSmash( final boolean smash )
{
this.smash = smash;
}
public int getMaxProcessingTime()
{
return this.maxProcessingTime;
}
public int getProcessingTime()
{
return this.processingTime;
}
private void setProcessingTime( final int processingTime )
{
this.processingTime = processingTime;
}
}
@@ -68,8 +68,8 @@ import com.google.common.collect.ImmutableSet;
public class TileInterface extends AENetworkInvTile implements IGridTickable, ITileStorageMonitorable, IStorageMonitorable, IInventoryDestination, IInterfaceHost, IPriorityHost
{
final DualityInterface duality = new DualityInterface( this.gridProxy, this );
AEPartLocation pointAt = AEPartLocation.INTERNAL;
private final DualityInterface duality = new DualityInterface( this.getProxy(), this );
private AEPartLocation pointAt = AEPartLocation.INTERNAL;
@MENetworkEventSubscribe
public void stateChange( final MENetworkChannelsChanged c )
@@ -123,10 +123,10 @@ public class TileInterface extends AENetworkInvTile implements IGridTickable, IT
private void configureNodeSides()
{
if ( this.pointAt == AEPartLocation.INTERNAL )
this.gridProxy.setValidSides( EnumSet.allOf(EnumFacing.class) );
if( this.pointAt == AEPartLocation.INTERNAL )
this.getProxy().setValidSides( EnumSet.allOf( EnumFacing.class ) );
else
this.gridProxy.setValidSides( EnumSet.complementOf( EnumSet.of( this.pointAt.getFacing() ) ) );
this.getProxy().setValidSides( EnumSet.complementOf( EnumSet.of( this.pointAt.getFacing() ) ) );
}
@Override
@@ -154,6 +154,7 @@ public class TileInterface extends AENetworkInvTile implements IGridTickable, IT
public void onReady()
{
this.configureNodeSides();
super.onReady();
this.duality.initialize();
}
@@ -29,8 +29,8 @@ import appeng.util.Platform;
public class TileLightDetector extends AEBaseTile implements IUpdatePlayerListBox
{
int lastCheck = 30;
int lastLight = 0;
private int lastCheck = 30;
private int lastLight = 0;
public boolean isReady()
{
@@ -47,10 +47,10 @@ import com.google.common.collect.ImmutableList;
public class TilePaint extends AEBaseTile
{
static final int LIGHT_PER_DOT = 12;
private static final int LIGHT_PER_DOT = 12;
int isLit = 0;
List<Splotch> dots = null;
private int isLit = 0;
private List<Splotch> dots = null;
@Override
public boolean canBeRotated()
@@ -69,7 +69,7 @@ public class TilePaint extends AEBaseTile
}
}
void writeBuffer( final ByteBuf out )
private void writeBuffer( final ByteBuf out )
{
if( this.dots == null )
{
@@ -94,7 +94,7 @@ public class TilePaint extends AEBaseTile
}
}
void readBuffer( final ByteBuf in )
private void readBuffer( final ByteBuf in )
{
final byte howMany = in.readByte();
@@ -114,7 +114,7 @@ public class TilePaint extends AEBaseTile
this.isLit = 0;
for( final Splotch s : this.dots )
{
if( s.lumen )
if( s.isLumen() )
{
this.isLit += LIGHT_PER_DOT;
}
@@ -180,7 +180,7 @@ public class TilePaint extends AEBaseTile
while( i.hasNext() )
{
final Splotch s = i.next();
if( s.side == side )
if( s.getSide() == side )
{
i.remove();
}
@@ -195,7 +195,7 @@ public class TilePaint extends AEBaseTile
this.isLit = 0;
for( final Splotch s : this.dots )
{
if( s.lumen )
if( s.isLumen() )
{
this.isLit += LIGHT_PER_DOT;
}
@@ -40,13 +40,13 @@ import appeng.util.Platform;
public class TileQuartzGrowthAccelerator extends AENetworkTile implements IPowerChannelState, ICrystalGrowthAccelerator
{
public boolean hasPower = false;
private boolean hasPower = false;
public TileQuartzGrowthAccelerator()
{
this.gridProxy.setValidSides( EnumSet.noneOf( EnumFacing.class ) );
this.gridProxy.setFlags();
this.gridProxy.setIdlePowerUsage( 8 );
this.getProxy().setValidSides( EnumSet.noneOf( EnumFacing.class ) );
this.getProxy().setFlags();
this.getProxy().setIdlePowerUsage( 8 );
}
@MENetworkEventSubscribe
@@ -64,9 +64,9 @@ public class TileQuartzGrowthAccelerator extends AENetworkTile implements IPower
@TileEvent( TileEventType.NETWORK_READ )
public boolean readFromStream_TileQuartzGrowthAccelerator( final ByteBuf data )
{
final boolean hadPower = this.hasPower;
this.hasPower = data.readBoolean();
return this.hasPower != hadPower;
final boolean hadPower = this.isPowered();
this.setPowered( data.readBoolean() );
return this.isPowered() != hadPower;
}
@TileEvent( TileEventType.NETWORK_WRITE )
@@ -74,7 +74,7 @@ public class TileQuartzGrowthAccelerator extends AENetworkTile implements IPower
{
try
{
data.writeBoolean( this.gridProxy.getEnergy().isNetworkPowered() );
data.writeBoolean( this.getProxy().getEnergy().isNetworkPowered() );
}
catch( final GridAccessException e )
{
@@ -86,7 +86,7 @@ public class TileQuartzGrowthAccelerator extends AENetworkTile implements IPower
public void setOrientation( final EnumFacing inForward, final EnumFacing inUp )
{
super.setOrientation( inForward, inUp );
this.gridProxy.setValidSides( EnumSet.of( this.getUp(), this.getUp().getOpposite() ) );
this.getProxy().setValidSides( EnumSet.of( this.getUp(), this.getUp().getOpposite() ) );
}
@Override
@@ -96,7 +96,7 @@ public class TileQuartzGrowthAccelerator extends AENetworkTile implements IPower
{
try
{
return this.gridProxy.getEnergy().isNetworkPowered();
return this.getProxy().getEnergy().isNetworkPowered();
}
catch( final GridAccessException e )
{
@@ -112,4 +112,9 @@ public class TileQuartzGrowthAccelerator extends AENetworkTile implements IPower
{
return this.isPowered();
}
private void setPowered( final boolean hasPower )
{
this.hasPower = hasPower;
}
}
@@ -83,18 +83,18 @@ public class TileSecurity extends AENetworkTile implements ITerminalHost, IAEApp
{
private static int difference = 0;
public final AppEngInternalInventory configSlot = new AppEngInternalInventory( this, 1 );
private final AppEngInternalInventory configSlot = new AppEngInternalInventory( this, 1 );
private final IConfigManager cm = new ConfigManager( this );
private final SecurityInventory inventory = new SecurityInventory( this );
private final MEMonitorHandler<IAEItemStack> securityMonitor = new MEMonitorHandler<IAEItemStack>( this.inventory );
public long securityKey;
AEColor paintedColor = AEColor.Transparent;
private long securityKey;
private AEColor paintedColor = AEColor.Transparent;
private boolean isActive = false;
public TileSecurity()
{
this.gridProxy.setFlags( GridFlags.REQUIRE_CHANNEL );
this.gridProxy.setIdlePowerUsage( 2.0 );
this.getProxy().setFlags( GridFlags.REQUIRE_CHANNEL );
this.getProxy().setIdlePowerUsage( 2.0 );
difference++;
this.securityKey = System.currentTimeMillis() * 10 + difference;
@@ -120,12 +120,12 @@ public class TileSecurity extends AENetworkTile implements ITerminalHost, IAEApp
final BlockPos pos,
final List<ItemStack> drops )
{
if( !this.configSlot.isEmpty() )
if( !this.getConfigSlot().isEmpty() )
{
drops.add( this.configSlot.getStackInSlot( 0 ) );
drops.add( this.getConfigSlot().getStackInSlot( 0 ) );
}
for( final IAEItemStack ais : this.inventory.storedItems )
for( final IAEItemStack ais : this.inventory.getStoredItems() )
{
drops.add( ais.getItemStack() );
}
@@ -151,7 +151,7 @@ public class TileSecurity extends AENetworkTile implements ITerminalHost, IAEApp
@TileEvent( TileEventType.NETWORK_WRITE )
public void writeToStream_TileSecurity( final ByteBuf data )
{
data.writeBoolean( this.gridProxy.isActive() );
data.writeBoolean( this.getProxy().isActive() );
data.writeByte( this.paintedColor.ordinal() );
}
@@ -162,12 +162,12 @@ public class TileSecurity extends AENetworkTile implements ITerminalHost, IAEApp
data.setByte( "paintedColor", (byte) this.paintedColor.ordinal() );
data.setLong( "securityKey", this.securityKey );
this.configSlot.writeToNBT( data, "config" );
this.getConfigSlot().writeToNBT( data, "config" );
final NBTTagCompound storedItems = new NBTTagCompound();
int offset = 0;
for( final IAEItemStack ais : this.inventory.storedItems )
for( final IAEItemStack ais : this.inventory.getStoredItems() )
{
final NBTTagCompound it = new NBTTagCompound();
ais.getItemStack().writeToNBT( it );
@@ -188,7 +188,7 @@ public class TileSecurity extends AENetworkTile implements ITerminalHost, IAEApp
}
this.securityKey = data.getLong( "securityKey" );
this.configSlot.readFromNBT( data, "config" );
this.getConfigSlot().readFromNBT( data, "config" );
final NBTTagCompound storedItems = data.getCompoundTag( "storedItems" );
for( final Object key : storedItems.getKeySet() )
@@ -196,7 +196,7 @@ public class TileSecurity extends AENetworkTile implements ITerminalHost, IAEApp
final NBTBase obj = storedItems.getTag( (String) key );
if( obj instanceof NBTTagCompound )
{
this.inventory.storedItems.add( AEItemStack.create( ItemStack.loadItemStackFromNBT( (NBTTagCompound) obj ) ) );
this.inventory.getStoredItems().add( AEItemStack.create( ItemStack.loadItemStackFromNBT( (NBTTagCompound) obj ) ) );
}
}
}
@@ -206,7 +206,7 @@ public class TileSecurity extends AENetworkTile implements ITerminalHost, IAEApp
try
{
this.saveChanges();
this.gridProxy.getGrid().postEvent( new MENetworkSecurityChange() );
this.getProxy().getGrid().postEvent( new MENetworkSecurityChange() );
}
catch( final GridAccessException e )
{
@@ -290,7 +290,7 @@ public class TileSecurity extends AENetworkTile implements ITerminalHost, IAEApp
public boolean isPowered()
{
return this.gridProxy.isActive();
return this.getProxy().isActive();
}
@Override
@@ -317,7 +317,7 @@ public class TileSecurity extends AENetworkTile implements ITerminalHost, IAEApp
final IPlayerRegistry pr = AEApi.instance().registries().players();
// read permissions
for( final IAEItemStack ais : this.inventory.storedItems )
for( final IAEItemStack ais : this.inventory.getStoredItems() )
{
final ItemStack is = ais.getItemStack();
final Item i = is.getItem();
@@ -329,19 +329,19 @@ public class TileSecurity extends AENetworkTile implements ITerminalHost, IAEApp
}
// make sure thea admin is Boss.
playerPerms.put( this.gridProxy.getNode().getPlayerID(), EnumSet.allOf( SecurityPermissions.class ) );
playerPerms.put( this.getProxy().getNode().getPlayerID(), EnumSet.allOf( SecurityPermissions.class ) );
}
@Override
public boolean isSecurityEnabled()
{
return this.isActive && this.gridProxy.isActive();
return this.isActive && this.getProxy().isActive();
}
@Override
public int getOwner()
{
return this.gridProxy.getNode().getPlayerID();
return this.getProxy().getNode().getPlayerID();
}
@Override
@@ -363,4 +363,9 @@ public class TileSecurity extends AENetworkTile implements ITerminalHost, IAEApp
this.markForUpdate();
return true;
}
public AppEngInternalInventory getConfigSlot()
{
return this.configSlot;
}
}
@@ -57,17 +57,17 @@ public class TileVibrationChamber extends AENetworkInvTile implements IGridTicka
private static final int MIN_BURN_SPEED = 20;
private final IInventory inv = new AppEngInternalInventory( this, 1 );
public int burnSpeed = 100;
public double burnTime = 0;
public double maxBurnTime = 0;
private int burnSpeed = 100;
private double burnTime = 0;
private double maxBurnTime = 0;
// client side..
public boolean isOn;
public TileVibrationChamber()
{
this.gridProxy.setIdlePowerUsage( 0 );
this.gridProxy.setFlags();
this.getProxy().setIdlePowerUsage( 0 );
this.getProxy().setFlags();
}
@Override
@@ -91,23 +91,23 @@ public class TileVibrationChamber extends AENetworkInvTile implements IGridTicka
@TileEvent( TileEventType.NETWORK_WRITE )
public void writeToNetwork( final ByteBuf data )
{
data.writeBoolean( this.burnTime > 0 );
data.writeBoolean( this.getBurnTime() > 0 );
}
@TileEvent( TileEventType.WORLD_NBT_WRITE )
public void writeToNBT_TileVibrationChamber( final NBTTagCompound data )
{
data.setDouble( "burnTime", this.burnTime );
data.setDouble( "maxBurnTime", this.maxBurnTime );
data.setInteger( "burnSpeed", this.burnSpeed );
data.setDouble( "burnTime", this.getBurnTime() );
data.setDouble( "maxBurnTime", this.getMaxBurnTime() );
data.setInteger( "burnSpeed", this.getBurnSpeed() );
}
@TileEvent( TileEventType.WORLD_NBT_READ )
public void readFromNBT_TileVibrationChamber( final NBTTagCompound data )
{
this.burnTime = data.getDouble( "burnTime" );
this.maxBurnTime = data.getDouble( "maxBurnTime" );
this.burnSpeed = data.getInteger( "burnSpeed" );
this.setBurnTime( data.getDouble( "burnTime" ) );
this.setMaxBurnTime( data.getDouble( "maxBurnTime" ) );
this.setBurnSpeed( data.getInteger( "burnSpeed" ) );
}
@Override
@@ -125,13 +125,13 @@ public class TileVibrationChamber extends AENetworkInvTile implements IGridTicka
@Override
public void onChangeInventory( final IInventory inv, final int slot, final InvOperation mc, final ItemStack removed, final ItemStack added )
{
if( this.burnTime <= 0 )
if( this.getBurnTime() <= 0 )
{
if( this.canEatFuel() )
{
try
{
this.gridProxy.getTick().wakeDevice( this.gridProxy.getNode() );
this.getProxy().getTick().wakeDevice( this.getProxy().getNode() );
}
catch( final GridAccessException e )
{
@@ -176,44 +176,44 @@ public class TileVibrationChamber extends AENetworkInvTile implements IGridTicka
@Override
public TickingRequest getTickingRequest( final IGridNode node )
{
if( this.burnTime <= 0 )
if( this.getBurnTime() <= 0 )
{
this.eatFuel();
}
return new TickingRequest( TickRates.VibrationChamber.min, TickRates.VibrationChamber.max, this.burnTime <= 0, false );
return new TickingRequest( TickRates.VibrationChamber.getMin(), TickRates.VibrationChamber.getMax(), this.getBurnTime() <= 0, false );
}
@Override
public TickRateModulation tickingRequest( final IGridNode node, final int ticksSinceLastCall )
{
if( this.burnTime <= 0 )
if( this.getBurnTime() <= 0 )
{
this.eatFuel();
if( this.burnTime > 0 )
if( this.getBurnTime() > 0 )
{
return TickRateModulation.URGENT;
}
this.burnSpeed = 100;
this.setBurnSpeed( 100 );
return TickRateModulation.SLEEP;
}
this.burnSpeed = Math.max( MIN_BURN_SPEED, Math.min( this.burnSpeed, MAX_BURN_SPEED ) );
final double dilation = this.burnSpeed / DILATION_SCALING;
this.setBurnSpeed( Math.max( MIN_BURN_SPEED, Math.min( this.getBurnSpeed(), MAX_BURN_SPEED ) ) );
final double dilation = this.getBurnSpeed() / DILATION_SCALING;
double timePassed = ticksSinceLastCall * dilation;
this.burnTime -= timePassed;
if( this.burnTime < 0 )
this.setBurnTime( this.getBurnTime() - timePassed );
if( this.getBurnTime() < 0 )
{
timePassed += this.burnTime;
this.burnTime = 0;
timePassed += this.getBurnTime();
this.setBurnTime( 0 );
}
try
{
final IEnergyGrid grid = this.gridProxy.getEnergy();
final IEnergyGrid grid = this.getProxy().getEnergy();
final double newPower = timePassed * POWER_PER_TICK;
final double overFlow = grid.injectPower( newPower, Actionable.SIMULATE );
@@ -222,20 +222,20 @@ public class TileVibrationChamber extends AENetworkInvTile implements IGridTicka
if( overFlow > 0 )
{
this.burnSpeed -= ticksSinceLastCall;
this.setBurnSpeed( this.getBurnSpeed() - ticksSinceLastCall );
}
else
{
this.burnSpeed += ticksSinceLastCall;
this.setBurnSpeed( this.getBurnSpeed() + ticksSinceLastCall );
}
this.burnSpeed = Math.max( MIN_BURN_SPEED, Math.min( this.burnSpeed, MAX_BURN_SPEED ) );
this.setBurnSpeed( Math.max( MIN_BURN_SPEED, Math.min( this.getBurnSpeed(), MAX_BURN_SPEED ) ) );
return overFlow > 0 ? TickRateModulation.SLOWER : TickRateModulation.FASTER;
}
catch( final GridAccessException e )
{
this.burnSpeed -= ticksSinceLastCall;
this.burnSpeed = Math.max( MIN_BURN_SPEED, Math.min( this.burnSpeed, MAX_BURN_SPEED ) );
this.setBurnSpeed( this.getBurnSpeed() - ticksSinceLastCall );
this.setBurnSpeed( Math.max( MIN_BURN_SPEED, Math.min( this.getBurnSpeed(), MAX_BURN_SPEED ) ) );
return TickRateModulation.SLOWER;
}
}
@@ -248,8 +248,8 @@ public class TileVibrationChamber extends AENetworkInvTile implements IGridTicka
final int newBurnTime = TileEntityFurnace.getItemBurnTime( is );
if( newBurnTime > 0 && is.stackSize > 0 )
{
this.burnTime += newBurnTime;
this.maxBurnTime = this.burnTime;
this.setBurnTime( this.getBurnTime() + newBurnTime );
this.setMaxBurnTime( this.getBurnTime() );
is.stackSize--;
if( is.stackSize <= 0 )
{
@@ -271,11 +271,11 @@ public class TileVibrationChamber extends AENetworkInvTile implements IGridTicka
}
}
if( this.burnTime > 0 )
if( this.getBurnTime() > 0 )
{
try
{
this.gridProxy.getTick().wakeDevice( this.gridProxy.getNode() );
this.getProxy().getTick().wakeDevice( this.getProxy().getNode() );
}
catch( final GridAccessException e )
{
@@ -284,9 +284,9 @@ public class TileVibrationChamber extends AENetworkInvTile implements IGridTicka
}
// state change
if( ( !this.isOn && this.burnTime > 0 ) || ( this.isOn && this.burnTime <= 0 ) )
if( ( !this.isOn && this.getBurnTime() > 0 ) || ( this.isOn && this.getBurnTime() <= 0 ) )
{
this.isOn = this.burnTime > 0;
this.isOn = this.getBurnTime() > 0;
this.markForUpdate();
if ( this.hasWorldObj() )
@@ -295,4 +295,34 @@ public class TileVibrationChamber extends AENetworkInvTile implements IGridTicka
}
}
}
public int getBurnSpeed()
{
return this.burnSpeed;
}
private void setBurnSpeed( final int burnSpeed )
{
this.burnSpeed = burnSpeed;
}
public double getMaxBurnTime()
{
return this.maxBurnTime;
}
private void setMaxBurnTime( final double maxBurnTime )
{
this.maxBurnTime = maxBurnTime;
}
public double getBurnTime()
{
return this.burnTime;
}
private void setBurnTime( final double burnTime )
{
this.burnTime = burnTime;
}
}
@@ -60,32 +60,32 @@ import appeng.util.Platform;
public class TileCableBus extends AEBaseTile implements AEMultiTile, ICustomCollision
{
public CableBusContainer cb = new CableBusContainer( this );
private CableBusContainer cb = new CableBusContainer( this );
/**
* Immibis MB Support
*/
boolean ImmibisMicroblocks_TransformableTileEntityMarker = true;
private boolean ImmibisMicroblocks_TransformableTileEntityMarker = true;
private int oldLV = -1; // on re-calculate light when it changes
@TileEvent( TileEventType.WORLD_NBT_READ )
public void readFromNBT_TileCableBus( final NBTTagCompound data )
{
this.cb.readFromNBT( data );
this.getCableBus().readFromNBT( data );
}
@TileEvent( TileEventType.WORLD_NBT_WRITE )
public void writeToNBT_TileCableBus( final NBTTagCompound data )
{
this.cb.writeToNBT( data );
this.getCableBus().writeToNBT( data );
}
@TileEvent( TileEventType.NETWORK_READ )
public boolean readFromStream_TileCableBus( final ByteBuf data ) throws IOException
{
final boolean ret = this.cb.readFromStream( data );
final boolean ret = this.getCableBus().readFromStream( data );
final int newLV = this.cb.getLightValue();
final int newLV = this.getCableBus().getLightValue();
if( newLV != this.oldLV )
{
this.oldLV = newLV;
@@ -98,11 +98,11 @@ public class TileCableBus extends AEBaseTile implements AEMultiTile, ICustomColl
protected void updateTileSetting()
{
if( this.cb.requiresDynamicRender )
if( this.getCableBus().isRequiresDynamicRender() )
{
try
{
final TileCableBus tcb = (TileCableBus) BlockCableBus.tesrTile.newInstance();
final TileCableBus tcb = (TileCableBus) BlockCableBus.getTesrTile().newInstance();
tcb.copyFrom( this );
this.getWorld().setTileEntity( this.pos, tcb );
}
@@ -115,16 +115,16 @@ public class TileCableBus extends AEBaseTile implements AEMultiTile, ICustomColl
protected void copyFrom( final TileCableBus oldTile )
{
final CableBusContainer tmpCB = this.cb;
this.cb = oldTile.cb;
final CableBusContainer tmpCB = this.getCableBus();
this.setCableBus( oldTile.getCableBus() );
this.oldLV = oldTile.oldLV;
oldTile.cb = tmpCB;
oldTile.setCableBus( tmpCB );
}
@TileEvent( TileEventType.NETWORK_WRITE )
public void writeToStream_TileCableBus( final ByteBuf data ) throws IOException
{
this.cb.writeToStream( data );
this.getCableBus().writeToStream( data );
}
@Override
@@ -137,7 +137,7 @@ public class TileCableBus extends AEBaseTile implements AEMultiTile, ICustomColl
public void invalidate()
{
super.invalidate();
this.cb.removeFromWorld();
this.getCableBus().removeFromWorld();
}
@Override
@@ -150,20 +150,20 @@ public class TileCableBus extends AEBaseTile implements AEMultiTile, ICustomColl
@Override
public IGridNode getGridNode( final AEPartLocation dir )
{
return this.cb.getGridNode( dir );
return this.getCableBus().getGridNode( dir );
}
@Override
public AECableType getCableConnectionType( final AEPartLocation side )
{
return this.cb.getCableConnectionType( side );
return this.getCableBus().getCableConnectionType( side );
}
@Override
public void onChunkUnload()
{
super.onChunkUnload();
this.cb.removeFromWorld();
this.getCableBus().removeFromWorld();
}
@Override
@@ -174,7 +174,7 @@ public class TileCableBus extends AEBaseTile implements AEMultiTile, ICustomColl
return;
}
final int newLV = this.cb.getLightValue();
final int newLV = this.getCableBus().getLightValue();
if( newLV != this.oldLV )
{
this.oldLV = newLV;
@@ -194,20 +194,20 @@ public class TileCableBus extends AEBaseTile implements AEMultiTile, ICustomColl
@Override
public void getDrops( final World w, final BlockPos pos, final List drops )
{
this.cb.getDrops( drops );
this.getCableBus().getDrops( drops );
}
@Override
public void getNoDrops( final World w, final BlockPos pos, final List<ItemStack> drops )
{
this.cb.getNoDrops( drops );
this.getCableBus().getNoDrops( drops );
}
@Override
public void onReady()
{
super.onReady();
if( this.cb.isEmpty() )
if( this.getCableBus().isEmpty() )
{
if( this.worldObj.getTileEntity( this.pos ) == this )
{
@@ -216,32 +216,32 @@ public class TileCableBus extends AEBaseTile implements AEMultiTile, ICustomColl
}
else
{
this.cb.addToWorld();
this.getCableBus().addToWorld();
}
}
@Override
public boolean requiresTESR()
{
return this.cb.requiresDynamicRender;
return this.getCableBus().isRequiresDynamicRender();
}
@Override
public IFacadeContainer getFacadeContainer()
{
return this.cb.getFacadeContainer();
return this.getCableBus().getFacadeContainer();
}
@Override
public boolean canAddPart( final ItemStack is, final AEPartLocation side )
{
return this.cb.canAddPart( is, side );
return this.getCableBus().canAddPart( is, side );
}
@Override
public AEPartLocation addPart( final ItemStack is, final AEPartLocation side, final EntityPlayer player )
{
return this.cb.addPart( is, side, player );
return this.getCableBus().addPart( is, side, player );
}
@Override
@@ -253,13 +253,13 @@ public class TileCableBus extends AEBaseTile implements AEMultiTile, ICustomColl
@Override
public IPart getPart( final EnumFacing side )
{
return this.cb.getPart( side );
return this.getCableBus().getPart( side );
}
@Override
public void removePart( final AEPartLocation side, final boolean suppressUpdate )
{
this.cb.removePart( side, suppressUpdate );
this.getCableBus().removePart( side, suppressUpdate );
}
@Override
@@ -271,13 +271,13 @@ public class TileCableBus extends AEBaseTile implements AEMultiTile, ICustomColl
@Override
public AEColor getColor()
{
return this.cb.getColor();
return this.getCableBus().getColor();
}
@Override
public void clearContainer()
{
this.cb = new CableBusContainer( this );
this.setCableBus( new CableBusContainer( this ) );
}
@Override
@@ -285,17 +285,17 @@ public class TileCableBus extends AEBaseTile implements AEMultiTile, ICustomColl
{
return !this.ImmibisMicroblocks_isSideOpen( side );
}
@Override
public Iterable<AxisAlignedBB> getSelectedBoundingBoxesFromPool( final World w, final BlockPos pos, final Entity e, final boolean visual )
{
return this.cb.getSelectedBoundingBoxesFromPool( false, true, e, visual );
return this.getCableBus().getSelectedBoundingBoxesFromPool( false, true, e, visual );
}
@Override
public SelectedPart selectPart( final Vec3 pos )
{
return this.cb.selectPart( pos );
return this.getCableBus().selectPart( pos );
}
@Override
@@ -313,19 +313,19 @@ public class TileCableBus extends AEBaseTile implements AEMultiTile, ICustomColl
@Override
public boolean hasRedstone( final AEPartLocation side )
{
return this.cb.hasRedstone( side );
return this.getCableBus().hasRedstone( side );
}
@Override
public boolean isEmpty()
{
return this.cb.isEmpty();
return this.getCableBus().isEmpty();
}
@Override
public Set<LayerFlags> getLayerFlags()
{
return this.cb.getLayerFlags();
return this.getCableBus().getLayerFlags();
}
@Override
@@ -342,7 +342,7 @@ public class TileCableBus extends AEBaseTile implements AEMultiTile, ICustomColl
this.getWorld().setBlockToAir( this.pos );
}
@Override
public void addCollidingBlockToList(
final World w,
@@ -369,17 +369,17 @@ public class TileCableBus extends AEBaseTile implements AEMultiTile, ICustomColl
@Override
public boolean isInWorld()
{
return this.cb.isInWorld();
return this.getCableBus().isInWorld();
}
public boolean ImmibisMicroblocks_isSideOpen( final EnumFacing side )
private boolean ImmibisMicroblocks_isSideOpen( final EnumFacing side )
{
return true;
}
public void ImmibisMicroblocks_onMicroblocksChanged()
{
this.cb.updateConnections();
this.getCableBus().updateConnections();
}
@Override
@@ -388,10 +388,17 @@ public class TileCableBus extends AEBaseTile implements AEMultiTile, ICustomColl
final AEColor colour,
final EntityPlayer who )
{
return this.cb.recolourBlock( side, colour, who );
return this.getCableBus().recolourBlock( side, colour, who );
}
public CableBusContainer getCableBus()
{
return this.cb;
}
private void setCableBus( final CableBusContainer cb )
{
this.cb = cb;
}
}
@@ -28,11 +28,11 @@ public class TileCableBusTESR extends TileCableBus
@Override
protected void updateTileSetting()
{
if( !this.cb.requiresDynamicRender )
if( !this.getCableBus().isRequiresDynamicRender() )
{
try
{
final TileCableBus tcb = (TileCableBus) BlockCableBus.noTesrTile.newInstance();
final TileCableBus tcb = (TileCableBus) BlockCableBus.getNoTesrTile().newInstance();
tcb.copyFrom( this );
this.getWorld().setTileEntity( this.pos, tcb );
}
@@ -52,10 +52,10 @@ public class TileController extends AENetworkPowerTile
public TileController()
{
this.internalMaxPower = 8000;
this.internalPublicPowerStorage = true;
this.gridProxy.setIdlePowerUsage( 3 );
this.gridProxy.setFlags( GridFlags.CANNOT_CARRY, GridFlags.DENSE_CAPACITY );
this.setInternalMaxPower( 8000 );
this.setInternalPublicPowerStorage( true );
this.getProxy().setIdlePowerUsage( 3 );
this.getProxy().setFlags( GridFlags.CANNOT_CARRY, GridFlags.DENSE_CAPACITY );
}
@Override
@@ -89,11 +89,11 @@ public class TileController extends AENetworkPowerTile
{
if( this.isValid )
{
this.gridProxy.setValidSides( EnumSet.allOf( EnumFacing.class ) );
this.getProxy().setValidSides( EnumSet.allOf( EnumFacing.class ) );
}
else
{
this.gridProxy.setValidSides( EnumSet.noneOf( EnumFacing.class ) );
this.getProxy().setValidSides( EnumSet.noneOf( EnumFacing.class ) );
}
this.updateMeta();
@@ -103,20 +103,20 @@ public class TileController extends AENetworkPowerTile
private void updateMeta()
{
if( !this.gridProxy.isReady() )
if( !this.getProxy().isReady() )
{
return;
}
ControllerBlockState metaState = ControllerBlockState.OFFLINE;
try
{
if( this.gridProxy.getEnergy().isNetworkPowered() )
if( this.getProxy().getEnergy().isNetworkPowered() )
{
metaState = ControllerBlockState.ONLINE;
if( this.gridProxy.getPath().getControllerState() == ControllerState.CONTROLLER_CONFLICT )
if( this.getProxy().getPath().getControllerState() == ControllerState.CONTROLLER_CONFLICT )
{
metaState = ControllerBlockState.CONFLICTED;
}
@@ -126,12 +126,12 @@ public class TileController extends AENetworkPowerTile
{
metaState = ControllerBlockState.OFFLINE;
}
if( this.checkController( this.pos ) && this.worldObj.getBlockState( this.pos ).getValue( BlockController.CONTROLLER_STATE ) != metaState )
{
this.worldObj.setBlockState( this.pos, this.worldObj.getBlockState( this.pos ).withProperty( BlockController.CONTROLLER_STATE, metaState ) );
}
}
@Override
@@ -139,7 +139,7 @@ public class TileController extends AENetworkPowerTile
{
try
{
return this.gridProxy.getEnergy().getEnergyDemand( 8000 );
return this.getProxy().getEnergy().getEnergyDemand( 8000 );
}
catch( final GridAccessException e )
{
@@ -153,7 +153,7 @@ public class TileController extends AENetworkPowerTile
{
try
{
final double ret = this.gridProxy.getEnergy().injectPower( power, mode );
final double ret = this.getProxy().getEnergy().injectPower( power, mode );
if( mode == Actionable.SIMULATE )
{
return ret;
@@ -172,7 +172,7 @@ public class TileController extends AENetworkPowerTile
{
try
{
this.gridProxy.getGrid().postEvent( new MENetworkPowerStorage( this, x ) );
this.getProxy().getGrid().postEvent( new MENetworkPowerStorage( this, x ) );
}
catch( final GridAccessException e )
{
@@ -222,7 +222,7 @@ public class TileController extends AENetworkPowerTile
{
return this.worldObj.getTileEntity( pos ) instanceof TileController;
}
return false;
}
}
@@ -33,7 +33,7 @@ public class TileCreativeEnergyCell extends AENetworkTile implements IAEPowerSto
public TileCreativeEnergyCell()
{
this.gridProxy.setIdlePowerUsage( 0 );
this.getProxy().setIdlePowerUsage( 0 );
}
@Override
@@ -24,6 +24,6 @@ public class TileDenseEnergyCell extends TileEnergyCell
public TileDenseEnergyCell()
{
this.internalMaxPower = 200000 * 8;
this.setInternalMaxPower( 200000 * 8 );
}
}
@@ -36,13 +36,13 @@ import appeng.tile.inventory.InvOperation;
public class TileEnergyAcceptor extends AENetworkPowerTile
{
static final AppEngInternalInventory INTERNAL_INVENTORY = new AppEngInternalInventory( null, 0 );
final int[] sides = {};
private static final AppEngInternalInventory INTERNAL_INVENTORY = new AppEngInternalInventory( null, 0 );
private final int[] sides = {};
public TileEnergyAcceptor()
{
this.gridProxy.setIdlePowerUsage( 0.0 );
this.internalMaxPower = 0;
this.getProxy().setIdlePowerUsage( 0.0 );
this.setInternalMaxPower( 0 );
}
@Override
@@ -72,12 +72,12 @@ public class TileEnergyAcceptor extends AENetworkPowerTile
{
try
{
final IEnergyGrid grid = this.gridProxy.getEnergy();
final IEnergyGrid grid = this.getProxy().getEnergy();
return grid.getEnergyDemand( maxRequired );
}
catch( final GridAccessException e )
{
return this.internalMaxPower;
return this.getInternalMaxPower();
}
}
@@ -86,7 +86,7 @@ public class TileEnergyAcceptor extends AENetworkPowerTile
{
try
{
final IEnergyGrid grid = this.gridProxy.getEnergy();
final IEnergyGrid grid = this.getProxy().getEnergy();
final double leftOver = grid.injectPower( power, mode );
if( mode == Actionable.SIMULATE )
{
@@ -39,15 +39,14 @@ import appeng.util.SettingsFrom;
public class TileEnergyCell extends AENetworkTile implements IAEPowerStorage
{
protected double internalCurrentPower = 0.0;
protected double internalMaxPower = 200000.0;
private double internalCurrentPower = 0.0;
private double internalMaxPower = 200000.0;
private byte currentMeta = -1;
public TileEnergyCell()
{
this.gridProxy.setIdlePowerUsage( 0 );
this.getProxy().setIdlePowerUsage( 0 );
}
@Override
@@ -60,8 +59,8 @@ public class TileEnergyCell extends AENetworkTile implements IAEPowerStorage
public void onReady()
{
super.onReady();
final int value = ( Integer ) this.worldObj.getBlockState( this.pos ).getValue( BlockEnergyCell.ENERGY_STORAGE );
this.currentMeta = (byte)value;
final int value = (Integer) this.worldObj.getBlockState( this.pos ).getValue( BlockEnergyCell.ENERGY_STORAGE );
this.currentMeta = (byte) value;
this.changePowerLevel();
}
@@ -72,7 +71,7 @@ public class TileEnergyCell extends AENetworkTile implements IAEPowerStorage
return;
}
byte boundMetadata = (byte) ( 8.0 * ( this.internalCurrentPower / this.internalMaxPower ) );
byte boundMetadata = (byte) ( 8.0 * ( this.internalCurrentPower / this.getInternalMaxPower() ) );
if( boundMetadata > 7 )
{
@@ -86,7 +85,7 @@ public class TileEnergyCell extends AENetworkTile implements IAEPowerStorage
if( this.currentMeta != boundMetadata )
{
this.currentMeta = boundMetadata;
this.worldObj.setBlockState( this.pos, this.worldObj.getBlockState( this.pos ).withProperty( BlockEnergyCell.ENERGY_STORAGE, (int)boundMetadata ) );
this.worldObj.setBlockState( this.pos, this.worldObj.getBlockState( this.pos ).withProperty( BlockEnergyCell.ENERGY_STORAGE, (int) boundMetadata ) );
}
}
@@ -127,7 +126,7 @@ public class TileEnergyCell extends AENetworkTile implements IAEPowerStorage
{
final NBTTagCompound tag = new NBTTagCompound();
tag.setDouble( "internalCurrentPower", this.internalCurrentPower );
tag.setDouble( "internalMaxPower", this.internalMaxPower ); // used for tool tip.
tag.setDouble( "internalMaxPower", this.getInternalMaxPower() ); // used for tool tip.
return tag;
}
return null;
@@ -139,9 +138,9 @@ public class TileEnergyCell extends AENetworkTile implements IAEPowerStorage
if( mode == Actionable.SIMULATE )
{
final double fakeBattery = this.internalCurrentPower + amt;
if( fakeBattery > this.internalMaxPower )
if( fakeBattery > this.getInternalMaxPower() )
{
return fakeBattery - this.internalMaxPower;
return fakeBattery - this.getInternalMaxPower();
}
return 0;
@@ -149,14 +148,14 @@ public class TileEnergyCell extends AENetworkTile implements IAEPowerStorage
if( this.internalCurrentPower < 0.01 && amt > 0.01 )
{
this.gridProxy.getNode().getGrid().postEvent( new MENetworkPowerStorage( this, PowerEventType.PROVIDE_POWER ) );
this.getProxy().getNode().getGrid().postEvent( new MENetworkPowerStorage( this, PowerEventType.PROVIDE_POWER ) );
}
this.internalCurrentPower += amt;
if( this.internalCurrentPower > this.internalMaxPower )
if( this.internalCurrentPower > this.getInternalMaxPower() )
{
amt = this.internalCurrentPower - this.internalMaxPower;
this.internalCurrentPower = this.internalMaxPower;
amt = this.internalCurrentPower - this.getInternalMaxPower();
this.internalCurrentPower = this.getInternalMaxPower();
this.changePowerLevel();
return amt;
@@ -169,7 +168,7 @@ public class TileEnergyCell extends AENetworkTile implements IAEPowerStorage
@Override
public double getAEMaxPower()
{
return this.internalMaxPower;
return this.getInternalMaxPower();
}
@Override
@@ -207,13 +206,13 @@ public class TileEnergyCell extends AENetworkTile implements IAEPowerStorage
return this.internalCurrentPower;
}
final boolean wasFull = this.internalCurrentPower >= this.internalMaxPower - 0.001;
final boolean wasFull = this.internalCurrentPower >= this.getInternalMaxPower() - 0.001;
if( wasFull && amt > 0.001 )
{
try
{
this.gridProxy.getGrid().postEvent( new MENetworkPowerStorage( this, PowerEventType.REQUEST_POWER ) );
this.getProxy().getGrid().postEvent( new MENetworkPowerStorage( this, PowerEventType.REQUEST_POWER ) );
}
catch( final GridAccessException ignored )
{
@@ -235,4 +234,14 @@ public class TileEnergyCell extends AENetworkTile implements IAEPowerStorage
this.changePowerLevel();
return amt;
}
private double getInternalMaxPower()
{
return this.internalMaxPower;
}
void setInternalMaxPower( final double internalMaxPower )
{
this.internalMaxPower = internalMaxPower;
}
}
@@ -53,22 +53,22 @@ public class TileWireless extends AENetworkInvTile implements IWirelessAccessPoi
public static final int POWERED_FLAG = 1;
public static final int CHANNEL_FLAG = 2;
final int[] sides = { 0 };
final AppEngInternalInventory inv = new AppEngInternalInventory( this, 1 );
private final int[] sides = { 0 };
private final AppEngInternalInventory inv = new AppEngInternalInventory( this, 1 );
public int clientFlags = 0;
private int clientFlags = 0;
public TileWireless()
{
this.gridProxy.setFlags( GridFlags.REQUIRE_CHANNEL );
this.gridProxy.setValidSides( EnumSet.noneOf( EnumFacing.class ) );
this.getProxy().setFlags( GridFlags.REQUIRE_CHANNEL );
this.getProxy().setValidSides( EnumSet.noneOf( EnumFacing.class ) );
}
@Override
public void setOrientation( final EnumFacing inForward, final EnumFacing inUp )
{
super.setOrientation( inForward, inUp );
this.gridProxy.setValidSides( EnumSet.of( this.getForward().getOpposite() ) );
this.getProxy().setValidSides( EnumSet.of( this.getForward().getOpposite() ) );
}
@MENetworkEventSubscribe
@@ -86,27 +86,27 @@ public class TileWireless extends AENetworkInvTile implements IWirelessAccessPoi
@TileEvent( TileEventType.NETWORK_READ )
public boolean readFromStream_TileWireless( final ByteBuf data )
{
final int old = this.clientFlags;
this.clientFlags = data.readByte();
final int old = this.getClientFlags();
this.setClientFlags( data.readByte() );
return old != this.clientFlags;
return old != this.getClientFlags();
}
@TileEvent( TileEventType.NETWORK_WRITE )
public void writeToStream_TileWireless( final ByteBuf data )
{
this.clientFlags = 0;
this.setClientFlags( 0 );
try
{
if( this.gridProxy.getEnergy().isNetworkPowered() )
if( this.getProxy().getEnergy().isNetworkPowered() )
{
this.clientFlags |= POWERED_FLAG;
this.setClientFlags( this.getClientFlags() | POWERED_FLAG );
}
if( this.gridProxy.getNode().meetsChannelRequirements() )
if( this.getProxy().getNode().meetsChannelRequirements() )
{
this.clientFlags |= CHANNEL_FLAG;
this.setClientFlags( this.getClientFlags() | CHANNEL_FLAG );
}
}
catch( final GridAccessException e )
@@ -114,7 +114,7 @@ public class TileWireless extends AENetworkInvTile implements IWirelessAccessPoi
// meh
}
data.writeByte( (byte) this.clientFlags );
data.writeByte( (byte) this.getClientFlags() );
}
@Override
@@ -162,7 +162,7 @@ public class TileWireless extends AENetworkInvTile implements IWirelessAccessPoi
private void updatePower()
{
this.gridProxy.setIdlePowerUsage( AEConfig.instance.wireless_getPowerDrain( this.getBoosters() ) );
this.getProxy().setIdlePowerUsage( AEConfig.instance.wireless_getPowerDrain( this.getBoosters() ) );
}
private int getBoosters()
@@ -188,10 +188,10 @@ public class TileWireless extends AENetworkInvTile implements IWirelessAccessPoi
{
if( Platform.isClient() )
{
return this.isPowered() && ( CHANNEL_FLAG == ( this.clientFlags & CHANNEL_FLAG ) );
return this.isPowered() && ( CHANNEL_FLAG == ( this.getClientFlags() & CHANNEL_FLAG ) );
}
return this.gridProxy.isActive();
return this.getProxy().isActive();
}
@Override
@@ -199,7 +199,7 @@ public class TileWireless extends AENetworkInvTile implements IWirelessAccessPoi
{
try
{
return this.gridProxy.getGrid();
return this.getProxy().getGrid();
}
catch( final GridAccessException e )
{
@@ -210,6 +210,16 @@ public class TileWireless extends AENetworkInvTile implements IWirelessAccessPoi
@Override
public boolean isPowered()
{
return POWERED_FLAG == ( this.clientFlags & POWERED_FLAG );
return POWERED_FLAG == ( this.getClientFlags() & POWERED_FLAG );
}
public int getClientFlags()
{
return this.clientFlags;
}
private void setClientFlags( final int clientFlags )
{
this.clientFlags = clientFlags;
}
}
@@ -37,14 +37,13 @@ import appeng.tile.events.TileEventType;
public abstract class AERootPoweredTile extends AEBaseInvTile implements IAEPowerStorage
{
protected final boolean internalCanAcceptPower = true;
// values that determine general function, are set by inheriting classes if
// needed. These should generally remain static.
protected double internalMaxPower = 10000;
protected boolean internalPublicPowerStorage = false;
protected AccessRestriction internalPowerFlow = AccessRestriction.READ_WRITE;
private double internalMaxPower = 10000;
private boolean internalPublicPowerStorage = false;
private AccessRestriction internalPowerFlow = AccessRestriction.READ_WRITE;
// the current power buffer.
protected double internalCurrentPower = 0;
private double internalCurrentPower = 0;
private EnumSet<EnumFacing> internalPowerSides = EnumSet.allOf( EnumFacing.class );
protected EnumSet<EnumFacing> getPowerSides()
@@ -61,13 +60,13 @@ public abstract class AERootPoweredTile extends AEBaseInvTile implements IAEPowe
@TileEvent( TileEventType.WORLD_NBT_WRITE )
public void writeToNBT_AERootPoweredTile( final NBTTagCompound data )
{
data.setDouble( "internalCurrentPower", this.internalCurrentPower );
data.setDouble( "internalCurrentPower", this.getInternalCurrentPower() );
}
@TileEvent( TileEventType.WORLD_NBT_READ )
public void readFromNBT_AERootPoweredTile( final NBTTagCompound data )
{
this.internalCurrentPower = data.getDouble( "internalCurrentPower" );
this.setInternalCurrentPower( data.getDouble( "internalCurrentPower" ) );
}
protected final double getExternalPowerDemand( final PowerUnits externalUnit, final double maxPowerRequired )
@@ -77,7 +76,7 @@ public abstract class AERootPoweredTile extends AEBaseInvTile implements IAEPowe
protected double getFunnelPowerDemand( final double maxRequired )
{
return this.internalMaxPower - this.internalCurrentPower;
return this.getInternalMaxPower() - this.getInternalCurrentPower();
}
public final double injectExternalPower( final PowerUnits input, final double amt )
@@ -100,27 +99,27 @@ public abstract class AERootPoweredTile extends AEBaseInvTile implements IAEPowe
if( mode == Actionable.SIMULATE )
{
final double fakeBattery = this.internalCurrentPower + amt;
final double fakeBattery = this.getInternalCurrentPower() + amt;
if( fakeBattery > this.internalMaxPower )
if( fakeBattery > this.getInternalMaxPower() )
{
return fakeBattery - this.internalMaxPower;
return fakeBattery - this.getInternalMaxPower();
}
return 0;
}
else
{
if( this.internalCurrentPower < 0.01 && amt > 0.01 )
if( this.getInternalCurrentPower() < 0.01 && amt > 0.01 )
{
this.PowerEvent( PowerEventType.PROVIDE_POWER );
}
this.internalCurrentPower += amt;
if( this.internalCurrentPower > this.internalMaxPower )
this.setInternalCurrentPower( this.getInternalCurrentPower() + amt );
if( this.getInternalCurrentPower() > this.getInternalMaxPower() )
{
amt = this.internalCurrentPower - this.internalMaxPower;
this.internalCurrentPower = this.internalMaxPower;
amt = this.getInternalCurrentPower() - this.getInternalMaxPower();
this.setInternalCurrentPower( this.getInternalMaxPower() );
return amt;
}
@@ -136,25 +135,25 @@ public abstract class AERootPoweredTile extends AEBaseInvTile implements IAEPowe
@Override
public final double getAEMaxPower()
{
return this.internalMaxPower;
return this.getInternalMaxPower();
}
@Override
public final double getAECurrentPower()
{
return this.internalCurrentPower;
return this.getInternalCurrentPower();
}
@Override
public final boolean isAEPublicPowerStorage()
{
return this.internalPublicPowerStorage;
return this.isInternalPublicPowerStorage();
}
@Override
public final AccessRestriction getPowerFlow()
{
return this.internalPowerFlow;
return this.getInternalPowerFlow();
}
@Override
@@ -167,27 +166,67 @@ public abstract class AERootPoweredTile extends AEBaseInvTile implements IAEPowe
{
if( mode == Actionable.SIMULATE )
{
if( this.internalCurrentPower > amt )
if( this.getInternalCurrentPower() > amt )
{
return amt;
}
return this.internalCurrentPower;
return this.getInternalCurrentPower();
}
final boolean wasFull = this.internalCurrentPower >= this.internalMaxPower - 0.001;
final boolean wasFull = this.getInternalCurrentPower() >= this.getInternalMaxPower() - 0.001;
if( wasFull && amt > 0.001 )
{
this.PowerEvent( PowerEventType.REQUEST_POWER );
}
if( this.internalCurrentPower > amt )
if( this.getInternalCurrentPower() > amt )
{
this.internalCurrentPower -= amt;
this.setInternalCurrentPower( this.getInternalCurrentPower() - amt );
return amt;
}
amt = this.internalCurrentPower;
this.internalCurrentPower = 0;
amt = this.getInternalCurrentPower();
this.setInternalCurrentPower( 0 );
return amt;
}
public double getInternalCurrentPower()
{
return this.internalCurrentPower;
}
public void setInternalCurrentPower( final double internalCurrentPower )
{
this.internalCurrentPower = internalCurrentPower;
}
public double getInternalMaxPower()
{
return this.internalMaxPower;
}
public void setInternalMaxPower( final double internalMaxPower )
{
this.internalMaxPower = internalMaxPower;
}
private boolean isInternalPublicPowerStorage()
{
return this.internalPublicPowerStorage;
}
public void setInternalPublicPowerStorage( final boolean internalPublicPowerStorage )
{
this.internalPublicPowerStorage = internalPublicPowerStorage;
}
private AccessRestriction getInternalPowerFlow()
{
return this.internalPowerFlow;
}
public void setInternalPowerFlow( final AccessRestriction internalPowerFlow )
{
this.internalPowerFlow = internalPowerFlow;
}
}
@@ -69,4 +69,4 @@ package appeng.tile.powersink;
// {
// return this.getPowerSides().contains( side );
// }
//}
// }
@@ -55,25 +55,23 @@ import com.google.common.base.Optional;
public class TileQuantumBridge extends AENetworkInvTile implements IAEMultiBlock, IUpdatePlayerListBox
{
private static final IBlockDefinition RING_DEFINITION = AEApi.instance().definitions().blocks().quantumRing();
public final byte corner = 16;
final int[] sidesRing = {};
final int[] sidesLink = { 0 };
final AppEngInternalInventory internalInventory = new AppEngInternalInventory( this, 1 );
final byte hasSingularity = 32;
final byte powered = 64;
private final byte corner = 16;
private final int[] sidesRing = {};
private final int[] sidesLink = { 0 };
private final AppEngInternalInventory internalInventory = new AppEngInternalInventory( this, 1 );
private final byte hasSingularity = 32;
private final byte powered = 64;
private final QuantumCalculator calc = new QuantumCalculator( this );
public boolean bridgePowered;
byte constructed = -1;
QuantumCluster cluster;
private byte constructed = -1;
private QuantumCluster cluster;
private boolean updateStatus = false;
public TileQuantumBridge()
{
this.gridProxy.setValidSides( EnumSet.noneOf( EnumFacing.class ) );
this.gridProxy.setFlags( GridFlags.DENSE_CAPACITY );
this.gridProxy.setIdlePowerUsage( 22 );
this.getProxy().setValidSides( EnumSet.noneOf( EnumFacing.class ) );
this.getProxy().setFlags( GridFlags.DENSE_CAPACITY );
this.getProxy().setIdlePowerUsage( 22 );
this.internalInventory.setMaxStackSize( 1 );
}
@@ -101,7 +99,7 @@ public class TileQuantumBridge extends AENetworkInvTile implements IAEMultiBlock
out |= this.hasSingularity;
}
if( this.gridProxy.isActive() && this.constructed != -1 )
if( this.getProxy().isActive() && this.constructed != -1 )
{
out |= this.powered;
}
@@ -114,7 +112,6 @@ public class TileQuantumBridge extends AENetworkInvTile implements IAEMultiBlock
{
final int oldValue = this.constructed;
this.constructed = data.readByte();
this.bridgePowered = ( this.constructed | this.powered ) == this.powered;
return this.constructed != oldValue;
}
@@ -143,7 +140,7 @@ public class TileQuantumBridge extends AENetworkInvTile implements IAEMultiBlock
return this.sidesRing;
}
public boolean isCenter()
private boolean isCenter()
{
for( final Block link : AEApi.instance().definitions().blocks().quantumLink().maybeBlock().asSet() )
{
@@ -181,7 +178,7 @@ public class TileQuantumBridge extends AENetworkInvTile implements IAEMultiBlock
{
final ItemStack linkStack = maybeLinkStack.get();
this.gridProxy.setVisualRepresentation( linkStack );
this.getProxy().setVisualRepresentation( linkStack );
}
}
@@ -199,7 +196,7 @@ public class TileQuantumBridge extends AENetworkInvTile implements IAEMultiBlock
{
if( !affectWorld )
{
this.cluster.updateStatus = false;
this.cluster.setUpdateStatus( false );
}
this.cluster.destroy();
@@ -209,7 +206,7 @@ public class TileQuantumBridge extends AENetworkInvTile implements IAEMultiBlock
if( affectWorld )
{
this.gridProxy.setValidSides( EnumSet.noneOf( EnumFacing.class ) );
this.getProxy().setValidSides( EnumSet.noneOf( EnumFacing.class ) );
}
}
@@ -240,22 +237,22 @@ public class TileQuantumBridge extends AENetworkInvTile implements IAEMultiBlock
if( this.isCorner() || this.isCenter() )
{
final EnumSet<EnumFacing> sides = EnumSet.noneOf( EnumFacing.class );
for ( final AEPartLocation dir : this.getConnections() )
if ( dir != AEPartLocation.INTERNAL )
sides.add( dir.getFacing());
this.gridProxy.setValidSides( sides );
for( final AEPartLocation dir : this.getConnections() )
if( dir != AEPartLocation.INTERNAL )
sides.add( dir.getFacing() );
this.getProxy().setValidSides( sides );
}
else
{
this.gridProxy.setValidSides( EnumSet.allOf( EnumFacing.class ) );
this.getProxy().setValidSides( EnumSet.allOf( EnumFacing.class ) );
}
}
}
public boolean isCorner()
{
return ( this.constructed & this.corner ) == this.corner && this.constructed != -1;
return ( this.constructed & this.getCorner() ) == this.getCorner() && this.constructed != -1;
}
public EnumSet<AEPartLocation> getConnections()
@@ -297,7 +294,7 @@ public class TileQuantumBridge extends AENetworkInvTile implements IAEMultiBlock
try
{
return this.gridProxy.getEnergy().isNetworkPowered();
return this.getProxy().getEnergy().isNetworkPowered();
}
catch( final GridAccessException e )
{
@@ -345,4 +342,9 @@ public class TileQuantumBridge extends AENetworkInvTile implements IAEMultiBlock
this.cluster.destroy();
}
}
public byte getCorner()
{
return this.corner;
}
}
@@ -53,13 +53,13 @@ import appeng.util.Platform;
public class TileSpatialIOPort extends AENetworkInvTile implements IWorldCallable<Void>
{
final int[] sides = { 0, 1 };
final AppEngInternalInventory inv = new AppEngInternalInventory( this, 2 );
YesNo lastRedstoneState = YesNo.UNDECIDED;
private final int[] sides = { 0, 1 };
private final AppEngInternalInventory inv = new AppEngInternalInventory( this, 2 );
private YesNo lastRedstoneState = YesNo.UNDECIDED;
public TileSpatialIOPort()
{
this.gridProxy.setFlags( GridFlags.REQUIRE_CHANNEL );
this.getProxy().setFlags( GridFlags.REQUIRE_CHANNEL );
}
@TileEvent( TileEventType.WORLD_NBT_WRITE )
@@ -128,8 +128,8 @@ public class TileSpatialIOPort extends AENetworkInvTile implements IWorldCallabl
final ItemStack cell = this.getStackInSlot( 0 );
if( this.isSpatialCell( cell ) && this.getStackInSlot( 1 ) == null )
{
final IGrid gi = this.gridProxy.getGrid();
final IEnergyGrid energy = this.gridProxy.getEnergy();
final IGrid gi = this.getProxy().getGrid();
final IEnergyGrid energy = this.getProxy().getEnergy();
final ISpatialStorageCell sc = (ISpatialStorageCell) cell.getItem();
@@ -179,7 +179,7 @@ public class TileSpatialIOPort extends AENetworkInvTile implements IWorldCallabl
@Override
public boolean isItemValidForSlot( final int i, final ItemStack itemstack )
{
return ( i == 0 && this.isSpatialCell( itemstack ) );
return( i == 0 && this.isSpatialCell( itemstack ) );
}
@Override
@@ -53,16 +53,17 @@ public class TileSpatialPylon extends AENetworkTile implements IAEMultiBlock
public static final int DISPLAY_ENABLED = 0x10;
public static final int DISPLAY_POWERED_ENABLED = 0x20;
public static final int NET_STATUS = 0x10 + 0x20;
final SpatialPylonCalculator calc = new SpatialPylonCalculator( this );
int displayBits = 0;
SpatialPylonCluster cluster;
boolean didHaveLight = false;
private final SpatialPylonCalculator calc = new SpatialPylonCalculator( this );
private int displayBits = 0;
private SpatialPylonCluster cluster;
private boolean didHaveLight = false;
public TileSpatialPylon()
{
this.gridProxy.setFlags( GridFlags.REQUIRE_CHANNEL, GridFlags.MULTIBLOCK );
this.gridProxy.setIdlePowerUsage( 0.5 );
this.gridProxy.setValidSides( EnumSet.noneOf( EnumFacing.class ) );
this.getProxy().setFlags( GridFlags.REQUIRE_CHANNEL, GridFlags.MULTIBLOCK );
this.getProxy().setIdlePowerUsage( 0.5 );
this.getProxy().setValidSides( EnumSet.noneOf( EnumFacing.class ) );
}
@Override
@@ -122,7 +123,7 @@ public class TileSpatialPylon extends AENetworkTile implements IAEMultiBlock
public void updateStatus( final SpatialPylonCluster c )
{
this.cluster = c;
this.gridProxy.setValidSides( c == null ? EnumSet.noneOf( EnumFacing.class ) : EnumSet.allOf( EnumFacing.class ) );
this.getProxy().setValidSides( c == null ? EnumSet.noneOf( EnumFacing.class ) : EnumSet.allOf( EnumFacing.class ) );
this.recalculateDisplay();
}
@@ -134,11 +135,11 @@ public class TileSpatialPylon extends AENetworkTile implements IAEMultiBlock
if( this.cluster != null )
{
if( this.cluster.min.equals( this.getLocation() ) )
if( this.cluster.getMin().equals( this.getLocation() ) )
{
this.displayBits = DISPLAY_END_MIN;
}
else if( this.cluster.max.equals( this.getLocation() ) )
else if( this.cluster.getMax().equals( this.getLocation() ) )
{
this.displayBits = DISPLAY_END_MAX;
}
@@ -147,7 +148,7 @@ public class TileSpatialPylon extends AENetworkTile implements IAEMultiBlock
this.displayBits = DISPLAY_MIDDLE;
}
switch( this.cluster.currentAxis )
switch( this.cluster.getCurrentAxis() )
{
case X:
this.displayBits |= DISPLAY_X;
@@ -165,12 +166,12 @@ public class TileSpatialPylon extends AENetworkTile implements IAEMultiBlock
try
{
if( this.gridProxy.getEnergy().isNetworkPowered() )
if( this.getProxy().getEnergy().isNetworkPowered() )
{
this.displayBits |= DISPLAY_POWERED_ENABLED;
}
if( this.cluster.isValid && this.gridProxy.isActive() )
if( this.cluster.isValid() && this.getProxy().isActive() )
{
this.displayBits |= DISPLAY_ENABLED;
}
@@ -95,34 +95,34 @@ import appeng.util.item.AEFluidStack;
public class TileChest extends AENetworkPowerTile implements IMEChest, IFluidHandler, ITerminalHost, IPriorityHost, IConfigManagerHost, IColorableTile, IUpdatePlayerListBox
{
static final ChestNoHandler NO_HANDLER = new ChestNoHandler();
static final int[] SIDES = { 0 };
static final int[] FRONT = { 1 };
static final int[] NO_SLOTS = {};
final AppEngInternalInventory inv = new AppEngInternalInventory( this, 2 );
final BaseActionSource mySrc = new MachineSource( this );
final IConfigManager config = new ConfigManager( this );
ItemStack storageType;
long lastStateChange = 0;
int priority = 0;
int state = 0;
boolean wasActive = false;
AEColor paintedColor = AEColor.Transparent;
boolean isCached = false;
private static final ChestNoHandler NO_HANDLER = new ChestNoHandler();
private static final int[] SIDES = { 0 };
private static final int[] FRONT = { 1 };
private static final int[] NO_SLOTS = {};
private final AppEngInternalInventory inv = new AppEngInternalInventory( this, 2 );
private final BaseActionSource mySrc = new MachineSource( this );
private final IConfigManager config = new ConfigManager( this );
private ItemStack storageType;
private long lastStateChange = 0;
private int priority = 0;
private int state = 0;
private boolean wasActive = false;
private AEColor paintedColor = AEColor.Transparent;
private boolean isCached = false;
private ICellHandler cellHandler;
private MEMonitorHandler itemCell;
private MEMonitorHandler fluidCell;
public TileChest()
{
this.internalMaxPower = PowerMultiplier.CONFIG.multiply( 40 );
this.gridProxy.setFlags( GridFlags.REQUIRE_CHANNEL );
this.setInternalMaxPower( PowerMultiplier.CONFIG.multiply( 40 ) );
this.getProxy().setFlags( GridFlags.REQUIRE_CHANNEL );
this.config.registerSetting( Settings.SORT_BY, SortOrder.NAME );
this.config.registerSetting( Settings.VIEW_MODE, ViewItems.ALL );
this.config.registerSetting( Settings.SORT_DIRECTION, SortDir.ASCENDING );
this.internalPublicPowerStorage = true;
this.internalPowerFlow = AccessRestriction.WRITE;
this.setInternalPublicPowerStorage( true );
this.setInternalPowerFlow( AccessRestriction.WRITE );
}
@Override
@@ -132,7 +132,7 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, IFluidHan
{
try
{
this.gridProxy.getGrid().postEvent( new MENetworkPowerStorage( this, PowerEventType.REQUEST_POWER ) );
this.getProxy().getGrid().postEvent( new MENetworkPowerStorage( this, PowerEventType.REQUEST_POWER ) );
}
catch( final GridAccessException e )
{
@@ -163,13 +163,13 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, IFluidHan
this.state &= ~0x40;
}
final boolean currentActive = this.gridProxy.isActive();
final boolean currentActive = this.getProxy().isActive();
if( this.wasActive != currentActive )
{
this.wasActive = currentActive;
try
{
this.gridProxy.getGrid().postEvent( new MENetworkCellArrayUpdate() );
this.getProxy().getGrid().postEvent( new MENetworkCellArrayUpdate() );
}
catch( final GridAccessException e )
{
@@ -189,7 +189,7 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, IFluidHan
return 1;
}
public IMEInventoryHandler getHandler( final StorageChannel channel ) throws ChestNoHandler
private IMEInventoryHandler getHandler( final StorageChannel channel ) throws ChestNoHandler
{
if( !this.isCached )
{
@@ -217,7 +217,7 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, IFluidHan
power += this.cellHandler.cellIdleDrain( is, fluidCell );
}
this.gridProxy.setIdlePowerUsage( power );
this.getProxy().setIdlePowerUsage( power );
this.itemCell = this.wrap( itemCell );
this.fluidCell = this.wrap( fluidCell );
@@ -316,7 +316,7 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, IFluidHan
{
try
{
gridPowered = this.gridProxy.getEnergy().isNetworkPowered();
gridPowered = this.getProxy().getEnergy().isNetworkPowered();
}
catch( final GridAccessException ignored )
{
@@ -345,7 +345,7 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, IFluidHan
try
{
final IEnergyGrid eg = this.gridProxy.getEnergy();
final IEnergyGrid eg = this.getProxy().getEnergy();
stash = eg.extractAEPower( amt, mode, PowerMultiplier.ONE );
if( stash >= amt )
{
@@ -369,11 +369,11 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, IFluidHan
return;
}
final double idleUsage = this.gridProxy.getIdlePowerUsage();
final double idleUsage = this.getProxy().getIdlePowerUsage();
try
{
if( !this.gridProxy.getEnergy().isNetworkPowered() )
if( !this.getProxy().getEnergy().isNetworkPowered() )
{
final double powerUsed = this.extractAEPower( idleUsage, Actionable.MODULATE, PowerMultiplier.CONFIG ); // drain
if( powerUsed + 0.1 >= idleUsage != ( this.state & 0x40 ) > 0 )
@@ -384,7 +384,7 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, IFluidHan
}
catch( final GridAccessException e )
{
final double powerUsed = this.extractAEPower( this.gridProxy.getIdlePowerUsage(), Actionable.MODULATE, PowerMultiplier.CONFIG ); // drain
final double powerUsed = this.extractAEPower( this.getProxy().getIdlePowerUsage(), Actionable.MODULATE, PowerMultiplier.CONFIG ); // drain
if( powerUsed + 0.1 >= idleUsage != ( this.state & 0x40 ) > 0 )
{
this.recalculateDisplay();
@@ -531,9 +531,9 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, IFluidHan
try
{
this.gridProxy.getGrid().postEvent( new MENetworkCellArrayUpdate() );
this.getProxy().getGrid().postEvent( new MENetworkCellArrayUpdate() );
final IStorageGrid gs = this.gridProxy.getStorage();
final IStorageGrid gs = this.getProxy().getStorage();
Platform.postChanges( gs, removed, added, this.mySrc );
}
catch( final GridAccessException ignored )
@@ -638,7 +638,7 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, IFluidHan
@Override
public List<IMEInventoryHandler> getCellArray( final StorageChannel channel )
{
if( this.gridProxy.isActive() )
if( this.getProxy().isActive() )
{
try
{
@@ -669,7 +669,7 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, IFluidHan
try
{
this.gridProxy.getGrid().postEvent( new MENetworkCellArrayUpdate() );
this.getProxy().getGrid().postEvent( new MENetworkCellArrayUpdate() );
}
catch( final GridAccessException e )
{
@@ -773,7 +773,7 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, IFluidHan
@Override
public IStorageMonitorable getMonitorable( final EnumFacing side, final BaseActionSource src )
{
if( Platform.canAccess( this.gridProxy, src ) && side != this.getForward() )
if( Platform.canAccess( this.getProxy(), src ) && side != this.getForward() )
{
return this;
}
@@ -868,11 +868,10 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, IFluidHan
private static final long serialVersionUID = 7995805326136526631L;
}
class ChestNetNotifier<T extends IAEStack<T>> implements IMEMonitorHandlerReceiver<T>
private class ChestNetNotifier<T extends IAEStack<T>> implements IMEMonitorHandlerReceiver<T>
{
final StorageChannel chan;
private final StorageChannel chan;
public ChestNetNotifier( final StorageChannel chan )
{
@@ -900,9 +899,9 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, IFluidHan
{
try
{
if( TileChest.this.gridProxy.isActive() )
if( TileChest.this.getProxy().isActive() )
{
TileChest.this.gridProxy.getStorage().postAlterationOfStoredItems( this.chan, change, TileChest.this.mySrc );
TileChest.this.getProxy().getStorage().postAlterationOfStoredItems( this.chan, change, TileChest.this.mySrc );
}
}
catch( final GridAccessException e )
@@ -921,8 +920,7 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, IFluidHan
}
}
class ChestMonitorHandler<T extends IAEStack> extends MEMonitorHandler<T>
private class ChestMonitorHandler<T extends IAEStack> extends MEMonitorHandler<T>
{
public ChestMonitorHandler( final IMEInventoryHandler<T> t )
@@ -930,7 +928,7 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, IFluidHan
super( t );
}
public IMEInventoryHandler<T> getInternalHandler()
private IMEInventoryHandler<T> getInternalHandler()
{
final IMEInventoryHandler<T> h = this.getHandler();
if( h instanceof MEInventoryHandler )
@@ -62,23 +62,23 @@ import appeng.util.Platform;
public class TileDrive extends AENetworkInvTile implements IChestOrDrive, IPriorityHost
{
final int[] sides = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };
final AppEngInternalInventory inv = new AppEngInternalInventory( this, 10 );
final ICellHandler[] handlersBySlot = new ICellHandler[10];
final DriveWatcher<IAEItemStack>[] invBySlot = new DriveWatcher[10];
final BaseActionSource mySrc;
boolean isCached = false;
List<MEInventoryHandler> items = new LinkedList<MEInventoryHandler>();
List<MEInventoryHandler> fluids = new LinkedList<MEInventoryHandler>();
long lastStateChange = 0;
int state = 0;
int priority = 0;
boolean wasActive = false;
private final int[] sides = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };
private final AppEngInternalInventory inv = new AppEngInternalInventory( this, 10 );
private final ICellHandler[] handlersBySlot = new ICellHandler[10];
private final DriveWatcher<IAEItemStack>[] invBySlot = new DriveWatcher[10];
private final BaseActionSource mySrc;
private boolean isCached = false;
private List<MEInventoryHandler> items = new LinkedList<MEInventoryHandler>();
private List<MEInventoryHandler> fluids = new LinkedList<MEInventoryHandler>();
private long lastStateChange = 0;
private int state = 0;
private int priority = 0;
private boolean wasActive = false;
public TileDrive()
{
this.mySrc = new MachineSource( this );
this.gridProxy.setFlags( GridFlags.REQUIRE_CHANNEL );
this.getProxy().setFlags( GridFlags.REQUIRE_CHANNEL );
}
@TileEvent( TileEventType.NETWORK_WRITE )
@@ -93,7 +93,7 @@ public class TileDrive extends AENetworkInvTile implements IChestOrDrive, IPrior
this.state &= 0x24924924; // just keep the blinks...
}
if( this.gridProxy.isActive() )
if( this.getProxy().isActive() )
{
this.state |= 0x80000000;
}
@@ -160,7 +160,7 @@ public class TileDrive extends AENetworkInvTile implements IChestOrDrive, IPrior
return ( this.state & 0x80000000 ) == 0x80000000;
}
return this.gridProxy.isActive();
return this.getProxy().isActive();
}
@Override
@@ -206,7 +206,7 @@ public class TileDrive extends AENetworkInvTile implements IChestOrDrive, IPrior
private void recalculateDisplay()
{
final boolean currentActive = this.gridProxy.isActive();
final boolean currentActive = this.getProxy().isActive();
if( currentActive )
{
this.state |= 0x80000000;
@@ -221,7 +221,7 @@ public class TileDrive extends AENetworkInvTile implements IChestOrDrive, IPrior
this.wasActive = currentActive;
try
{
this.gridProxy.getGrid().postEvent( new MENetworkCellArrayUpdate() );
this.getProxy().getGrid().postEvent( new MENetworkCellArrayUpdate() );
}
catch( final GridAccessException e )
{
@@ -282,9 +282,9 @@ public class TileDrive extends AENetworkInvTile implements IChestOrDrive, IPrior
try
{
this.gridProxy.getGrid().postEvent( new MENetworkCellArrayUpdate() );
this.getProxy().getGrid().postEvent( new MENetworkCellArrayUpdate() );
final IStorageGrid gs = this.gridProxy.getStorage();
final IStorageGrid gs = this.getProxy().getStorage();
Platform.postChanges( gs, removed, added, this.mySrc );
}
catch( final GridAccessException ignored )
@@ -300,7 +300,7 @@ public class TileDrive extends AENetworkInvTile implements IChestOrDrive, IPrior
return this.sides;
}
public void updateState()
private void updateState()
{
if( !this.isCached )
{
@@ -350,7 +350,7 @@ public class TileDrive extends AENetworkInvTile implements IChestOrDrive, IPrior
}
}
this.gridProxy.setIdlePowerUsage( power );
this.getProxy().setIdlePowerUsage( power );
this.isCached = true;
}
@@ -366,7 +366,7 @@ public class TileDrive extends AENetworkInvTile implements IChestOrDrive, IPrior
@Override
public List<IMEInventoryHandler> getCellArray( final StorageChannel channel )
{
if( this.gridProxy.isActive() )
if( this.getProxy().isActive() )
{
this.updateState();
return (List) ( channel == StorageChannel.ITEMS ? this.items : this.fluids );
@@ -391,7 +391,7 @@ public class TileDrive extends AENetworkInvTile implements IChestOrDrive, IPrior
try
{
this.gridProxy.getGrid().postEvent( new MENetworkCellArrayUpdate() );
this.getProxy().getGrid().postEvent( new MENetworkCellArrayUpdate() );
}
catch( final GridAccessException e )
{
@@ -107,7 +107,7 @@ public class TileIOPort extends AENetworkInvTile implements IUpgradeableHost, IC
@Reflected
public TileIOPort()
{
this.gridProxy.setFlags( GridFlags.REQUIRE_CHANNEL );
this.getProxy().setFlags( GridFlags.REQUIRE_CHANNEL );
this.manager = new ConfigManager( this );
this.manager.registerSetting( Settings.REDSTONE_CONTROLLED, RedstoneMode.IGNORE );
this.manager.registerSetting( Settings.FULLNESS_MODE, FullnessMode.EMPTY );
@@ -159,11 +159,11 @@ public class TileIOPort extends AENetworkInvTile implements IUpgradeableHost, IC
{
if( this.hasWork() )
{
this.gridProxy.getTick().wakeDevice( this.gridProxy.getNode() );
this.getProxy().getTick().wakeDevice( this.getProxy().getNode() );
}
else
{
this.gridProxy.getTick().sleepDevice( this.gridProxy.getNode() );
this.getProxy().getTick().sleepDevice( this.getProxy().getNode() );
}
}
catch( final GridAccessException e )
@@ -182,7 +182,7 @@ public class TileIOPort extends AENetworkInvTile implements IUpgradeableHost, IC
}
}
public boolean getRedstoneState()
private boolean getRedstoneState()
{
if( this.lastRedstoneState == YesNo.UNDECIDED )
{
@@ -235,7 +235,7 @@ public class TileIOPort extends AENetworkInvTile implements IUpgradeableHost, IC
this.updateTask();
}
boolean hasWork()
private boolean hasWork()
{
if( this.isEnabled() )
{
@@ -308,13 +308,13 @@ public class TileIOPort extends AENetworkInvTile implements IUpgradeableHost, IC
@Override
public TickingRequest getTickingRequest( final IGridNode node )
{
return new TickingRequest( TickRates.IOPort.min, TickRates.IOPort.max, this.hasWork(), false );
return new TickingRequest( TickRates.IOPort.getMin(), TickRates.IOPort.getMax(), this.hasWork(), false );
}
@Override
public TickRateModulation tickingRequest( final IGridNode node, final int ticksSinceLastCall )
{
if( !this.gridProxy.isActive() )
if( !this.getProxy().isActive() )
{
return TickRateModulation.IDLE;
}
@@ -336,9 +336,9 @@ public class TileIOPort extends AENetworkInvTile implements IUpgradeableHost, IC
try
{
final IMEInventory<IAEItemStack> itemNet = this.gridProxy.getStorage().getItemInventory();
final IMEInventory<IAEFluidStack> fluidNet = this.gridProxy.getStorage().getFluidInventory();
final IEnergySource energy = this.gridProxy.getEnergy();
final IMEInventory<IAEItemStack> itemNet = this.getProxy().getStorage().getItemInventory();
final IMEInventory<IAEFluidStack> fluidNet = this.getProxy().getStorage().getFluidInventory();
final IEnergySource energy = this.getProxy().getEnergy();
for( int x = 0; x < 6; x++ )
{
final ItemStack is = this.cells.getStackInSlot( x );
@@ -556,10 +556,10 @@ public class TileIOPort extends AENetworkInvTile implements IUpgradeableHost, IC
/**
* Adds the items in the upgrade slots to the drop list.
*
* @param w world
* @param x x pos of tile entity
* @param y y pos of tile entity
* @param z z pos of tile entity
* @param w world
* @param x x pos of tile entity
* @param y y pos of tile entity
* @param z z pos of tile entity
* @param drops drops of tile entity
*/
@Override
@@ -35,29 +35,29 @@ import appeng.util.Platform;
public class TileSkyChest extends AEBaseInvTile
{
final int[] sides = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35 };
final AppEngInternalInventory inv = new AppEngInternalInventory( this, 9 * 4 );
private final int[] sides = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35 };
private final AppEngInternalInventory inv = new AppEngInternalInventory( this, 9 * 4 );
// server
public int playerOpen;
private int playerOpen;
// client..
public long lastEvent;
public float lidAngle;
private long lastEvent;
private float lidAngle;
@TileEvent( TileEventType.NETWORK_WRITE )
public void writeToStream_TileSkyChest( final ByteBuf data )
{
data.writeBoolean( this.playerOpen > 0 );
data.writeBoolean( this.getPlayerOpen() > 0 );
}
@TileEvent( TileEventType.NETWORK_READ )
public boolean readFromStream_TileSkyChest( final ByteBuf data )
{
final int wasOpen = this.playerOpen;
this.playerOpen = data.readBoolean() ? 1 : 0;
final int wasOpen = this.getPlayerOpen();
this.setPlayerOpen( data.readBoolean() ? 1 : 0 );
if( wasOpen != this.playerOpen )
if( wasOpen != this.getPlayerOpen() )
{
this.lastEvent = System.currentTimeMillis();
this.setLastEvent( System.currentTimeMillis() );
}
return false; // TESR yo!
@@ -83,9 +83,9 @@ public class TileSkyChest extends AEBaseInvTile
return;
}
this.playerOpen++;
this.setPlayerOpen( this.getPlayerOpen() + 1 );
if( this.playerOpen == 1 )
if( this.getPlayerOpen() == 1 )
{
this.getWorld().playSoundEffect( this.pos.getX() + 0.5D, this.pos.getY() + 0.5D, this.pos.getZ() + 0.5D, "random.chestopen", 0.5F, this.getWorld().rand.nextFloat() * 0.1F + 0.9F );
this.markForUpdate();
@@ -100,14 +100,14 @@ public class TileSkyChest extends AEBaseInvTile
return;
}
this.playerOpen--;
this.setPlayerOpen( this.getPlayerOpen() - 1 );
if( this.playerOpen < 0 )
if( this.getPlayerOpen() < 0 )
{
this.playerOpen = 0;
this.setPlayerOpen( 0 );
}
if( this.playerOpen == 0 )
if( this.getPlayerOpen() == 0 )
{
this.getWorld().playSoundEffect( this.pos.getX() + 0.5D, this.pos.getY() + 0.5D, this.pos.getZ() + 0.5D, "random.chestclosed", 0.5F, this.getWorld().rand.nextFloat() * 0.1F + 0.9F );
this.markForUpdate();
@@ -125,4 +125,34 @@ public class TileSkyChest extends AEBaseInvTile
{
return this.sides;
}
public float getLidAngle()
{
return this.lidAngle;
}
public void setLidAngle( final float lidAngle )
{
this.lidAngle = lidAngle;
}
public int getPlayerOpen()
{
return this.playerOpen;
}
private void setPlayerOpen( final int playerOpen )
{
this.playerOpen = playerOpen;
}
public long getLastEvent()
{
return this.lastEvent;
}
private void setLastEvent( final long lastEvent )
{
this.lastEvent = lastEvent;
}
}