reformatted all src files (#141)

This commit is contained in:
YoungOnion
2022-09-17 05:08:02 -06:00
committed by GitHub
parent 3328bfcda2
commit 9011273229
1056 changed files with 88127 additions and 110597 deletions
File diff suppressed because it is too large Load Diff
+237 -305
View File
@@ -19,20 +19,6 @@
package appeng.tile.storage;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.IdentityHashMap;
import java.util.List;
import java.util.Map;
import io.netty.buffer.ByteBuf;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraftforge.items.IItemHandler;
import appeng.api.AEApi;
import appeng.api.implementations.tiles.IChestOrDrive;
import appeng.api.networking.GridFlags;
@@ -42,11 +28,7 @@ import appeng.api.networking.events.MENetworkEventSubscribe;
import appeng.api.networking.events.MENetworkPowerStatusChange;
import appeng.api.networking.security.IActionSource;
import appeng.api.networking.storage.IStorageGrid;
import appeng.api.storage.ICellHandler;
import appeng.api.storage.ICellInventory;
import appeng.api.storage.ICellInventoryHandler;
import appeng.api.storage.IMEInventoryHandler;
import appeng.api.storage.IStorageChannel;
import appeng.api.storage.*;
import appeng.api.storage.data.IAEItemStack;
import appeng.api.storage.data.IAEStack;
import appeng.api.util.AECableType;
@@ -62,349 +44,299 @@ import appeng.tile.inventory.AppEngCellInventory;
import appeng.util.Platform;
import appeng.util.inv.InvOperation;
import appeng.util.inv.filter.IAEItemFilter;
import io.netty.buffer.ByteBuf;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraftforge.items.IItemHandler;
import java.io.IOException;
import java.util.*;
public class TileDrive extends AENetworkInvTile implements IChestOrDrive, IPriorityHost
{
public class TileDrive extends AENetworkInvTile implements IChestOrDrive, IPriorityHost {
private static final int BIT_POWER_MASK = 0x80000000;
private static final int BIT_BLINK_MASK = 0x24924924;
private static final int BIT_STATE_MASK = 0xDB6DB6DB;
private static final int BIT_POWER_MASK = 0x80000000;
private static final int BIT_BLINK_MASK = 0x24924924;
private static final int BIT_STATE_MASK = 0xDB6DB6DB;
private final AppEngCellInventory inv = new AppEngCellInventory( this, 10 );
private final ICellHandler[] handlersBySlot = new ICellHandler[10];
private final DriveWatcher<IAEItemStack>[] invBySlot = new DriveWatcher[10];
private final IActionSource mySrc;
private boolean isCached = false;
private Map<IStorageChannel<? extends IAEStack<?>>, List<IMEInventoryHandler>> inventoryHandlers;
private int priority = 0;
private boolean wasActive = false;
private final AppEngCellInventory inv = new AppEngCellInventory(this, 10);
private final ICellHandler[] handlersBySlot = new ICellHandler[10];
private final DriveWatcher<IAEItemStack>[] invBySlot = new DriveWatcher[10];
private final IActionSource mySrc;
private boolean isCached = false;
private final Map<IStorageChannel<? extends IAEStack<?>>, List<IMEInventoryHandler>> inventoryHandlers;
private int priority = 0;
private boolean wasActive = false;
/**
* The state of all cells inside a drive as bitset, using the following format.
*
* Bit 31: power state. 0 = off, 1 = on.
* Bit 30: undefined
* Bit 29-0: 3 bits as state of each cell with the cell in slot 0 located in the 3 least significant bits.
*
* Cell states:
* Bit 2: blink. 0 = off, 1 = on.
* Bit 1-0: cell status
*
*
*/
private int state = 0;
/**
* The state of all cells inside a drive as bitset, using the following format.
* <p>
* Bit 31: power state. 0 = off, 1 = on.
* Bit 30: undefined
* Bit 29-0: 3 bits as state of each cell with the cell in slot 0 located in the 3 least significant bits.
* <p>
* Cell states:
* Bit 2: blink. 0 = off, 1 = on.
* Bit 1-0: cell status
*/
private int state = 0;
public TileDrive()
{
this.mySrc = new MachineSource( this );
this.getProxy().setFlags( GridFlags.REQUIRE_CHANNEL );
this.inv.setFilter( new CellValidInventoryFilter() );
this.inventoryHandlers = new IdentityHashMap<>();
}
public TileDrive() {
this.mySrc = new MachineSource(this);
this.getProxy().setFlags(GridFlags.REQUIRE_CHANNEL);
this.inv.setFilter(new CellValidInventoryFilter());
this.inventoryHandlers = new IdentityHashMap<>();
}
@Override
protected void writeToStream( final ByteBuf data ) throws IOException
{
super.writeToStream( data );
int newState = 0;
@Override
protected void writeToStream(final ByteBuf data) throws IOException {
super.writeToStream(data);
int newState = 0;
if( this.getProxy().isActive() )
{
newState |= BIT_POWER_MASK;
}
if (this.getProxy().isActive()) {
newState |= BIT_POWER_MASK;
}
for( int x = 0; x < this.getCellCount(); x++ )
{
newState |= ( this.getCellStatus( x ) << ( 3 * x ) );
}
for (int x = 0; x < this.getCellCount(); x++) {
newState |= (this.getCellStatus(x) << (3 * x));
}
data.writeInt( newState );
}
data.writeInt(newState);
}
@Override
protected boolean readFromStream( final ByteBuf data ) throws IOException
{
final boolean c = super.readFromStream( data );
final int oldState = this.state;
this.state = data.readInt();
return ( this.state & BIT_STATE_MASK ) != ( oldState & BIT_STATE_MASK ) || c;
}
@Override
protected boolean readFromStream(final ByteBuf data) throws IOException {
final boolean c = super.readFromStream(data);
final int oldState = this.state;
this.state = data.readInt();
return (this.state & BIT_STATE_MASK) != (oldState & BIT_STATE_MASK) || c;
}
@Override
public int getCellCount()
{
return 10;
}
@Override
public int getCellCount() {
return 10;
}
@Override
public int getCellStatus( final int slot )
{
if( Platform.isClient() )
{
return ( this.state >> ( slot * 3 ) ) & 3;
}
@Override
public int getCellStatus(final int slot) {
if (Platform.isClient()) {
return (this.state >> (slot * 3)) & 3;
}
final DriveWatcher handler = this.invBySlot[slot];
if( handler == null )
{
return 0;
}
final DriveWatcher handler = this.invBySlot[slot];
if (handler == null) {
return 0;
}
return handler.getStatus();
}
return handler.getStatus();
}
@Override
public boolean isPowered()
{
if( Platform.isClient() )
{
return ( this.state & BIT_POWER_MASK ) == BIT_POWER_MASK;
}
@Override
public boolean isPowered() {
if (Platform.isClient()) {
return (this.state & BIT_POWER_MASK) == BIT_POWER_MASK;
}
return this.getProxy().isActive();
}
return this.getProxy().isActive();
}
@Override
public boolean isCellBlinking( final int slot )
{
return ( ( this.state >> ( slot * 3 + 2 ) ) & 0x01 ) == 0x01;
}
@Override
public boolean isCellBlinking(final int slot) {
return ((this.state >> (slot * 3 + 2)) & 0x01) == 0x01;
}
@Override
public void readFromNBT( final NBTTagCompound data )
{
super.readFromNBT( data );
this.isCached = false;
this.priority = data.getInteger( "priority" );
}
@Override
public void readFromNBT(final NBTTagCompound data) {
super.readFromNBT(data);
this.isCached = false;
this.priority = data.getInteger("priority");
}
@Override
public NBTTagCompound writeToNBT( final NBTTagCompound data )
{
super.writeToNBT( data );
data.setInteger( "priority", this.priority );
return data;
}
@Override
public NBTTagCompound writeToNBT(final NBTTagCompound data) {
super.writeToNBT(data);
data.setInteger("priority", this.priority);
return data;
}
@MENetworkEventSubscribe
public void powerRender( final MENetworkPowerStatusChange c )
{
this.recalculateDisplay();
}
@MENetworkEventSubscribe
public void powerRender(final MENetworkPowerStatusChange c) {
this.recalculateDisplay();
}
private void recalculateDisplay()
{
final boolean currentActive = this.getProxy().isActive();
int newState = 0;
private void recalculateDisplay() {
final boolean currentActive = this.getProxy().isActive();
int newState = 0;
if( currentActive )
{
newState |= BIT_POWER_MASK;
}
if (currentActive) {
newState |= BIT_POWER_MASK;
}
if( this.wasActive != currentActive )
{
this.wasActive = currentActive;
try
{
this.getProxy().getGrid().postEvent( new MENetworkCellArrayUpdate() );
}
catch( final GridAccessException e )
{
// :P
}
}
if (this.wasActive != currentActive) {
this.wasActive = currentActive;
try {
this.getProxy().getGrid().postEvent(new MENetworkCellArrayUpdate());
} catch (final GridAccessException e) {
// :P
}
}
for( int x = 0; x < this.getCellCount(); x++ )
{
newState |= ( this.getCellStatus( x ) << ( 3 * x ) );
}
for (int x = 0; x < this.getCellCount(); x++) {
newState |= (this.getCellStatus(x) << (3 * x));
}
if( newState != this.state )
{
this.state = newState;
this.markForUpdate();
}
}
if (newState != this.state) {
this.state = newState;
this.markForUpdate();
}
}
@MENetworkEventSubscribe
public void channelRender( final MENetworkChannelsChanged c )
{
this.recalculateDisplay();
}
@MENetworkEventSubscribe
public void channelRender(final MENetworkChannelsChanged c) {
this.recalculateDisplay();
}
@Override
public AECableType getCableConnectionType( final AEPartLocation dir )
{
return AECableType.SMART;
}
@Override
public AECableType getCableConnectionType(final AEPartLocation dir) {
return AECableType.SMART;
}
@Override
public DimensionalCoord getLocation()
{
return new DimensionalCoord( this );
}
@Override
public DimensionalCoord getLocation() {
return new DimensionalCoord(this);
}
@Override
public IItemHandler getInternalInventory()
{
return this.inv;
}
@Override
public IItemHandler getInternalInventory() {
return this.inv;
}
@Override
public void onChangeInventory( final IItemHandler inv, final int slot, final InvOperation mc, final ItemStack removed, final ItemStack added )
{
if( this.isCached )
{
this.isCached = false; // recalculate the storage cell.
this.updateState();
}
@Override
public void onChangeInventory(final IItemHandler inv, final int slot, final InvOperation mc, final ItemStack removed, final ItemStack added) {
if (this.isCached) {
this.isCached = false; // recalculate the storage cell.
this.updateState();
}
try
{
if( this.getProxy().isActive() )
{
final IStorageGrid gs = this.getProxy().getStorage();
Platform.postChanges( gs, removed, added, this.mySrc );
}
this.getProxy().getGrid().postEvent( new MENetworkCellArrayUpdate() );
}
catch( final GridAccessException ignored )
{
}
try {
if (this.getProxy().isActive()) {
final IStorageGrid gs = this.getProxy().getStorage();
Platform.postChanges(gs, removed, added, this.mySrc);
}
this.getProxy().getGrid().postEvent(new MENetworkCellArrayUpdate());
} catch (final GridAccessException ignored) {
}
this.markForUpdate();
}
this.markForUpdate();
}
private void updateState()
{
if( !this.isCached )
{
final Collection<IStorageChannel<? extends IAEStack<?>>> storageChannels = AEApi.instance().storage().storageChannels();
storageChannels.forEach( channel -> this.inventoryHandlers.put( channel, new ArrayList<>( 10 ) ) );
private void updateState() {
if (!this.isCached) {
final Collection<IStorageChannel<? extends IAEStack<?>>> storageChannels = AEApi.instance().storage().storageChannels();
storageChannels.forEach(channel -> this.inventoryHandlers.put(channel, new ArrayList<>(10)));
double power = 2.0;
double power = 2.0;
for( int x = 0; x < this.inv.getSlots(); x++ )
{
final ItemStack is = this.inv.getStackInSlot( x );
this.invBySlot[x] = null;
this.handlersBySlot[x] = null;
for (int x = 0; x < this.inv.getSlots(); x++) {
final ItemStack is = this.inv.getStackInSlot(x);
this.invBySlot[x] = null;
this.handlersBySlot[x] = null;
if( !is.isEmpty() )
{
this.handlersBySlot[x] = AEApi.instance().registries().cell().getHandler( is );
if (!is.isEmpty()) {
this.handlersBySlot[x] = AEApi.instance().registries().cell().getHandler(is);
if( this.handlersBySlot[x] != null )
{
for( IStorageChannel<? extends IAEStack<?>> channel : storageChannels )
{
if (this.handlersBySlot[x] != null) {
for (IStorageChannel<? extends IAEStack<?>> channel : storageChannels) {
ICellInventoryHandler cell = this.handlersBySlot[x].getCellInventory( is, this, channel );
ICellInventoryHandler cell = this.handlersBySlot[x].getCellInventory(is, this, channel);
if( cell != null )
{
this.inv.setHandler( x, cell );
power += this.handlersBySlot[x].cellIdleDrain( is, cell );
if (cell != null) {
this.inv.setHandler(x, cell);
power += this.handlersBySlot[x].cellIdleDrain(is, cell);
final DriveWatcher<IAEItemStack> ih = new DriveWatcher( cell, is, this.handlersBySlot[x], this );
ih.setPriority( this.priority );
this.invBySlot[x] = ih;
this.inventoryHandlers.get( channel ).add( ih );
final DriveWatcher<IAEItemStack> ih = new DriveWatcher(cell, is, this.handlersBySlot[x], this);
ih.setPriority(this.priority);
this.invBySlot[x] = ih;
this.inventoryHandlers.get(channel).add(ih);
break;
}
}
}
}
}
break;
}
}
}
}
}
this.getProxy().setIdlePowerUsage( power );
this.getProxy().setIdlePowerUsage(power);
this.isCached = true;
}
}
this.isCached = true;
}
}
@Override
public void onReady()
{
super.onReady();
this.updateState();
}
@Override
public void onReady() {
super.onReady();
this.updateState();
}
@Override
public List<IMEInventoryHandler> getCellArray( final IStorageChannel channel )
{
this.updateState();
return this.inventoryHandlers.get( channel );
}
@Override
public List<IMEInventoryHandler> getCellArray(final IStorageChannel channel) {
this.updateState();
return this.inventoryHandlers.get(channel);
}
@Override
public int getPriority()
{
return this.priority;
}
@Override
public int getPriority() {
return this.priority;
}
@Override
public void setPriority( final int newValue )
{
this.priority = newValue;
this.saveChanges();
@Override
public void setPriority(final int newValue) {
this.priority = newValue;
this.saveChanges();
this.isCached = false; // recalculate the storage cell.
this.updateState();
this.isCached = false; // recalculate the storage cell.
this.updateState();
try
{
this.getProxy().getGrid().postEvent( new MENetworkCellArrayUpdate() );
}
catch( final GridAccessException e )
{
// :P
}
}
try {
this.getProxy().getGrid().postEvent(new MENetworkCellArrayUpdate());
} catch (final GridAccessException e) {
// :P
}
}
@Override
public void blinkCell( final int slot )
{
this.state |= 1 << ( slot * 3 + 2 );
@Override
public void blinkCell(final int slot) {
this.state |= 1 << (slot * 3 + 2);
this.recalculateDisplay();
}
this.recalculateDisplay();
}
@Override
public void saveChanges( final ICellInventory<?> cellInventory )
{
this.world.markChunkDirty( this.pos, this );
}
@Override
public void saveChanges(final ICellInventory<?> cellInventory) {
this.world.markChunkDirty(this.pos, this);
}
private class CellValidInventoryFilter implements IAEItemFilter
{
private class CellValidInventoryFilter implements IAEItemFilter {
@Override
public boolean allowExtract( IItemHandler inv, int slot, int amount )
{
return true;
}
@Override
public boolean allowExtract(IItemHandler inv, int slot, int amount) {
return true;
}
@Override
public boolean allowInsert( IItemHandler inv, int slot, ItemStack stack )
{
return !stack.isEmpty() && AEApi.instance().registries().cell().isCellHandled( stack );
}
@Override
public boolean allowInsert(IItemHandler inv, int slot, ItemStack stack) {
return !stack.isEmpty() && AEApi.instance().registries().cell().isCellHandled(stack);
}
}
}
@Override
public ItemStack getItemStackRepresentation()
{
return AEApi.instance().definitions().blocks().drive().maybeStack( 1 ).orElse( ItemStack.EMPTY );
}
@Override
public ItemStack getItemStackRepresentation() {
return AEApi.instance().definitions().blocks().drive().maybeStack(1).orElse(ItemStack.EMPTY);
}
@Override
public GuiBridge getGuiBridge()
{
return GuiBridge.GUI_DRIVE;
}
@Override
public GuiBridge getGuiBridge() {
return GuiBridge.GUI_DRIVE;
}
}
+384 -479
View File
@@ -19,26 +19,8 @@
package appeng.tile.storage;
import java.util.IdentityHashMap;
import java.util.List;
import java.util.Map;
import net.minecraft.block.Block;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraftforge.items.IItemHandler;
import appeng.api.AEApi;
import appeng.api.config.Actionable;
import appeng.api.config.FullnessMode;
import appeng.api.config.OperationMode;
import appeng.api.config.RedstoneMode;
import appeng.api.config.Settings;
import appeng.api.config.Upgrades;
import appeng.api.config.YesNo;
import appeng.api.config.*;
import appeng.api.implementations.IUpgradeableHost;
import appeng.api.networking.GridFlags;
import appeng.api.networking.IGridNode;
@@ -73,464 +55,387 @@ import appeng.util.inv.InvOperation;
import appeng.util.inv.WrapperChainedItemHandler;
import appeng.util.inv.WrapperFilteredItemHandler;
import appeng.util.inv.filter.AEItemFilters;
public class TileIOPort extends AENetworkInvTile implements IUpgradeableHost, IConfigManagerHost, IGridTickable
{
private static final int NUMBER_OF_CELL_SLOTS = 6;
private static final int NUMBER_OF_UPGRADE_SLOTS = 3;
private final ConfigManager manager;
private final AppEngInternalInventory inputCells = new AppEngInternalInventory( this, NUMBER_OF_CELL_SLOTS );
private final AppEngInternalInventory outputCells = new AppEngInternalInventory( this, NUMBER_OF_CELL_SLOTS );
private final IItemHandler combinedInventory = new WrapperChainedItemHandler( this.inputCells, this.outputCells );
private final IItemHandler inputCellsExt = new WrapperFilteredItemHandler( this.inputCells, AEItemFilters.INSERT_ONLY );
private final IItemHandler outputCellsExt = new WrapperFilteredItemHandler( this.outputCells, AEItemFilters.EXTRACT_ONLY );
private final UpgradeInventory upgrades;
private final IActionSource mySrc;
private YesNo lastRedstoneState;
private ItemStack currentCell;
private Map<IStorageChannel<?>, IMEInventory<?>> cachedInventories;
public TileIOPort()
{
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 );
this.manager.registerSetting( Settings.OPERATION_MODE, OperationMode.EMPTY );
this.mySrc = new MachineSource( this );
this.lastRedstoneState = YesNo.UNDECIDED;
final Block ioPortBlock = AEApi.instance().definitions().blocks().iOPort().maybeBlock().get();
this.upgrades = new BlockUpgradeInventory( ioPortBlock, this, NUMBER_OF_UPGRADE_SLOTS );
}
@Override
public NBTTagCompound writeToNBT( final NBTTagCompound data )
{
super.writeToNBT( data );
this.manager.writeToNBT( data );
this.upgrades.writeToNBT( data, "upgrades" );
data.setInteger( "lastRedstoneState", this.lastRedstoneState.ordinal() );
return data;
}
@Override
public void readFromNBT( final NBTTagCompound data )
{
super.readFromNBT( data );
this.manager.readFromNBT( data );
this.upgrades.readFromNBT( data, "upgrades" );
if( data.hasKey( "lastRedstoneState" ) )
{
this.lastRedstoneState = YesNo.values()[data.getInteger( "lastRedstoneState" )];
}
}
@Override
public AECableType getCableConnectionType( final AEPartLocation dir )
{
return AECableType.SMART;
}
@Override
public DimensionalCoord getLocation()
{
return new DimensionalCoord( this );
}
private void updateTask()
{
try
{
if( this.hasWork() )
{
this.getProxy().getTick().wakeDevice( this.getProxy().getNode() );
}
else
{
this.getProxy().getTick().sleepDevice( this.getProxy().getNode() );
}
}
catch( final GridAccessException e )
{
// :P
}
}
public void updateRedstoneState()
{
final YesNo currentState = this.world.isBlockIndirectlyGettingPowered( this.pos ) != 0 ? YesNo.YES : YesNo.NO;
if( this.lastRedstoneState != currentState )
{
this.lastRedstoneState = currentState;
this.updateTask();
}
}
private boolean getRedstoneState()
{
if( this.lastRedstoneState == YesNo.UNDECIDED )
{
this.updateRedstoneState();
}
return this.lastRedstoneState == YesNo.YES;
}
private boolean isEnabled()
{
if( this.getInstalledUpgrades( Upgrades.REDSTONE ) == 0 )
{
return true;
}
final RedstoneMode rs = (RedstoneMode) this.manager.getSetting( Settings.REDSTONE_CONTROLLED );
if( rs == RedstoneMode.HIGH_SIGNAL )
{
return this.getRedstoneState();
}
return !this.getRedstoneState();
}
@Override
public IConfigManager getConfigManager()
{
return this.manager;
}
@Override
public IItemHandler getInventoryByName( final String name )
{
if( name.equals( "upgrades" ) )
{
return this.upgrades;
}
if( name.equals( "cells" ) )
{
return this.combinedInventory;
}
return null;
}
@Override
public void updateSetting( final IConfigManager manager, final Enum settingName, final Enum newValue )
{
this.updateTask();
}
private boolean hasWork()
{
if( this.isEnabled() )
{
return !ItemHandlerUtil.isEmpty( this.inputCells );
}
return false;
}
@Override
public IItemHandler getInternalInventory()
{
return this.combinedInventory;
}
@Override
public void onChangeInventory( final IItemHandler inv, final int slot, final InvOperation mc, final ItemStack removed, final ItemStack added )
{
if( this.inputCells == inv )
{
this.updateTask();
}
}
@Override
protected IItemHandler getItemHandlerForSide( final EnumFacing facing )
{
if( facing == this.getUp() || facing == this.getUp().getOpposite() )
{
return this.inputCellsExt;
}
else
{
return this.outputCellsExt;
}
}
@Override
public TickingRequest getTickingRequest( final IGridNode node )
{
return new TickingRequest( TickRates.IOPort.getMin(), TickRates.IOPort.getMax(), !this.hasWork(), false );
}
@Override
public TickRateModulation tickingRequest( final IGridNode node, final int ticksSinceLastCall )
{
if( !this.getProxy().isActive() )
{
return TickRateModulation.IDLE;
}
TickRateModulation ret = TickRateModulation.SLEEP;
long itemsToMove = 256;
switch( this.getInstalledUpgrades( Upgrades.SPEED ) )
{
case 1:
itemsToMove *= 2;
break;
case 2:
itemsToMove *= 4;
break;
case 3:
itemsToMove *= 8;
break;
}
try
{
final IEnergySource energy = this.getProxy().getEnergy();
for( int x = 0; x < NUMBER_OF_CELL_SLOTS; x++ )
{
final ItemStack is = this.inputCells.getStackInSlot( x );
if( !is.isEmpty() )
{
boolean shouldMove = true;
for( IStorageChannel<? extends IAEStack<?>> c : AEApi.instance().storage().storageChannels() )
{
if( itemsToMove > 0 )
{
final IMEMonitor<? extends IAEStack<?>> network = this.getProxy().getStorage().getInventory( c );
final IMEInventory<?> inv = this.getInv( is, c );
if( inv == null )
{
continue;
}
if( this.manager.getSetting( Settings.OPERATION_MODE ) == OperationMode.EMPTY )
{
itemsToMove = this.transferContents( energy, inv, network, itemsToMove, c );
}
else
{
itemsToMove = this.transferContents( energy, network, inv, itemsToMove, c );
}
shouldMove &= this.shouldMove( inv );
if( itemsToMove > 0 )
{
ret = TickRateModulation.IDLE;
}
else
{
ret = TickRateModulation.URGENT;
}
}
}
if( itemsToMove > 0 && shouldMove && this.moveSlot( x ) )
{
ret = TickRateModulation.URGENT;
}
else
{
ret = TickRateModulation.URGENT;
}
}
}
}
catch( final GridAccessException e )
{
ret = TickRateModulation.IDLE;
}
return ret;
}
@Override
public int getInstalledUpgrades( final Upgrades u )
{
return this.upgrades.getInstalledUpgrades( u );
}
private IMEInventory<?> getInv( final ItemStack is, final IStorageChannel<?> chan )
{
if( this.currentCell != is )
{
this.currentCell = is;
this.cachedInventories = new IdentityHashMap<>();
for( IStorageChannel<? extends IAEStack<?>> c : AEApi.instance().storage().storageChannels() )
{
this.cachedInventories.put( c, AEApi.instance().registries().cell().getCellInventory( is, null, c ) );
}
}
return this.cachedInventories.get( chan );
}
private long transferContents( final IEnergySource energy, final IMEInventory src, final IMEInventory destination, long itemsToMove, final IStorageChannel chan )
{
final IItemList<? extends IAEStack> myList;
if( src instanceof IMEMonitor )
{
myList = ( (IMEMonitor) src ).getStorageList();
}
else
{
myList = src.getAvailableItems( src.getChannel().createList() );
}
itemsToMove *= chan.transferFactor();
boolean didStuff;
do
{
didStuff = false;
for( final IAEStack s : myList )
{
final long totalStackSize = s.getStackSize();
if( totalStackSize > 0 )
{
final IAEStack stack = destination.injectItems( s, Actionable.SIMULATE, this.mySrc );
long possible = 0;
if( stack == null )
{
possible = totalStackSize;
}
else
{
possible = totalStackSize - stack.getStackSize();
}
if( possible > 0 )
{
IAEStack injectable = s.copy();
possible = Math.min( possible, itemsToMove );
injectable.setStackSize( possible );
final IAEStack extracted = src.extractItems( injectable, Actionable.MODULATE, this.mySrc );
if( extracted != null )
{
possible = extracted.getStackSize();
extracted.setCraftable( false );
final IAEStack failed = Platform.poweredInsert( energy, destination, extracted, this.mySrc );
if( failed != null )
{
possible -= failed.getStackSize();
src.injectItems( failed, Actionable.MODULATE, this.mySrc );
}
if( possible > 0 )
{
itemsToMove -= possible;
didStuff = true;
}
break;
}
}
}
}
}
while( itemsToMove > 0 && didStuff );
return itemsToMove / chan.transferFactor();
}
private boolean shouldMove( final IMEInventory<?> inv )
{
final FullnessMode fm = (FullnessMode) this.manager.getSetting( Settings.FULLNESS_MODE );
if( inv != null )
{
return this.matches( fm, inv );
}
return true;
}
private boolean moveSlot( final int x )
{
final InventoryAdaptor ad = new AdaptorItemHandler( this.outputCells );
if( ad.addItems( this.inputCells.getStackInSlot( x ) ).isEmpty() )
{
this.inputCells.setStackInSlot( x, ItemStack.EMPTY );
return true;
}
return false;
}
private boolean matches( final FullnessMode fm, final IMEInventory src )
{
if( fm == FullnessMode.HALF )
{
return true;
}
final IItemList<? extends IAEStack> myList;
if( src instanceof IMEMonitor )
{
myList = ( (IMEMonitor) src ).getStorageList();
}
else
{
myList = src.getAvailableItems( src.getChannel().createList() );
}
if( fm == FullnessMode.EMPTY )
{
return myList.isEmpty();
}
final IAEStack test = myList.getFirstItem();
if( test != null )
{
IAEStack testCopy = test.copy();
testCopy.setStackSize( 1 );
return src.injectItems( testCopy, Actionable.SIMULATE, this.mySrc ) != null;
}
return false;
}
/**
* 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 drops drops of tile entity
*/
@Override
public void getDrops( final World w, final BlockPos pos, final List<ItemStack> drops )
{
super.getDrops( w, pos, drops );
for( int upgradeIndex = 0; upgradeIndex < this.upgrades.getSlots(); upgradeIndex++ )
{
final ItemStack stackInSlot = this.upgrades.getStackInSlot( upgradeIndex );
if( !stackInSlot.isEmpty() )
{
drops.add( stackInSlot );
}
}
}
import net.minecraft.block.Block;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraftforge.items.IItemHandler;
import java.util.IdentityHashMap;
import java.util.List;
import java.util.Map;
public class TileIOPort extends AENetworkInvTile implements IUpgradeableHost, IConfigManagerHost, IGridTickable {
private static final int NUMBER_OF_CELL_SLOTS = 6;
private static final int NUMBER_OF_UPGRADE_SLOTS = 3;
private final ConfigManager manager;
private final AppEngInternalInventory inputCells = new AppEngInternalInventory(this, NUMBER_OF_CELL_SLOTS);
private final AppEngInternalInventory outputCells = new AppEngInternalInventory(this, NUMBER_OF_CELL_SLOTS);
private final IItemHandler combinedInventory = new WrapperChainedItemHandler(this.inputCells, this.outputCells);
private final IItemHandler inputCellsExt = new WrapperFilteredItemHandler(this.inputCells, AEItemFilters.INSERT_ONLY);
private final IItemHandler outputCellsExt = new WrapperFilteredItemHandler(this.outputCells, AEItemFilters.EXTRACT_ONLY);
private final UpgradeInventory upgrades;
private final IActionSource mySrc;
private YesNo lastRedstoneState;
private ItemStack currentCell;
private Map<IStorageChannel<?>, IMEInventory<?>> cachedInventories;
public TileIOPort() {
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);
this.manager.registerSetting(Settings.OPERATION_MODE, OperationMode.EMPTY);
this.mySrc = new MachineSource(this);
this.lastRedstoneState = YesNo.UNDECIDED;
final Block ioPortBlock = AEApi.instance().definitions().blocks().iOPort().maybeBlock().get();
this.upgrades = new BlockUpgradeInventory(ioPortBlock, this, NUMBER_OF_UPGRADE_SLOTS);
}
@Override
public NBTTagCompound writeToNBT(final NBTTagCompound data) {
super.writeToNBT(data);
this.manager.writeToNBT(data);
this.upgrades.writeToNBT(data, "upgrades");
data.setInteger("lastRedstoneState", this.lastRedstoneState.ordinal());
return data;
}
@Override
public void readFromNBT(final NBTTagCompound data) {
super.readFromNBT(data);
this.manager.readFromNBT(data);
this.upgrades.readFromNBT(data, "upgrades");
if (data.hasKey("lastRedstoneState")) {
this.lastRedstoneState = YesNo.values()[data.getInteger("lastRedstoneState")];
}
}
@Override
public AECableType getCableConnectionType(final AEPartLocation dir) {
return AECableType.SMART;
}
@Override
public DimensionalCoord getLocation() {
return new DimensionalCoord(this);
}
private void updateTask() {
try {
if (this.hasWork()) {
this.getProxy().getTick().wakeDevice(this.getProxy().getNode());
} else {
this.getProxy().getTick().sleepDevice(this.getProxy().getNode());
}
} catch (final GridAccessException e) {
// :P
}
}
public void updateRedstoneState() {
final YesNo currentState = this.world.isBlockIndirectlyGettingPowered(this.pos) != 0 ? YesNo.YES : YesNo.NO;
if (this.lastRedstoneState != currentState) {
this.lastRedstoneState = currentState;
this.updateTask();
}
}
private boolean getRedstoneState() {
if (this.lastRedstoneState == YesNo.UNDECIDED) {
this.updateRedstoneState();
}
return this.lastRedstoneState == YesNo.YES;
}
private boolean isEnabled() {
if (this.getInstalledUpgrades(Upgrades.REDSTONE) == 0) {
return true;
}
final RedstoneMode rs = (RedstoneMode) this.manager.getSetting(Settings.REDSTONE_CONTROLLED);
if (rs == RedstoneMode.HIGH_SIGNAL) {
return this.getRedstoneState();
}
return !this.getRedstoneState();
}
@Override
public IConfigManager getConfigManager() {
return this.manager;
}
@Override
public IItemHandler getInventoryByName(final String name) {
if (name.equals("upgrades")) {
return this.upgrades;
}
if (name.equals("cells")) {
return this.combinedInventory;
}
return null;
}
@Override
public void updateSetting(final IConfigManager manager, final Enum settingName, final Enum newValue) {
this.updateTask();
}
private boolean hasWork() {
if (this.isEnabled()) {
return !ItemHandlerUtil.isEmpty(this.inputCells);
}
return false;
}
@Override
public IItemHandler getInternalInventory() {
return this.combinedInventory;
}
@Override
public void onChangeInventory(final IItemHandler inv, final int slot, final InvOperation mc, final ItemStack removed, final ItemStack added) {
if (this.inputCells == inv) {
this.updateTask();
}
}
@Override
protected IItemHandler getItemHandlerForSide(final EnumFacing facing) {
if (facing == this.getUp() || facing == this.getUp().getOpposite()) {
return this.inputCellsExt;
} else {
return this.outputCellsExt;
}
}
@Override
public TickingRequest getTickingRequest(final IGridNode node) {
return new TickingRequest(TickRates.IOPort.getMin(), TickRates.IOPort.getMax(), !this.hasWork(), false);
}
@Override
public TickRateModulation tickingRequest(final IGridNode node, final int ticksSinceLastCall) {
if (!this.getProxy().isActive()) {
return TickRateModulation.IDLE;
}
TickRateModulation ret = TickRateModulation.SLEEP;
long itemsToMove = 256;
switch (this.getInstalledUpgrades(Upgrades.SPEED)) {
case 1:
itemsToMove *= 2;
break;
case 2:
itemsToMove *= 4;
break;
case 3:
itemsToMove *= 8;
break;
}
try {
final IEnergySource energy = this.getProxy().getEnergy();
for (int x = 0; x < NUMBER_OF_CELL_SLOTS; x++) {
final ItemStack is = this.inputCells.getStackInSlot(x);
if (!is.isEmpty()) {
boolean shouldMove = true;
for (IStorageChannel<? extends IAEStack<?>> c : AEApi.instance().storage().storageChannels()) {
if (itemsToMove > 0) {
final IMEMonitor<? extends IAEStack<?>> network = this.getProxy().getStorage().getInventory(c);
final IMEInventory<?> inv = this.getInv(is, c);
if (inv == null) {
continue;
}
if (this.manager.getSetting(Settings.OPERATION_MODE) == OperationMode.EMPTY) {
itemsToMove = this.transferContents(energy, inv, network, itemsToMove, c);
} else {
itemsToMove = this.transferContents(energy, network, inv, itemsToMove, c);
}
shouldMove &= this.shouldMove(inv);
if (itemsToMove > 0) {
ret = TickRateModulation.IDLE;
} else {
ret = TickRateModulation.URGENT;
}
}
}
if (itemsToMove > 0 && shouldMove && this.moveSlot(x)) {
ret = TickRateModulation.URGENT;
} else {
ret = TickRateModulation.URGENT;
}
}
}
} catch (final GridAccessException e) {
ret = TickRateModulation.IDLE;
}
return ret;
}
@Override
public int getInstalledUpgrades(final Upgrades u) {
return this.upgrades.getInstalledUpgrades(u);
}
private IMEInventory<?> getInv(final ItemStack is, final IStorageChannel<?> chan) {
if (this.currentCell != is) {
this.currentCell = is;
this.cachedInventories = new IdentityHashMap<>();
for (IStorageChannel<? extends IAEStack<?>> c : AEApi.instance().storage().storageChannels()) {
this.cachedInventories.put(c, AEApi.instance().registries().cell().getCellInventory(is, null, c));
}
}
return this.cachedInventories.get(chan);
}
private long transferContents(final IEnergySource energy, final IMEInventory src, final IMEInventory destination, long itemsToMove, final IStorageChannel chan) {
final IItemList<? extends IAEStack> myList;
if (src instanceof IMEMonitor) {
myList = ((IMEMonitor) src).getStorageList();
} else {
myList = src.getAvailableItems(src.getChannel().createList());
}
itemsToMove *= chan.transferFactor();
boolean didStuff;
do {
didStuff = false;
for (final IAEStack s : myList) {
final long totalStackSize = s.getStackSize();
if (totalStackSize > 0) {
final IAEStack stack = destination.injectItems(s, Actionable.SIMULATE, this.mySrc);
long possible = 0;
if (stack == null) {
possible = totalStackSize;
} else {
possible = totalStackSize - stack.getStackSize();
}
if (possible > 0) {
IAEStack injectable = s.copy();
possible = Math.min(possible, itemsToMove);
injectable.setStackSize(possible);
final IAEStack extracted = src.extractItems(injectable, Actionable.MODULATE, this.mySrc);
if (extracted != null) {
possible = extracted.getStackSize();
extracted.setCraftable(false);
final IAEStack failed = Platform.poweredInsert(energy, destination, extracted, this.mySrc);
if (failed != null) {
possible -= failed.getStackSize();
src.injectItems(failed, Actionable.MODULATE, this.mySrc);
}
if (possible > 0) {
itemsToMove -= possible;
didStuff = true;
}
break;
}
}
}
}
}
while (itemsToMove > 0 && didStuff);
return itemsToMove / chan.transferFactor();
}
private boolean shouldMove(final IMEInventory<?> inv) {
final FullnessMode fm = (FullnessMode) this.manager.getSetting(Settings.FULLNESS_MODE);
if (inv != null) {
return this.matches(fm, inv);
}
return true;
}
private boolean moveSlot(final int x) {
final InventoryAdaptor ad = new AdaptorItemHandler(this.outputCells);
if (ad.addItems(this.inputCells.getStackInSlot(x)).isEmpty()) {
this.inputCells.setStackInSlot(x, ItemStack.EMPTY);
return true;
}
return false;
}
private boolean matches(final FullnessMode fm, final IMEInventory src) {
if (fm == FullnessMode.HALF) {
return true;
}
final IItemList<? extends IAEStack> myList;
if (src instanceof IMEMonitor) {
myList = ((IMEMonitor) src).getStorageList();
} else {
myList = src.getAvailableItems(src.getChannel().createList());
}
if (fm == FullnessMode.EMPTY) {
return myList.isEmpty();
}
final IAEStack test = myList.getFirstItem();
if (test != null) {
IAEStack testCopy = test.copy();
testCopy.setStackSize(1);
return src.injectItems(testCopy, Actionable.SIMULATE, this.mySrc) != null;
}
return false;
}
/**
* 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 drops drops of tile entity
*/
@Override
public void getDrops(final World w, final BlockPos pos, final List<ItemStack> drops) {
super.getDrops(w, pos, drops);
for (int upgradeIndex = 0; upgradeIndex < this.upgrades.getSlots(); upgradeIndex++) {
final ItemStack stackInSlot = this.upgrades.getStackInSlot(upgradeIndex);
if (!stackInSlot.isEmpty()) {
drops.add(stackInSlot);
}
}
}
}
@@ -19,10 +19,10 @@
package appeng.tile.storage;
import java.io.IOException;
import appeng.tile.AEBaseInvTile;
import appeng.tile.inventory.AppEngInternalInventory;
import appeng.util.inv.InvOperation;
import io.netty.buffer.ByteBuf;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.SoundEvents;
import net.minecraft.item.ItemStack;
@@ -30,185 +30,153 @@ import net.minecraft.util.ITickable;
import net.minecraft.util.SoundCategory;
import net.minecraftforge.items.IItemHandler;
import appeng.tile.AEBaseInvTile;
import appeng.tile.inventory.AppEngInternalInventory;
import appeng.util.inv.InvOperation;
import java.io.IOException;
public class TileSkyChest extends AEBaseInvTile implements ITickable
{
public class TileSkyChest extends AEBaseInvTile implements ITickable {
private final AppEngInternalInventory inv = new AppEngInternalInventory( this, 9 * 4 );
// server
private int numPlayersUsing;
// client..
private long lastEvent;
private float lidAngle;
private float prevLidAngle;
private final AppEngInternalInventory inv = new AppEngInternalInventory(this, 9 * 4);
// server
private int numPlayersUsing;
// client..
private long lastEvent;
private float lidAngle;
private float prevLidAngle;
@Override
protected void writeToStream( final ByteBuf data ) throws IOException
{
super.writeToStream( data );
data.writeBoolean( this.getPlayerOpen() > 0 );
}
@Override
protected void writeToStream(final ByteBuf data) throws IOException {
super.writeToStream(data);
data.writeBoolean(this.getPlayerOpen() > 0);
}
@Override
protected boolean readFromStream( final ByteBuf data ) throws IOException
{
final boolean c = super.readFromStream( data );
final int wasOpen = this.getPlayerOpen();
this.setPlayerOpen( data.readBoolean() ? 1 : 0 );
@Override
protected boolean readFromStream(final ByteBuf data) throws IOException {
final boolean c = super.readFromStream(data);
final int wasOpen = this.getPlayerOpen();
this.setPlayerOpen(data.readBoolean() ? 1 : 0);
if( wasOpen != this.getPlayerOpen() )
{
this.setLastEvent( System.currentTimeMillis() );
}
if (wasOpen != this.getPlayerOpen()) {
this.setLastEvent(System.currentTimeMillis());
}
return c; // TESR yo!
}
return c; // TESR yo!
}
@Override
public boolean requiresTESR()
{
return true;
}
@Override
public boolean requiresTESR() {
return true;
}
@Override
public boolean canRenderBreaking()
{
return true;
}
@Override
public boolean canRenderBreaking() {
return true;
}
@Override
public IItemHandler getInternalInventory()
{
return this.inv;
}
@Override
public IItemHandler getInternalInventory() {
return this.inv;
}
public void openInventory( final EntityPlayer player )
{
if( !player.isSpectator() )
{
this.setPlayerOpen( this.getPlayerOpen() + 1 );
this.world.addBlockEvent( this.pos, this.getBlockType(), 1, this.numPlayersUsing );
this.world.notifyNeighborsOfStateChange( this.pos, this.getBlockType(), true );
this.world.notifyNeighborsOfStateChange( this.pos.down(), this.getBlockType(), true );
public void openInventory(final EntityPlayer player) {
if (!player.isSpectator()) {
this.setPlayerOpen(this.getPlayerOpen() + 1);
this.world.addBlockEvent(this.pos, this.getBlockType(), 1, this.numPlayersUsing);
this.world.notifyNeighborsOfStateChange(this.pos, this.getBlockType(), true);
this.world.notifyNeighborsOfStateChange(this.pos.down(), this.getBlockType(), true);
if( this.getPlayerOpen() == 1 )
{
this.getWorld()
.playSound( player, this.pos.getX() + 0.5D, this.pos.getY() + 0.5D, this.pos.getZ() + 0.5D, SoundEvents.BLOCK_CHEST_OPEN,
SoundCategory.BLOCKS, 0.5F, this.getWorld().rand.nextFloat() * 0.1F + 0.9F );
this.markForUpdate();
}
}
}
if (this.getPlayerOpen() == 1) {
this.getWorld()
.playSound(player, this.pos.getX() + 0.5D, this.pos.getY() + 0.5D, this.pos.getZ() + 0.5D, SoundEvents.BLOCK_CHEST_OPEN,
SoundCategory.BLOCKS, 0.5F, this.getWorld().rand.nextFloat() * 0.1F + 0.9F);
this.markForUpdate();
}
}
}
public void closeInventory( final EntityPlayer player )
{
if( !player.isSpectator() )
{
this.setPlayerOpen( this.getPlayerOpen() - 1 );
this.world.addBlockEvent( this.pos, this.getBlockType(), 1, this.numPlayersUsing );
this.world.notifyNeighborsOfStateChange( this.pos, this.getBlockType(), true );
this.world.notifyNeighborsOfStateChange( this.pos.down(), this.getBlockType(), true );
public void closeInventory(final EntityPlayer player) {
if (!player.isSpectator()) {
this.setPlayerOpen(this.getPlayerOpen() - 1);
this.world.addBlockEvent(this.pos, this.getBlockType(), 1, this.numPlayersUsing);
this.world.notifyNeighborsOfStateChange(this.pos, this.getBlockType(), true);
this.world.notifyNeighborsOfStateChange(this.pos.down(), this.getBlockType(), true);
if( this.getPlayerOpen() < 0 )
{
this.setPlayerOpen( 0 );
}
if (this.getPlayerOpen() < 0) {
this.setPlayerOpen(0);
}
if( this.getPlayerOpen() == 0 )
{
this.getWorld()
.playSound( player, this.pos.getX() + 0.5D, this.pos.getY() + 0.5D, this.pos.getZ() + 0.5D, SoundEvents.BLOCK_CHEST_CLOSE,
SoundCategory.BLOCKS, 0.5F, this.getWorld().rand.nextFloat() * 0.1F + 0.9F );
this.markForUpdate();
}
}
}
if (this.getPlayerOpen() == 0) {
this.getWorld()
.playSound(player, this.pos.getX() + 0.5D, this.pos.getY() + 0.5D, this.pos.getZ() + 0.5D, SoundEvents.BLOCK_CHEST_CLOSE,
SoundCategory.BLOCKS, 0.5F, this.getWorld().rand.nextFloat() * 0.1F + 0.9F);
this.markForUpdate();
}
}
}
@Override
public void update()
{
int i = this.pos.getX();
int j = this.pos.getY();
int k = this.pos.getZ();
@Override
public void update() {
int i = this.pos.getX();
int j = this.pos.getY();
int k = this.pos.getZ();
this.prevLidAngle = this.lidAngle;
float f1 = 0.1F;
this.prevLidAngle = this.lidAngle;
float f1 = 0.1F;
if( this.numPlayersUsing == 0 && this.lidAngle > 0.0F || this.numPlayersUsing > 0 && this.lidAngle < 1.0F )
{
float f2 = this.lidAngle;
if (this.numPlayersUsing == 0 && this.lidAngle > 0.0F || this.numPlayersUsing > 0 && this.lidAngle < 1.0F) {
float f2 = this.lidAngle;
if( this.numPlayersUsing > 0 )
{
this.lidAngle += 0.1F;
}
else
{
this.lidAngle -= 0.1F;
}
if (this.numPlayersUsing > 0) {
this.lidAngle += 0.1F;
} else {
this.lidAngle -= 0.1F;
}
if( this.lidAngle > 1.0F )
{
this.lidAngle = 1.0F;
}
if (this.lidAngle > 1.0F) {
this.lidAngle = 1.0F;
}
float f3 = 0.5F;
float f3 = 0.5F;
if( this.lidAngle < 0.0F )
{
this.lidAngle = 0.0F;
}
}
}
if (this.lidAngle < 0.0F) {
this.lidAngle = 0.0F;
}
}
}
@Override
public void onChangeInventory( final IItemHandler inv, final int slot, final InvOperation mc, final ItemStack removed, final ItemStack added )
{
@Override
public void onChangeInventory(final IItemHandler inv, final int slot, final InvOperation mc, final ItemStack removed, final ItemStack added) {
}
}
public float getLidAngle()
{
return this.lidAngle;
}
public float getLidAngle() {
return this.lidAngle;
}
public void setLidAngle( final float lidAngle )
{
this.lidAngle = lidAngle;
}
public void setLidAngle(final float lidAngle) {
this.lidAngle = lidAngle;
}
public float getPrevLidAngle()
{
return this.prevLidAngle;
}
public float getPrevLidAngle() {
return this.prevLidAngle;
}
public void setPrevLidAngle( float prevLidAngle )
{
this.prevLidAngle = prevLidAngle;
}
public void setPrevLidAngle(float prevLidAngle) {
this.prevLidAngle = prevLidAngle;
}
public int getPlayerOpen()
{
return this.numPlayersUsing;
}
public int getPlayerOpen() {
return this.numPlayersUsing;
}
private void setPlayerOpen( final int playerOpen )
{
this.numPlayersUsing = playerOpen;
}
private void setPlayerOpen(final int playerOpen) {
this.numPlayersUsing = playerOpen;
}
public long getLastEvent()
{
return this.lastEvent;
}
public long getLastEvent() {
return this.lastEvent;
}
private void setLastEvent( final long lastEvent )
{
this.lastEvent = lastEvent;
}
private void setLastEvent(final long lastEvent) {
this.lastEvent = lastEvent;
}
}