Changed access to use this qualifier
This commit is contained in:
@@ -115,28 +115,28 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
|
||||
@Override
|
||||
public int getInstalledUpgrades(Upgrades u)
|
||||
{
|
||||
if ( upgrades == null )
|
||||
if ( this.upgrades == null )
|
||||
return 0;
|
||||
return upgrades.getInstalledUpgrades( u );
|
||||
return this.upgrades.getInstalledUpgrades( u );
|
||||
}
|
||||
|
||||
public boolean hasItemsToSend()
|
||||
{
|
||||
return waitingToSend != null && !waitingToSend.isEmpty();
|
||||
return this.waitingToSend != null && !this.waitingToSend.isEmpty();
|
||||
}
|
||||
|
||||
public void updateCraftingList()
|
||||
{
|
||||
Boolean accountedFor[] = new Boolean[] { false, false, false, false, false, false, false, false, false }; // 9...
|
||||
|
||||
assert (accountedFor.length == patterns.getSizeInventory());
|
||||
assert (accountedFor.length == this.patterns.getSizeInventory());
|
||||
|
||||
if ( !gridProxy.isReady() )
|
||||
if ( !this.gridProxy.isReady() )
|
||||
return;
|
||||
|
||||
if ( craftingList != null )
|
||||
if ( this.craftingList != null )
|
||||
{
|
||||
Iterator<ICraftingPatternDetails> i = craftingList.iterator();
|
||||
Iterator<ICraftingPatternDetails> i = this.craftingList.iterator();
|
||||
while (i.hasNext())
|
||||
{
|
||||
ICraftingPatternDetails details = i.next();
|
||||
@@ -144,7 +144,7 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
|
||||
|
||||
for (int x = 0; x < accountedFor.length; x++)
|
||||
{
|
||||
ItemStack is = patterns.getStackInSlot( x );
|
||||
ItemStack is = this.patterns.getStackInSlot( x );
|
||||
if ( details.getPattern() == is )
|
||||
{
|
||||
accountedFor[x] = found = true;
|
||||
@@ -159,12 +159,12 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
|
||||
for (int x = 0; x < accountedFor.length; x++)
|
||||
{
|
||||
if ( !accountedFor[x] )
|
||||
addToCraftingList( patterns.getStackInSlot( x ) );
|
||||
this.addToCraftingList( this.patterns.getStackInSlot( x ) );
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
gridProxy.getGrid().postEvent( new MENetworkCraftingPatternChange( this, gridProxy.getNode() ) );
|
||||
this.gridProxy.getGrid().postEvent( new MENetworkCraftingPatternChange( this, this.gridProxy.getNode() ) );
|
||||
}
|
||||
catch (GridAccessException e)
|
||||
{
|
||||
@@ -180,14 +180,14 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
|
||||
if ( is.getItem() instanceof ICraftingPatternItem )
|
||||
{
|
||||
ICraftingPatternItem cpi = (ICraftingPatternItem) is.getItem();
|
||||
ICraftingPatternDetails details = cpi.getPatternForItem( is, iHost.getTileEntity().getWorldObj() );
|
||||
ICraftingPatternDetails details = cpi.getPatternForItem( is, this.iHost.getTileEntity().getWorldObj() );
|
||||
|
||||
if ( details != null )
|
||||
{
|
||||
if ( craftingList == null )
|
||||
craftingList = new LinkedList<ICraftingPatternDetails>();
|
||||
if ( this.craftingList == null )
|
||||
this.craftingList = new LinkedList<ICraftingPatternDetails>();
|
||||
|
||||
craftingList.add( details );
|
||||
this.craftingList.add( details );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -197,14 +197,14 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
|
||||
if ( is == null )
|
||||
return;
|
||||
|
||||
if ( waitingToSend == null )
|
||||
waitingToSend = new LinkedList<ItemStack>();
|
||||
if ( this.waitingToSend == null )
|
||||
this.waitingToSend = new LinkedList<ItemStack>();
|
||||
|
||||
waitingToSend.add( is );
|
||||
this.waitingToSend.add( is );
|
||||
|
||||
try
|
||||
{
|
||||
gridProxy.getTick().wakeDevice( gridProxy.getNode() );
|
||||
this.gridProxy.getTick().wakeDevice( this.gridProxy.getNode() );
|
||||
}
|
||||
catch (GridAccessException e)
|
||||
{
|
||||
@@ -213,52 +213,52 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
|
||||
}
|
||||
|
||||
public DualityInterface(AENetworkProxy networkProxy, IInterfaceHost ih) {
|
||||
gridProxy = networkProxy;
|
||||
gridProxy.setFlags( GridFlags.REQUIRE_CHANNEL );
|
||||
this.gridProxy = networkProxy;
|
||||
this.gridProxy.setFlags( GridFlags.REQUIRE_CHANNEL );
|
||||
|
||||
upgrades = new UpgradeInventory( gridProxy.getMachineRepresentation(), this, 1 );
|
||||
cm.registerSetting( Settings.BLOCK, YesNo.NO );
|
||||
cm.registerSetting( Settings.INTERFACE_TERMINAL, YesNo.YES );
|
||||
this.upgrades = new UpgradeInventory( this.gridProxy.getMachineRepresentation(), this, 1 );
|
||||
this.cm.registerSetting( Settings.BLOCK, YesNo.NO );
|
||||
this.cm.registerSetting( Settings.INTERFACE_TERMINAL, YesNo.YES );
|
||||
|
||||
iHost = ih;
|
||||
craftingTracker = new MultiCraftingTracker( iHost, 9 );
|
||||
mySrc = fluids.changeSource = items.changeSource = new MachineSource( iHost );
|
||||
this.iHost = ih;
|
||||
this.craftingTracker = new MultiCraftingTracker( this.iHost, 9 );
|
||||
this.mySrc = this.fluids.changeSource = this.items.changeSource = new MachineSource( this.iHost );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void saveChanges()
|
||||
{
|
||||
iHost.saveChanges();
|
||||
this.iHost.saveChanges();
|
||||
}
|
||||
|
||||
private void readConfig()
|
||||
{
|
||||
hasConfig = false;
|
||||
this.hasConfig = false;
|
||||
|
||||
for (ItemStack p : config)
|
||||
for (ItemStack p : this.config)
|
||||
{
|
||||
if ( p != null )
|
||||
{
|
||||
hasConfig = true;
|
||||
this.hasConfig = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
boolean had = hasWorkToDo();
|
||||
boolean had = this.hasWorkToDo();
|
||||
|
||||
for (int x = 0; x < 8; x++)
|
||||
updatePlan( x );
|
||||
this.updatePlan( x );
|
||||
|
||||
boolean has = hasWorkToDo();
|
||||
boolean has = this.hasWorkToDo();
|
||||
|
||||
if ( had != has )
|
||||
{
|
||||
try
|
||||
{
|
||||
if ( has )
|
||||
gridProxy.getTick().alertDevice( gridProxy.getNode() );
|
||||
this.gridProxy.getTick().alertDevice( this.gridProxy.getNode() );
|
||||
else
|
||||
gridProxy.getTick().sleepDevice( gridProxy.getNode() );
|
||||
this.gridProxy.getTick().sleepDevice( this.gridProxy.getNode() );
|
||||
}
|
||||
catch (GridAccessException e)
|
||||
{
|
||||
@@ -266,18 +266,18 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
|
||||
}
|
||||
}
|
||||
|
||||
notifyNeighbors();
|
||||
this.notifyNeighbors();
|
||||
}
|
||||
|
||||
public void writeToNBT(NBTTagCompound data)
|
||||
{
|
||||
config.writeToNBT( data, "config" );
|
||||
patterns.writeToNBT( data, "patterns" );
|
||||
storage.writeToNBT( data, "storage" );
|
||||
upgrades.writeToNBT( data, "upgrades" );
|
||||
cm.writeToNBT( data );
|
||||
craftingTracker.writeToNBT( data );
|
||||
data.setInteger( "priority", priority );
|
||||
this.config.writeToNBT( data, "config" );
|
||||
this.patterns.writeToNBT( data, "patterns" );
|
||||
this.storage.writeToNBT( data, "storage" );
|
||||
this.upgrades.writeToNBT( data, "upgrades" );
|
||||
this.cm.writeToNBT( data );
|
||||
this.craftingTracker.writeToNBT( data );
|
||||
data.setInteger( "priority", this.priority );
|
||||
|
||||
NBTTagList waitingToSend = new NBTTagList();
|
||||
if ( this.waitingToSend != null )
|
||||
@@ -304,31 +304,31 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
|
||||
if ( c != null )
|
||||
{
|
||||
ItemStack is = ItemStack.loadItemStackFromNBT( c );
|
||||
addToSendList( is );
|
||||
this.addToSendList( is );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
craftingTracker.readFromNBT( data );
|
||||
upgrades.readFromNBT( data, "upgrades" );
|
||||
config.readFromNBT( data, "config" );
|
||||
patterns.readFromNBT( data, "patterns" );
|
||||
storage.readFromNBT( data, "storage" );
|
||||
priority = data.getInteger( "priority" );
|
||||
cm.readFromNBT( data );
|
||||
readConfig();
|
||||
updateCraftingList();
|
||||
this.craftingTracker.readFromNBT( data );
|
||||
this.upgrades.readFromNBT( data, "upgrades" );
|
||||
this.config.readFromNBT( data, "config" );
|
||||
this.patterns.readFromNBT( data, "patterns" );
|
||||
this.storage.readFromNBT( data, "storage" );
|
||||
this.priority = data.getInteger( "priority" );
|
||||
this.cm.readFromNBT( data );
|
||||
this.readConfig();
|
||||
this.updateCraftingList();
|
||||
}
|
||||
|
||||
final AppEngInternalAEInventory config = new AppEngInternalAEInventory( this, 8 );
|
||||
final AppEngInternalInventory storage = new AppEngInternalInventory( this, 8 );
|
||||
final AppEngInternalInventory patterns = new AppEngInternalInventory( this, 9 );
|
||||
|
||||
final WrapperInvSlot slotInv = new WrapperInvSlot( storage );
|
||||
final WrapperInvSlot slotInv = new WrapperInvSlot( this.storage );
|
||||
|
||||
private InventoryAdaptor getAdaptor(int slot)
|
||||
{
|
||||
return new AdaptorIInventory( slotInv.getWrapper( slot ) );
|
||||
return new AdaptorIInventory( this.slotInv.getWrapper( slot ) );
|
||||
}
|
||||
|
||||
IMEInventory<IAEItemStack> destination;
|
||||
@@ -337,7 +337,7 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
|
||||
@Override
|
||||
public boolean canInsert(ItemStack stack)
|
||||
{
|
||||
IAEItemStack out = destination.injectItems( AEApi.instance().storage().createItemStack( stack ), Actionable.SIMULATE, null );
|
||||
IAEItemStack out = this.destination.injectItems( AEApi.instance().storage().createItemStack( stack ), Actionable.SIMULATE, null );
|
||||
if ( out == null )
|
||||
return true;
|
||||
return out.getStackSize() != stack.stackSize;
|
||||
@@ -349,48 +349,48 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
|
||||
|
||||
private void updatePlan(int slot)
|
||||
{
|
||||
IAEItemStack req = config.getAEStackInSlot( slot );
|
||||
IAEItemStack req = this.config.getAEStackInSlot( slot );
|
||||
if ( req != null && req.getStackSize() <= 0 )
|
||||
{
|
||||
config.setInventorySlotContents( slot, null );
|
||||
this.config.setInventorySlotContents( slot, null );
|
||||
req = null;
|
||||
}
|
||||
|
||||
ItemStack Stored = storage.getStackInSlot( slot );
|
||||
ItemStack Stored = this.storage.getStackInSlot( slot );
|
||||
|
||||
if ( req == null && Stored != null )
|
||||
{
|
||||
IAEItemStack work = AEApi.instance().storage().createItemStack( Stored );
|
||||
requireWork[slot] = work.setStackSize( -work.getStackSize() );
|
||||
this.requireWork[slot] = work.setStackSize( -work.getStackSize() );
|
||||
return;
|
||||
}
|
||||
else if ( req != null )
|
||||
{
|
||||
if ( Stored == null ) // need to add stuff!
|
||||
{
|
||||
requireWork[slot] = req.copy();
|
||||
this.requireWork[slot] = req.copy();
|
||||
return;
|
||||
}
|
||||
else if ( req.isSameType( Stored ) ) // same type ( qty different? )!
|
||||
{
|
||||
if ( req.getStackSize() != Stored.stackSize )
|
||||
{
|
||||
requireWork[slot] = req.copy();
|
||||
requireWork[slot].setStackSize( req.getStackSize() - Stored.stackSize );
|
||||
this.requireWork[slot] = req.copy();
|
||||
this.requireWork[slot].setStackSize( req.getStackSize() - Stored.stackSize );
|
||||
return;
|
||||
}
|
||||
}
|
||||
else // Stored != null; dispose!
|
||||
{
|
||||
IAEItemStack work = AEApi.instance().storage().createItemStack( Stored );
|
||||
requireWork[slot] = work.setStackSize( -work.getStackSize() );
|
||||
this.requireWork[slot] = work.setStackSize( -work.getStackSize() );
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// else
|
||||
|
||||
requireWork[slot] = null;
|
||||
this.requireWork[slot] = null;
|
||||
}
|
||||
|
||||
static private boolean interfaceRequest = false;
|
||||
@@ -400,7 +400,7 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
|
||||
|
||||
public InterfaceInventory(DualityInterface tileInterface) {
|
||||
super( new AdaptorIInventory( tileInterface.storage ) );
|
||||
mySource = new MachineSource( iHost );
|
||||
this.mySource = new MachineSource( DualityInterface.this.iHost );
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -426,16 +426,16 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
|
||||
private boolean usePlan(int x, IAEItemStack itemStack)
|
||||
{
|
||||
boolean changed = false;
|
||||
InventoryAdaptor adaptor = getAdaptor( x );
|
||||
interfaceRequest = isWorking = true;
|
||||
InventoryAdaptor adaptor = this.getAdaptor( x );
|
||||
interfaceRequest = this.isWorking = true;
|
||||
|
||||
try
|
||||
{
|
||||
destination = gridProxy.getStorage().getItemInventory();
|
||||
IEnergySource src = gridProxy.getEnergy();
|
||||
this.destination = this.gridProxy.getStorage().getItemInventory();
|
||||
IEnergySource src = this.gridProxy.getEnergy();
|
||||
|
||||
if ( craftingTracker.isBusy( x ) )
|
||||
changed = handleCrafting( x, adaptor, itemStack ) || changed;
|
||||
if ( this.craftingTracker.isBusy( x ) )
|
||||
changed = this.handleCrafting( x, adaptor, itemStack ) || changed;
|
||||
else if ( itemStack.getStackSize() > 0 )
|
||||
{
|
||||
// make sure strange things didn't happen...
|
||||
@@ -445,7 +445,7 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
|
||||
throw new GridAccessException();
|
||||
}
|
||||
|
||||
IAEItemStack acquired = Platform.poweredExtraction( src, destination, itemStack, mySrc );
|
||||
IAEItemStack acquired = Platform.poweredExtraction( src, this.destination, itemStack, this.mySrc );
|
||||
if ( acquired != null )
|
||||
{
|
||||
changed = true;
|
||||
@@ -454,7 +454,7 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
|
||||
throw new RuntimeException( "bad attempt at managing inventory. ( addItems )" );
|
||||
}
|
||||
else
|
||||
changed = handleCrafting( x, adaptor, itemStack ) || changed;
|
||||
changed = this.handleCrafting( x, adaptor, itemStack ) || changed;
|
||||
}
|
||||
else if ( itemStack.getStackSize() < 0 )
|
||||
{
|
||||
@@ -471,7 +471,7 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
|
||||
throw new GridAccessException();
|
||||
}
|
||||
|
||||
toStore = Platform.poweredInsert( src, destination, toStore, mySrc );
|
||||
toStore = Platform.poweredInsert( src, this.destination, toStore, this.mySrc );
|
||||
|
||||
if ( toStore != null )
|
||||
diff -= toStore.getStackSize();
|
||||
@@ -495,9 +495,9 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
|
||||
}
|
||||
|
||||
if ( changed )
|
||||
updatePlan( x );
|
||||
this.updatePlan( x );
|
||||
|
||||
interfaceRequest = isWorking = false;
|
||||
interfaceRequest = this.isWorking = false;
|
||||
return changed;
|
||||
}
|
||||
|
||||
@@ -505,10 +505,10 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
|
||||
{
|
||||
try
|
||||
{
|
||||
if ( getInstalledUpgrades( Upgrades.CRAFTING ) > 0 && itemStack != null )
|
||||
if ( this.getInstalledUpgrades( Upgrades.CRAFTING ) > 0 && itemStack != null )
|
||||
{
|
||||
return craftingTracker.handleCrafting( x, itemStack.getStackSize(), itemStack, d, iHost.getTileEntity().getWorldObj(), gridProxy.getGrid(),
|
||||
gridProxy.getCrafting(), mySrc );
|
||||
return this.craftingTracker.handleCrafting( x, itemStack.getStackSize(), itemStack, d, this.iHost.getTileEntity().getWorldObj(), this.gridProxy.getGrid(),
|
||||
this.gridProxy.getCrafting(), this.mySrc );
|
||||
}
|
||||
}
|
||||
catch (GridAccessException e)
|
||||
@@ -521,12 +521,12 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
|
||||
|
||||
public IInventory getConfig()
|
||||
{
|
||||
return config;
|
||||
return this.config;
|
||||
}
|
||||
|
||||
public IInventory getPatterns()
|
||||
{
|
||||
return patterns;
|
||||
return this.patterns;
|
||||
}
|
||||
|
||||
final MEMonitorPassThrough<IAEItemStack> items = new MEMonitorPassThrough<IAEItemStack>( new NullInventory<IAEItemStack>(), StorageChannel.ITEMS );
|
||||
@@ -536,16 +536,16 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
|
||||
{
|
||||
try
|
||||
{
|
||||
items.setInternal( gridProxy.getStorage().getItemInventory() );
|
||||
fluids.setInternal( gridProxy.getStorage().getFluidInventory() );
|
||||
this.items.setInternal( this.gridProxy.getStorage().getItemInventory() );
|
||||
this.fluids.setInternal( this.gridProxy.getStorage().getFluidInventory() );
|
||||
}
|
||||
catch (GridAccessException gae)
|
||||
{
|
||||
items.setInternal( new NullInventory<IAEItemStack>() );
|
||||
fluids.setInternal( new NullInventory<IAEFluidStack>() );
|
||||
this.items.setInternal( new NullInventory<IAEItemStack>() );
|
||||
this.fluids.setInternal( new NullInventory<IAEFluidStack>() );
|
||||
}
|
||||
|
||||
notifyNeighbors();
|
||||
this.notifyNeighbors();
|
||||
}
|
||||
|
||||
public AECableType getCableConnectionType(ForgeDirection dir)
|
||||
@@ -555,46 +555,46 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
|
||||
|
||||
public DimensionalCoord getLocation()
|
||||
{
|
||||
return new DimensionalCoord( iHost.getTileEntity() );
|
||||
return new DimensionalCoord( this.iHost.getTileEntity() );
|
||||
}
|
||||
|
||||
public IInventory getInternalInventory()
|
||||
{
|
||||
return storage;
|
||||
return this.storage;
|
||||
}
|
||||
|
||||
public void markDirty()
|
||||
{
|
||||
for (int slot = 0; slot < storage.getSizeInventory(); slot++)
|
||||
onChangeInventory( storage, slot, InvOperation.markDirty, null, null );
|
||||
for (int slot = 0; slot < this.storage.getSizeInventory(); slot++)
|
||||
this.onChangeInventory( this.storage, slot, InvOperation.markDirty, null, null );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onChangeInventory(IInventory inv, int slot, InvOperation mc, ItemStack removed, ItemStack added)
|
||||
{
|
||||
if ( isWorking )
|
||||
if ( this.isWorking )
|
||||
return;
|
||||
|
||||
if ( inv == config )
|
||||
readConfig();
|
||||
else if ( inv == patterns && (removed != null || added != null) )
|
||||
updateCraftingList();
|
||||
else if ( inv == storage && slot >= 0 )
|
||||
if ( inv == this.config )
|
||||
this.readConfig();
|
||||
else if ( inv == this.patterns && (removed != null || added != null) )
|
||||
this.updateCraftingList();
|
||||
else if ( inv == this.storage && slot >= 0 )
|
||||
{
|
||||
boolean had = hasWorkToDo();
|
||||
boolean had = this.hasWorkToDo();
|
||||
|
||||
updatePlan( slot );
|
||||
this.updatePlan( slot );
|
||||
|
||||
boolean now = hasWorkToDo();
|
||||
boolean now = this.hasWorkToDo();
|
||||
|
||||
if ( had != now )
|
||||
{
|
||||
try
|
||||
{
|
||||
if ( now )
|
||||
gridProxy.getTick().alertDevice( gridProxy.getNode() );
|
||||
this.gridProxy.getTick().alertDevice( this.gridProxy.getNode() );
|
||||
else
|
||||
gridProxy.getTick().sleepDevice( gridProxy.getNode() );
|
||||
this.gridProxy.getTick().sleepDevice( this.gridProxy.getNode() );
|
||||
}
|
||||
catch (GridAccessException e)
|
||||
{
|
||||
@@ -606,8 +606,8 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
|
||||
|
||||
public boolean hasWorkToDo()
|
||||
{
|
||||
return hasItemsToSend() || requireWork[0] != null || requireWork[1] != null || requireWork[2] != null || requireWork[3] != null
|
||||
|| requireWork[4] != null || requireWork[5] != null || requireWork[6] != null || requireWork[7] != null;
|
||||
return this.hasItemsToSend() || this.requireWork[0] != null || this.requireWork[1] != null || this.requireWork[2] != null || this.requireWork[3] != null
|
||||
|| this.requireWork[4] != null || this.requireWork[5] != null || this.requireWork[6] != null || this.requireWork[7] != null;
|
||||
}
|
||||
|
||||
private boolean updateStorage()
|
||||
@@ -616,9 +616,9 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
|
||||
|
||||
for (int x = 0; x < 8; x++)
|
||||
{
|
||||
if ( requireWork[x] != null )
|
||||
if ( this.requireWork[x] != null )
|
||||
{
|
||||
didSomething = usePlan( x, requireWork[x] ) || didSomething;
|
||||
didSomething = this.usePlan( x, this.requireWork[x] ) || didSomething;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -627,108 +627,108 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
|
||||
|
||||
public boolean hasConfig()
|
||||
{
|
||||
return hasConfig;
|
||||
return this.hasConfig;
|
||||
}
|
||||
|
||||
public int[] getAccessibleSlotsFromSide(int side)
|
||||
{
|
||||
return sides;
|
||||
return this.sides;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TickingRequest getTickingRequest(IGridNode node)
|
||||
{
|
||||
return new TickingRequest( TickRates.Interface.min, TickRates.Interface.max, !hasWorkToDo(), true );
|
||||
return new TickingRequest( TickRates.Interface.min, TickRates.Interface.max, !this.hasWorkToDo(), true );
|
||||
}
|
||||
|
||||
@Override
|
||||
public TickRateModulation tickingRequest(IGridNode node, int TicksSinceLastCall)
|
||||
{
|
||||
if ( !gridProxy.isActive() )
|
||||
if ( !this.gridProxy.isActive() )
|
||||
return TickRateModulation.SLEEP;
|
||||
|
||||
if ( hasItemsToSend() )
|
||||
pushItemsOut( EnumSet.allOf( ForgeDirection.class ) );
|
||||
if ( this.hasItemsToSend() )
|
||||
this.pushItemsOut( EnumSet.allOf( ForgeDirection.class ) );
|
||||
|
||||
boolean couldDoWork = updateStorage();
|
||||
return hasWorkToDo() ? (couldDoWork ? TickRateModulation.URGENT : TickRateModulation.SLOWER) : TickRateModulation.SLEEP;
|
||||
boolean couldDoWork = this.updateStorage();
|
||||
return this.hasWorkToDo() ? (couldDoWork ? TickRateModulation.URGENT : TickRateModulation.SLOWER) : TickRateModulation.SLEEP;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMEMonitor<IAEItemStack> getItemInventory()
|
||||
{
|
||||
if ( hasConfig() )
|
||||
if ( this.hasConfig() )
|
||||
return new InterfaceInventory( this );
|
||||
|
||||
return items;
|
||||
return this.items;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMEMonitor<IAEFluidStack> getFluidInventory()
|
||||
{
|
||||
if ( hasConfig() )
|
||||
if ( this.hasConfig() )
|
||||
return null;
|
||||
|
||||
return fluids;
|
||||
return this.fluids;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IInventory getInventoryByName(String name)
|
||||
{
|
||||
if ( name.equals( "storage" ) )
|
||||
return storage;
|
||||
return this.storage;
|
||||
|
||||
if ( name.equals( "patterns" ) )
|
||||
return patterns;
|
||||
return this.patterns;
|
||||
|
||||
if ( name.equals( "config" ) )
|
||||
return config;
|
||||
return this.config;
|
||||
|
||||
if ( name.equals( "upgrades" ) )
|
||||
return upgrades;
|
||||
return this.upgrades;
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public IInventory getStorage()
|
||||
{
|
||||
return storage;
|
||||
return this.storage;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity getTile()
|
||||
{
|
||||
return (TileEntity) (iHost instanceof TileEntity ? iHost : null);
|
||||
return (TileEntity) (this.iHost instanceof TileEntity ? this.iHost : null);
|
||||
}
|
||||
|
||||
public IPart getPart()
|
||||
{
|
||||
return (IPart) (iHost instanceof IPart ? iHost : null);
|
||||
return (IPart) (this.iHost instanceof IPart ? this.iHost : null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public appeng.api.util.IConfigManager getConfigManager()
|
||||
{
|
||||
return cm;
|
||||
return this.cm;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateSetting(IConfigManager manager, Enum settingName, Enum newValue)
|
||||
{
|
||||
if ( getInstalledUpgrades( Upgrades.CRAFTING ) == 0 )
|
||||
cancelCrafting();
|
||||
if ( this.getInstalledUpgrades( Upgrades.CRAFTING ) == 0 )
|
||||
this.cancelCrafting();
|
||||
|
||||
markDirty();
|
||||
this.markDirty();
|
||||
}
|
||||
|
||||
private void cancelCrafting()
|
||||
{
|
||||
craftingTracker.cancel();
|
||||
this.craftingTracker.cancel();
|
||||
}
|
||||
|
||||
public IStorageMonitorable getMonitorable(ForgeDirection side, BaseActionSource src, IStorageMonitorable myInterface)
|
||||
{
|
||||
if ( Platform.canAccess( gridProxy, src ) )
|
||||
if ( Platform.canAccess( this.gridProxy, src ) )
|
||||
return myInterface;
|
||||
|
||||
final DualityInterface di = this;
|
||||
@@ -752,15 +752,15 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
|
||||
@Override
|
||||
public boolean isBusy()
|
||||
{
|
||||
if ( hasItemsToSend() )
|
||||
if ( this.hasItemsToSend() )
|
||||
return true;
|
||||
|
||||
boolean busy = false;
|
||||
|
||||
if ( isBlocking() )
|
||||
if ( this.isBlocking() )
|
||||
{
|
||||
EnumSet<ForgeDirection> possibleDirections = iHost.getTargets();
|
||||
TileEntity tile = iHost.getTileEntity();
|
||||
EnumSet<ForgeDirection> possibleDirections = this.iHost.getTargets();
|
||||
TileEntity tile = this.iHost.getTileEntity();
|
||||
World w = tile.getWorldObj();
|
||||
|
||||
boolean allAreBusy = true;
|
||||
@@ -788,19 +788,19 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
|
||||
|
||||
private boolean isBlocking()
|
||||
{
|
||||
return cm.getSetting( Settings.BLOCK ) == YesNo.YES;
|
||||
return this.cm.getSetting( Settings.BLOCK ) == YesNo.YES;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean pushPattern(ICraftingPatternDetails patternDetails, InventoryCrafting table)
|
||||
{
|
||||
if ( hasItemsToSend() || !gridProxy.isActive() )
|
||||
if ( this.hasItemsToSend() || !this.gridProxy.isActive() )
|
||||
return false;
|
||||
|
||||
TileEntity tile = iHost.getTileEntity();
|
||||
TileEntity tile = this.iHost.getTileEntity();
|
||||
World w = tile.getWorldObj();
|
||||
|
||||
EnumSet<ForgeDirection> possibleDirections = iHost.getTargets();
|
||||
EnumSet<ForgeDirection> possibleDirections = this.iHost.getTargets();
|
||||
for (ForgeDirection s : possibleDirections)
|
||||
{
|
||||
TileEntity te = w.getTileEntity( tile.xCoord + s.offsetX, tile.yCoord + s.offsetY, tile.zCoord + s.offsetZ );
|
||||
@@ -808,7 +808,7 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
|
||||
{
|
||||
try
|
||||
{
|
||||
if ( ((IInterfaceHost) te).getInterfaceDuality().sameGrid( gridProxy.getGrid() ) )
|
||||
if ( ((IInterfaceHost) te).getInterfaceDuality().sameGrid( this.gridProxy.getGrid() ) )
|
||||
continue;
|
||||
}
|
||||
catch (GridAccessException e)
|
||||
@@ -831,23 +831,23 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
|
||||
InventoryAdaptor ad = InventoryAdaptor.getAdaptor( te, s.getOpposite() );
|
||||
if ( ad != null )
|
||||
{
|
||||
if ( isBlocking() )
|
||||
if ( this.isBlocking() )
|
||||
{
|
||||
if ( ad.simulateRemove( 1, null, null ) != null )
|
||||
continue;
|
||||
}
|
||||
|
||||
if ( acceptsItems( ad, table ) )
|
||||
if ( this.acceptsItems( ad, table ) )
|
||||
{
|
||||
for (int x = 0; x < table.getSizeInventory(); x++)
|
||||
{
|
||||
ItemStack is = table.getStackInSlot( x );
|
||||
if ( is != null )
|
||||
{
|
||||
addToSendList( ad.addItems( is ) );
|
||||
this.addToSendList( ad.addItems( is ) );
|
||||
}
|
||||
}
|
||||
pushItemsOut( possibleDirections );
|
||||
this.pushItemsOut( possibleDirections );
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -858,7 +858,7 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
|
||||
|
||||
private boolean sameGrid(IGrid grid) throws GridAccessException
|
||||
{
|
||||
return grid == gridProxy.getGrid();
|
||||
return grid == this.gridProxy.getGrid();
|
||||
}
|
||||
|
||||
private boolean acceptsItems(InventoryAdaptor ad, InventoryCrafting table)
|
||||
@@ -878,13 +878,13 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
|
||||
|
||||
private void pushItemsOut(EnumSet<ForgeDirection> possibleDirections)
|
||||
{
|
||||
if ( !hasItemsToSend() )
|
||||
if ( !this.hasItemsToSend() )
|
||||
return;
|
||||
|
||||
TileEntity tile = iHost.getTileEntity();
|
||||
TileEntity tile = this.iHost.getTileEntity();
|
||||
World w = tile.getWorldObj();
|
||||
|
||||
Iterator<ItemStack> i = waitingToSend.iterator();
|
||||
Iterator<ItemStack> i = this.waitingToSend.iterator();
|
||||
while (i.hasNext())
|
||||
{
|
||||
ItemStack whatToSend = i.next();
|
||||
@@ -914,16 +914,16 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
|
||||
i.remove();
|
||||
}
|
||||
|
||||
if ( waitingToSend.isEmpty() )
|
||||
waitingToSend = null;
|
||||
if ( this.waitingToSend.isEmpty() )
|
||||
this.waitingToSend = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void provideCrafting(ICraftingProviderHelper craftingTracker)
|
||||
{
|
||||
if ( gridProxy.isActive() && craftingList != null )
|
||||
if ( this.gridProxy.isActive() && this.craftingList != null )
|
||||
{
|
||||
for (ICraftingPatternDetails details : craftingList)
|
||||
for (ICraftingPatternDetails details : this.craftingList)
|
||||
{
|
||||
details.setPriority( this.priority );
|
||||
craftingTracker.addCraftingOption( this, details );
|
||||
@@ -933,34 +933,34 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
|
||||
|
||||
public void addDrops(List<ItemStack> drops)
|
||||
{
|
||||
if ( waitingToSend != null )
|
||||
if ( this.waitingToSend != null )
|
||||
{
|
||||
for (ItemStack is : waitingToSend)
|
||||
for (ItemStack is : this.waitingToSend)
|
||||
if ( is != null )
|
||||
drops.add( is );
|
||||
}
|
||||
|
||||
for (ItemStack is : upgrades)
|
||||
for (ItemStack is : this.upgrades)
|
||||
if ( is != null )
|
||||
drops.add( is );
|
||||
|
||||
for (ItemStack is : storage)
|
||||
for (ItemStack is : this.storage)
|
||||
if ( is != null )
|
||||
drops.add( is );
|
||||
|
||||
for (ItemStack is : patterns)
|
||||
for (ItemStack is : this.patterns)
|
||||
if ( is != null )
|
||||
drops.add( is );
|
||||
}
|
||||
|
||||
public void notifyNeighbors()
|
||||
{
|
||||
if ( gridProxy.isActive() )
|
||||
if ( this.gridProxy.isActive() )
|
||||
{
|
||||
try
|
||||
{
|
||||
gridProxy.getGrid().postEvent( new MENetworkCraftingPatternChange( this, gridProxy.getNode() ) );
|
||||
gridProxy.getTick().wakeDevice( gridProxy.getNode() );
|
||||
this.gridProxy.getGrid().postEvent( new MENetworkCraftingPatternChange( this, this.gridProxy.getNode() ) );
|
||||
this.gridProxy.getTick().wakeDevice( this.gridProxy.getNode() );
|
||||
}
|
||||
catch (GridAccessException e)
|
||||
{
|
||||
@@ -968,39 +968,39 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
|
||||
}
|
||||
}
|
||||
|
||||
TileEntity te = iHost.getTileEntity();
|
||||
TileEntity te = this.iHost.getTileEntity();
|
||||
if ( te != null && te.getWorldObj() != null )
|
||||
Platform.notifyBlocksOfNeighbors( te.getWorldObj(), te.xCoord, te.yCoord, te.zCoord );
|
||||
}
|
||||
|
||||
public IUpgradeableHost getHost()
|
||||
{
|
||||
if ( getPart() instanceof IUpgradeableHost )
|
||||
return (IUpgradeableHost) getPart();
|
||||
if ( getTile() instanceof IUpgradeableHost )
|
||||
return (IUpgradeableHost) getTile();
|
||||
if ( this.getPart() instanceof IUpgradeableHost )
|
||||
return (IUpgradeableHost) this.getPart();
|
||||
if ( this.getTile() instanceof IUpgradeableHost )
|
||||
return (IUpgradeableHost) this.getTile();
|
||||
return null;
|
||||
}
|
||||
|
||||
public ImmutableSet<ICraftingLink> getRequestedJobs()
|
||||
{
|
||||
return craftingTracker.getRequestedJobs();
|
||||
return this.craftingTracker.getRequestedJobs();
|
||||
}
|
||||
|
||||
public IAEItemStack injectCraftedItems(ICraftingLink link, IAEItemStack acquired, Actionable mode)
|
||||
{
|
||||
int slot = craftingTracker.getSlot( link );
|
||||
int slot = this.craftingTracker.getSlot( link );
|
||||
|
||||
if ( acquired != null && slot >= 0 && slot <= requireWork.length )
|
||||
if ( acquired != null && slot >= 0 && slot <= this.requireWork.length )
|
||||
{
|
||||
InventoryAdaptor adaptor = getAdaptor( slot );
|
||||
InventoryAdaptor adaptor = this.getAdaptor( slot );
|
||||
|
||||
if ( mode == Actionable.SIMULATE )
|
||||
return AEItemStack.create( adaptor.simulateAdd( acquired.getItemStack() ) );
|
||||
else
|
||||
{
|
||||
IAEItemStack is = AEItemStack.create( adaptor.addItems( acquired.getItemStack() ) );
|
||||
updatePlan( slot );
|
||||
this.updatePlan( slot );
|
||||
return is;
|
||||
}
|
||||
}
|
||||
@@ -1010,20 +1010,20 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
|
||||
|
||||
public void jobStateChange(ICraftingLink link)
|
||||
{
|
||||
craftingTracker.jobStateChange( link );
|
||||
this.craftingTracker.jobStateChange( link );
|
||||
}
|
||||
|
||||
static final Set<Block> badBlocks = new HashSet<Block>();
|
||||
|
||||
public String getTermName()
|
||||
{
|
||||
TileEntity tile = iHost.getTileEntity();
|
||||
TileEntity tile = this.iHost.getTileEntity();
|
||||
World w = tile.getWorldObj();
|
||||
|
||||
if ( ((ICustomNameObject) iHost).hasCustomName() )
|
||||
return ((ICustomNameObject) iHost).getCustomName();
|
||||
if ( ((ICustomNameObject) this.iHost).hasCustomName() )
|
||||
return ((ICustomNameObject) this.iHost).getCustomName();
|
||||
|
||||
EnumSet<ForgeDirection> possibleDirections = iHost.getTargets();
|
||||
EnumSet<ForgeDirection> possibleDirections = this.iHost.getTargets();
|
||||
for (ForgeDirection s : possibleDirections)
|
||||
{
|
||||
Vec3 from = Vec3.createVectorHelper( tile.xCoord + 0.5, tile.yCoord + 0.5, tile.zCoord + 0.5 );
|
||||
@@ -1042,7 +1042,7 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
|
||||
{
|
||||
try
|
||||
{
|
||||
if ( ((IInterfaceHost) te).getInterfaceDuality().sameGrid( gridProxy.getGrid() ) )
|
||||
if ( ((IInterfaceHost) te).getInterfaceDuality().sameGrid( this.gridProxy.getGrid() ) )
|
||||
continue;
|
||||
}
|
||||
catch (GridAccessException e)
|
||||
@@ -1101,30 +1101,30 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
|
||||
|
||||
public long getSortValue()
|
||||
{
|
||||
TileEntity te = iHost.getTileEntity();
|
||||
TileEntity te = this.iHost.getTileEntity();
|
||||
return (te.zCoord << 24) ^ (te.xCoord << 8) ^ te.yCoord;
|
||||
}
|
||||
|
||||
public void initialize()
|
||||
{
|
||||
updateCraftingList();
|
||||
this.updateCraftingList();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getPriority()
|
||||
{
|
||||
return priority;
|
||||
return this.priority;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPriority(int newValue)
|
||||
{
|
||||
priority = newValue;
|
||||
markDirty();
|
||||
this.priority = newValue;
|
||||
this.markDirty();
|
||||
|
||||
try
|
||||
{
|
||||
gridProxy.getGrid().postEvent( new MENetworkCraftingPatternChange( this, gridProxy.getNode() ) );
|
||||
this.gridProxy.getGrid().postEvent( new MENetworkCraftingPatternChange( this, this.gridProxy.getNode() ) );
|
||||
}
|
||||
catch (GridAccessException e)
|
||||
{
|
||||
|
||||
@@ -31,7 +31,7 @@ public class LocationRotation implements IOrientable
|
||||
final int z;
|
||||
|
||||
public LocationRotation(IBlockAccess world, int x, int y, int z) {
|
||||
w = world;
|
||||
this.w = world;
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.z = z;
|
||||
@@ -46,14 +46,14 @@ public class LocationRotation implements IOrientable
|
||||
@Override
|
||||
public ForgeDirection getUp()
|
||||
{
|
||||
int num = Math.abs( x + y + z ) % 6;
|
||||
int num = Math.abs( this.x + this.y + this.z ) % 6;
|
||||
return ForgeDirection.getOrientation( num );
|
||||
}
|
||||
|
||||
@Override
|
||||
public ForgeDirection getForward()
|
||||
{
|
||||
if ( getUp().offsetY == 0 )
|
||||
if ( this.getUp().offsetY == 0 )
|
||||
return ForgeDirection.UP;
|
||||
return ForgeDirection.SOUTH;
|
||||
}
|
||||
|
||||
@@ -32,7 +32,7 @@ public class MetaRotation implements IOrientable
|
||||
final int z;
|
||||
|
||||
public MetaRotation(IBlockAccess world, int x, int y, int z) {
|
||||
w = world;
|
||||
this.w = world;
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.z = z;
|
||||
@@ -41,22 +41,22 @@ public class MetaRotation implements IOrientable
|
||||
@Override
|
||||
public void setOrientation(ForgeDirection Forward, ForgeDirection Up)
|
||||
{
|
||||
if ( w instanceof World )
|
||||
((World) w).setBlockMetadataWithNotify( x, y, z, Up.ordinal(), 1 + 2 );
|
||||
if ( this.w instanceof World )
|
||||
((World) this.w).setBlockMetadataWithNotify( this.x, this.y, this.z, Up.ordinal(), 1 + 2 );
|
||||
else
|
||||
throw new RuntimeException( w.getClass().getName() + " received, expected World" );
|
||||
throw new RuntimeException( this.w.getClass().getName() + " received, expected World" );
|
||||
}
|
||||
|
||||
@Override
|
||||
public ForgeDirection getUp()
|
||||
{
|
||||
return ForgeDirection.getOrientation( w.getBlockMetadata( x, y, z ) );
|
||||
return ForgeDirection.getOrientation( this.w.getBlockMetadata( this.x, this.y, this.z ) );
|
||||
}
|
||||
|
||||
@Override
|
||||
public ForgeDirection getForward()
|
||||
{
|
||||
if ( getUp().offsetY == 0 )
|
||||
if ( this.getUp().offsetY == 0 )
|
||||
return ForgeDirection.UP;
|
||||
return ForgeDirection.SOUTH;
|
||||
}
|
||||
|
||||
@@ -57,30 +57,30 @@ public class MeteoritePlacer
|
||||
{
|
||||
double a = Math.random();
|
||||
if ( a > 0.9 )
|
||||
put( w, x, y, z, Blocks.stone );
|
||||
MeteoritePlacer.this.put( w, x, y, z, Blocks.stone );
|
||||
else if ( a > 0.8 )
|
||||
put( w, x, y, z, Blocks.cobblestone );
|
||||
MeteoritePlacer.this.put( w, x, y, z, Blocks.cobblestone );
|
||||
else if ( a > 0.7 )
|
||||
put( w, x, y, z, Blocks.dirt );
|
||||
MeteoritePlacer.this.put( w, x, y, z, Blocks.dirt );
|
||||
else if ( a > 0.7 )
|
||||
put( w, x, y, z, Blocks.gravel );
|
||||
MeteoritePlacer.this.put( w, x, y, z, Blocks.gravel );
|
||||
}
|
||||
|
||||
public void getRandomInset(IMeteoriteWorld w, int x, int y, int z)
|
||||
{
|
||||
double a = Math.random();
|
||||
if ( a > 0.9 )
|
||||
put( w, x, y, z, Blocks.cobblestone );
|
||||
MeteoritePlacer.this.put( w, x, y, z, Blocks.cobblestone );
|
||||
else if ( a > 0.8 )
|
||||
put( w, x, y, z, Blocks.stone );
|
||||
MeteoritePlacer.this.put( w, x, y, z, Blocks.stone );
|
||||
else if ( a > 0.7 )
|
||||
put( w, x, y, z, Blocks.grass );
|
||||
MeteoritePlacer.this.put( w, x, y, z, Blocks.grass );
|
||||
else if ( a > 0.6 )
|
||||
put( w, x, y, z, skystone );
|
||||
MeteoritePlacer.this.put( w, x, y, z, MeteoritePlacer.this.skystone );
|
||||
else if ( a > 0.5 )
|
||||
put( w, x, y, z, Blocks.gravel );
|
||||
MeteoritePlacer.this.put( w, x, y, z, Blocks.gravel );
|
||||
else if ( a > 0.5 )
|
||||
put( w, x, y, z, Platform.air );
|
||||
MeteoritePlacer.this.put( w, x, y, z, Platform.air );
|
||||
}
|
||||
|
||||
}
|
||||
@@ -92,8 +92,8 @@ public class MeteoritePlacer
|
||||
final int meta;
|
||||
|
||||
public FalloutCopy(IMeteoriteWorld w, int x, int y, int z) {
|
||||
blk = w.getBlock( x, y, z );
|
||||
meta = w.getBlockMetadata( x, y, z );
|
||||
this.blk = w.getBlock( x, y, z );
|
||||
this.meta = w.getBlockMetadata( x, y, z );
|
||||
}
|
||||
|
||||
public void getOther(IMeteoriteWorld w, int x, int y, int z, double a)
|
||||
@@ -106,9 +106,9 @@ public class MeteoritePlacer
|
||||
{
|
||||
double a = Math.random();
|
||||
if ( a > 0.9 )
|
||||
put( w, x, y, z, blk, meta );
|
||||
MeteoritePlacer.this.put( w, x, y, z, this.blk, this.meta );
|
||||
else
|
||||
getOther( w, x, y, z, a );
|
||||
this.getOther( w, x, y, z, a );
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -116,11 +116,11 @@ public class MeteoritePlacer
|
||||
{
|
||||
double a = Math.random();
|
||||
if ( a > 0.9 )
|
||||
put( w, x, y, z, blk, meta );
|
||||
MeteoritePlacer.this.put( w, x, y, z, this.blk, this.meta );
|
||||
else if ( a > 0.8 )
|
||||
put( w, x, y, z, Platform.air );
|
||||
MeteoritePlacer.this.put( w, x, y, z, Platform.air );
|
||||
else
|
||||
getOther( w, x, y, z, a - 0.1 );
|
||||
this.getOther( w, x, y, z, a - 0.1 );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -141,7 +141,7 @@ public class MeteoritePlacer
|
||||
public void getOther(IMeteoriteWorld w, int x, int y, int z, double a)
|
||||
{
|
||||
if ( a > 0.66 )
|
||||
put( w, x, y, z, Blocks.glass );
|
||||
MeteoritePlacer.this.put( w, x, y, z, Blocks.glass );
|
||||
}
|
||||
|
||||
}
|
||||
@@ -163,9 +163,9 @@ public class MeteoritePlacer
|
||||
public void getOther(IMeteoriteWorld w, int x, int y, int z, double a)
|
||||
{
|
||||
if ( a > 0.7 )
|
||||
put( w, x, y, z, Blocks.snow );
|
||||
MeteoritePlacer.this.put( w, x, y, z, Blocks.snow );
|
||||
else if ( a > 0.5 )
|
||||
put( w, x, y, z, Blocks.ice );
|
||||
MeteoritePlacer.this.put( w, x, y, z, Blocks.ice );
|
||||
}
|
||||
|
||||
}
|
||||
@@ -213,59 +213,59 @@ public class MeteoritePlacer
|
||||
@Override
|
||||
public boolean hasNoSky()
|
||||
{
|
||||
return !w.provider.hasNoSky;
|
||||
return !this.w.provider.hasNoSky;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getBlockMetadata(int x, int y, int z)
|
||||
{
|
||||
if ( range( x, y, z ) )
|
||||
return w.getBlockMetadata( x, y, z );
|
||||
if ( this.range( x, y, z ) )
|
||||
return this.w.getBlockMetadata( x, y, z );
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Block getBlock(int x, int y, int z)
|
||||
{
|
||||
if ( range( x, y, z ) )
|
||||
return w.getBlock( x, y, z );
|
||||
if ( this.range( x, y, z ) )
|
||||
return this.w.getBlock( x, y, z );
|
||||
return Platform.air;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canBlockSeeTheSky(int x, int y, int z)
|
||||
{
|
||||
if ( range( x, y, z ) )
|
||||
return w.canBlockSeeTheSky( x, y, z );
|
||||
if ( this.range( x, y, z ) )
|
||||
return this.w.canBlockSeeTheSky( x, y, z );
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity getTileEntity(int x, int y, int z)
|
||||
{
|
||||
if ( range( x, y, z ) )
|
||||
return w.getTileEntity( x, y, z );
|
||||
if ( this.range( x, y, z ) )
|
||||
return this.w.getTileEntity( x, y, z );
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public World getWorld()
|
||||
{
|
||||
return w;
|
||||
return this.w;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBlock(int x, int y, int z, Block blk)
|
||||
{
|
||||
if ( range( x, y, z ) )
|
||||
w.setBlock( x, y, z, blk );
|
||||
if ( this.range( x, y, z ) )
|
||||
this.w.setBlock( x, y, z, blk );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBlock(int x, int y, int z, Block blk, int metadata, int flags)
|
||||
{
|
||||
if ( range( x, y, z ) )
|
||||
w.setBlock( x, y, z, blk, metadata, flags );
|
||||
if ( this.range( x, y, z ) )
|
||||
this.w.setBlock( x, y, z, blk, metadata, flags );
|
||||
}
|
||||
|
||||
public boolean range(int x, int y, int z)
|
||||
@@ -316,7 +316,7 @@ public class MeteoritePlacer
|
||||
|
||||
public ChunkOnly(World w, int cx, int cz) {
|
||||
super( w );
|
||||
target = w.getChunkFromChunkCoords( cx, cz );
|
||||
this.target = w.getChunkFromChunkCoords( cx, cz );
|
||||
this.cx = cx;
|
||||
this.cz = cz;
|
||||
}
|
||||
@@ -324,74 +324,74 @@ public class MeteoritePlacer
|
||||
@Override
|
||||
public void done()
|
||||
{
|
||||
if ( verticalBits != 0 )
|
||||
Platform.sendChunk( target, verticalBits );
|
||||
if ( this.verticalBits != 0 )
|
||||
Platform.sendChunk( this.target, this.verticalBits );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBlock(int x, int y, int z, Block blk)
|
||||
{
|
||||
if ( range( x, y, z ) )
|
||||
if ( this.range( x, y, z ) )
|
||||
{
|
||||
verticalBits |= 1 << (y >> 4);
|
||||
w.setBlock( x, y, z, blk, 0, 1 );
|
||||
this.verticalBits |= 1 << (y >> 4);
|
||||
this.w.setBlock( x, y, z, blk, 0, 1 );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBlock(int x, int y, int z, Block blk, int metadata, int flags)
|
||||
{
|
||||
if ( range( x, y, z ) )
|
||||
if ( this.range( x, y, z ) )
|
||||
{
|
||||
verticalBits |= 1 << (y >> 4);
|
||||
w.setBlock( x, y, z, blk, metadata, flags & (~2) );
|
||||
this.verticalBits |= 1 << (y >> 4);
|
||||
this.w.setBlock( x, y, z, blk, metadata, flags & (~2) );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Block getBlock(int x, int y, int z)
|
||||
{
|
||||
if ( range( x, y, z ) )
|
||||
return target.getBlock( x & 0xF, y, z & 0xF );
|
||||
if ( this.range( x, y, z ) )
|
||||
return this.target.getBlock( x & 0xF, y, z & 0xF );
|
||||
return Platform.air;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getBlockMetadata(int x, int y, int z)
|
||||
{
|
||||
if ( range( x, y, z ) )
|
||||
return target.getBlockMetadata( x & 0xF, y, z & 0xF );
|
||||
if ( this.range( x, y, z ) )
|
||||
return this.target.getBlockMetadata( x & 0xF, y, z & 0xF );
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean range(int x, int y, int z)
|
||||
{
|
||||
return cx == (x >> 4) && cz == (z >> 4);
|
||||
return this.cx == (x >> 4) && this.cz == (z >> 4);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int minX(int in)
|
||||
{
|
||||
return Math.max( in, cx << 4 );
|
||||
return Math.max( in, this.cx << 4 );
|
||||
}
|
||||
|
||||
@Override
|
||||
public int minZ(int in)
|
||||
{
|
||||
return Math.max( in, cz << 4 );
|
||||
return Math.max( in, this.cz << 4 );
|
||||
}
|
||||
|
||||
@Override
|
||||
public int maxX(int in)
|
||||
{
|
||||
return Math.min( in, (cx + 1) << 4 );
|
||||
return Math.min( in, (this.cx + 1) << 4 );
|
||||
}
|
||||
|
||||
@Override
|
||||
public int maxZ(int in)
|
||||
{
|
||||
return Math.min( in, (cz + 1) << 4 );
|
||||
return Math.min( in, (this.cz + 1) << 4 );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -405,80 +405,80 @@ public class MeteoritePlacer
|
||||
final Block skychest;
|
||||
|
||||
double real_sizeOfMeteorite = (Math.random() * 6.0) + 2;
|
||||
double realCrater = real_sizeOfMeteorite * 2 + 5;
|
||||
double realCrater = this.real_sizeOfMeteorite * 2 + 5;
|
||||
|
||||
double sizeOfMeteorite = real_sizeOfMeteorite * real_sizeOfMeteorite;
|
||||
double crater = realCrater * realCrater;
|
||||
double sizeOfMeteorite = this.real_sizeOfMeteorite * this.real_sizeOfMeteorite;
|
||||
double crater = this.realCrater * this.realCrater;
|
||||
|
||||
public MeteoritePlacer() {
|
||||
|
||||
if ( AEApi.instance().blocks().blockSkyChest.block() == null )
|
||||
skychest = Blocks.chest;
|
||||
this.skychest = Blocks.chest;
|
||||
else
|
||||
skychest = AEApi.instance().blocks().blockSkyChest.block();
|
||||
this.skychest = AEApi.instance().blocks().blockSkyChest.block();
|
||||
|
||||
validSpawn.add( Blocks.stone );
|
||||
validSpawn.add( Blocks.cobblestone );
|
||||
validSpawn.add( Blocks.grass );
|
||||
validSpawn.add( Blocks.sand );
|
||||
validSpawn.add( Blocks.dirt );
|
||||
validSpawn.add( Blocks.gravel );
|
||||
validSpawn.add( Blocks.netherrack );
|
||||
validSpawn.add( Blocks.iron_ore );
|
||||
validSpawn.add( Blocks.gold_ore );
|
||||
validSpawn.add( Blocks.diamond_ore );
|
||||
validSpawn.add( Blocks.redstone_ore );
|
||||
validSpawn.add( Blocks.hardened_clay );
|
||||
validSpawn.add( Blocks.ice );
|
||||
validSpawn.add( Blocks.snow );
|
||||
this.validSpawn.add( Blocks.stone );
|
||||
this.validSpawn.add( Blocks.cobblestone );
|
||||
this.validSpawn.add( Blocks.grass );
|
||||
this.validSpawn.add( Blocks.sand );
|
||||
this.validSpawn.add( Blocks.dirt );
|
||||
this.validSpawn.add( Blocks.gravel );
|
||||
this.validSpawn.add( Blocks.netherrack );
|
||||
this.validSpawn.add( Blocks.iron_ore );
|
||||
this.validSpawn.add( Blocks.gold_ore );
|
||||
this.validSpawn.add( Blocks.diamond_ore );
|
||||
this.validSpawn.add( Blocks.redstone_ore );
|
||||
this.validSpawn.add( Blocks.hardened_clay );
|
||||
this.validSpawn.add( Blocks.ice );
|
||||
this.validSpawn.add( Blocks.snow );
|
||||
|
||||
invalidSpawn.add( skystone );
|
||||
invalidSpawn.add( Blocks.planks );
|
||||
invalidSpawn.add( Blocks.iron_door );
|
||||
invalidSpawn.add( Blocks.iron_bars );
|
||||
invalidSpawn.add( Blocks.wooden_door );
|
||||
invalidSpawn.add( Blocks.brick_block );
|
||||
invalidSpawn.add( Blocks.clay );
|
||||
invalidSpawn.add( Blocks.water );
|
||||
invalidSpawn.add( Blocks.log );
|
||||
invalidSpawn.add( Blocks.log2 );
|
||||
this.invalidSpawn.add( this.skystone );
|
||||
this.invalidSpawn.add( Blocks.planks );
|
||||
this.invalidSpawn.add( Blocks.iron_door );
|
||||
this.invalidSpawn.add( Blocks.iron_bars );
|
||||
this.invalidSpawn.add( Blocks.wooden_door );
|
||||
this.invalidSpawn.add( Blocks.brick_block );
|
||||
this.invalidSpawn.add( Blocks.clay );
|
||||
this.invalidSpawn.add( Blocks.water );
|
||||
this.invalidSpawn.add( Blocks.log );
|
||||
this.invalidSpawn.add( Blocks.log2 );
|
||||
}
|
||||
|
||||
NBTTagCompound settings;
|
||||
|
||||
public boolean spawnMeteorite(IMeteoriteWorld w, NBTTagCompound meteoriteBlob)
|
||||
{
|
||||
settings = meteoriteBlob;
|
||||
this.settings = meteoriteBlob;
|
||||
|
||||
int x = settings.getInteger( "x" );
|
||||
int y = settings.getInteger( "y" );
|
||||
int z = settings.getInteger( "z" );
|
||||
int x = this.settings.getInteger( "x" );
|
||||
int y = this.settings.getInteger( "y" );
|
||||
int z = this.settings.getInteger( "z" );
|
||||
|
||||
real_sizeOfMeteorite = settings.getDouble( "real_sizeOfMeteorite" );
|
||||
realCrater = settings.getDouble( "realCrater" );
|
||||
sizeOfMeteorite = settings.getDouble( "sizeOfMeteorite" );
|
||||
crater = settings.getDouble( "crater" );
|
||||
this.real_sizeOfMeteorite = this.settings.getDouble( "real_sizeOfMeteorite" );
|
||||
this.realCrater = this.settings.getDouble( "realCrater" );
|
||||
this.sizeOfMeteorite = this.settings.getDouble( "sizeOfMeteorite" );
|
||||
this.crater = this.settings.getDouble( "crater" );
|
||||
|
||||
Block blk = Block.getBlockById( settings.getInteger( "blk" ) );
|
||||
Block blk = Block.getBlockById( this.settings.getInteger( "blk" ) );
|
||||
|
||||
if ( blk == Blocks.sand )
|
||||
type = new FalloutSand( w, x, y, z );
|
||||
this.type = new FalloutSand( w, x, y, z );
|
||||
else if ( blk == Blocks.hardened_clay )
|
||||
type = new FalloutCopy( w, x, y, z );
|
||||
this.type = new FalloutCopy( w, x, y, z );
|
||||
else if ( blk == Blocks.ice || blk == Blocks.snow )
|
||||
type = new FalloutSnow( w, x, y, z );
|
||||
this.type = new FalloutSnow( w, x, y, z );
|
||||
|
||||
int skyMode = settings.getInteger( "skyMode" );
|
||||
int skyMode = this.settings.getInteger( "skyMode" );
|
||||
|
||||
// creator
|
||||
if ( skyMode > 10 )
|
||||
placeCrater( w, x, y, z );
|
||||
this.placeCrater( w, x, y, z );
|
||||
|
||||
placeMeteorite( w, x, y, z );
|
||||
this.placeMeteorite( w, x, y, z );
|
||||
|
||||
// collapse blocks...
|
||||
if ( skyMode > 3 )
|
||||
Decay( w, x, y, z );
|
||||
this.Decay( w, x, y, z );
|
||||
|
||||
w.done();
|
||||
return true;
|
||||
@@ -486,8 +486,8 @@ public class MeteoritePlacer
|
||||
|
||||
public double getSqDistance(int x, int z)
|
||||
{
|
||||
int Cx = settings.getInteger( "x" ) - x;
|
||||
int Cz = settings.getInteger( "z" ) - z;
|
||||
int Cx = this.settings.getInteger( "x" ) - x;
|
||||
int Cz = this.settings.getInteger( "z" ) - z;
|
||||
|
||||
return Cx * Cx + Cz * Cz;
|
||||
}
|
||||
@@ -500,28 +500,28 @@ public class MeteoritePlacer
|
||||
return false;
|
||||
|
||||
Block blk = w.getBlock( x, y, z );
|
||||
if ( !validSpawn.contains( blk ) )
|
||||
if ( !this.validSpawn.contains( blk ) )
|
||||
return false; // must spawn on a valid block..
|
||||
|
||||
settings = new NBTTagCompound();
|
||||
settings.setInteger( "x", x );
|
||||
settings.setInteger( "y", y );
|
||||
settings.setInteger( "z", z );
|
||||
settings.setInteger( "blk", Block.getIdFromBlock( blk ) );
|
||||
this.settings = new NBTTagCompound();
|
||||
this.settings.setInteger( "x", x );
|
||||
this.settings.setInteger( "y", y );
|
||||
this.settings.setInteger( "z", z );
|
||||
this.settings.setInteger( "blk", Block.getIdFromBlock( blk ) );
|
||||
|
||||
settings.setDouble( "real_sizeOfMeteorite", real_sizeOfMeteorite );
|
||||
settings.setDouble( "realCrater", realCrater );
|
||||
settings.setDouble( "sizeOfMeteorite", sizeOfMeteorite );
|
||||
settings.setDouble( "crater", crater );
|
||||
this.settings.setDouble( "real_sizeOfMeteorite", this.real_sizeOfMeteorite );
|
||||
this.settings.setDouble( "realCrater", this.realCrater );
|
||||
this.settings.setDouble( "sizeOfMeteorite", this.sizeOfMeteorite );
|
||||
this.settings.setDouble( "crater", this.crater );
|
||||
|
||||
settings.setBoolean( "lava", Math.random() > 0.9 );
|
||||
this.settings.setBoolean( "lava", Math.random() > 0.9 );
|
||||
|
||||
if ( blk == Blocks.sand )
|
||||
type = new FalloutSand( w, x, y, z );
|
||||
this.type = new FalloutSand( w, x, y, z );
|
||||
else if ( blk == Blocks.hardened_clay )
|
||||
type = new FalloutCopy( w, x, y, z );
|
||||
this.type = new FalloutCopy( w, x, y, z );
|
||||
else if ( blk == Blocks.ice || blk == Blocks.snow )
|
||||
type = new FalloutSnow( w, x, y, z );
|
||||
this.type = new FalloutSnow( w, x, y, z );
|
||||
|
||||
int realValidBlocks = 0;
|
||||
|
||||
@@ -530,7 +530,7 @@ public class MeteoritePlacer
|
||||
for (int k = z - 6; k < z + 6; k++)
|
||||
{
|
||||
blk = w.getBlock( i, j, k );
|
||||
if ( validSpawn.contains( blk ) )
|
||||
if ( this.validSpawn.contains( blk ) )
|
||||
realValidBlocks++;
|
||||
}
|
||||
|
||||
@@ -539,13 +539,13 @@ public class MeteoritePlacer
|
||||
for (int k = z - 15; k < z + 15; k++)
|
||||
{
|
||||
blk = w.getBlock( i, j, k );
|
||||
if ( invalidSpawn.contains( blk ) )
|
||||
if ( this.invalidSpawn.contains( blk ) )
|
||||
return false;
|
||||
if ( validSpawn.contains( blk ) )
|
||||
if ( this.validSpawn.contains( blk ) )
|
||||
validBlocks++;
|
||||
}
|
||||
|
||||
if ( validBlocks > minBLocks && realValidBlocks > 80 )
|
||||
if ( validBlocks > this.minBLocks && realValidBlocks > 80 )
|
||||
{
|
||||
// we can spawn here!
|
||||
|
||||
@@ -571,18 +571,18 @@ public class MeteoritePlacer
|
||||
|
||||
// creator
|
||||
if ( skyMode > 10 )
|
||||
placeCrater( w, x, y, z );
|
||||
this.placeCrater( w, x, y, z );
|
||||
|
||||
placeMeteorite( w, x, y, z );
|
||||
this.placeMeteorite( w, x, y, z );
|
||||
|
||||
// collapse blocks...
|
||||
if ( skyMode > 3 )
|
||||
Decay( w, x, y, z );
|
||||
this.Decay( w, x, y, z );
|
||||
|
||||
settings.setInteger( "skyMode", skyMode );
|
||||
this.settings.setInteger( "skyMode", skyMode );
|
||||
w.done();
|
||||
|
||||
WorldSettings.getInstance().addNearByMeteorites( w.getWorld().provider.dimensionId, x >> 4, z >> 4, settings );
|
||||
WorldSettings.getInstance().addNearByMeteorites( w.getWorld().provider.dimensionId, x >> 4, z >> 4, this.settings );
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@@ -590,7 +590,7 @@ public class MeteoritePlacer
|
||||
|
||||
private void placeCrater(IMeteoriteWorld w, int x, int y, int z)
|
||||
{
|
||||
boolean lava = settings.getBoolean( "lava" );
|
||||
boolean lava = this.settings.getBoolean( "lava" );
|
||||
|
||||
int maxY = 255;
|
||||
int minX = w.minX( x - 200 );
|
||||
@@ -607,7 +607,7 @@ public class MeteoritePlacer
|
||||
{
|
||||
double dx = i - x;
|
||||
double dz = k - z;
|
||||
double h = y - real_sizeOfMeteorite + 1 + type.adjustCrater();
|
||||
double h = y - this.real_sizeOfMeteorite + 1 + this.type.adjustCrater();
|
||||
|
||||
double distanceFrom = dx * dx + dz * dz;
|
||||
|
||||
@@ -616,10 +616,10 @@ public class MeteoritePlacer
|
||||
if ( lava && j < y && w.getBlock( x, y - 1, z ).isBlockSolid( w.getWorld(), i, j, k, 0 ) )
|
||||
{
|
||||
if ( j > h + distanceFrom * 0.02 )
|
||||
put( w, i, j, k, Blocks.lava );
|
||||
this.put( w, i, j, k, Blocks.lava );
|
||||
}
|
||||
else
|
||||
changed = put( w, i, j, k, Platform.air ) || changed;
|
||||
changed = this.put( w, i, j, k, Platform.air ) || changed;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -648,13 +648,13 @@ public class MeteoritePlacer
|
||||
double dy = j - y;
|
||||
double dz = k - z;
|
||||
|
||||
if ( dx * dx * 0.7 + dy * dy * (j > y ? 1.4 : 0.8) + dz * dz * 0.7 < sizeOfMeteorite )
|
||||
put( w, i, j, k, skystone );
|
||||
if ( dx * dx * 0.7 + dy * dy * (j > y ? 1.4 : 0.8) + dz * dz * 0.7 < this.sizeOfMeteorite )
|
||||
this.put( w, i, j, k, this.skystone );
|
||||
}
|
||||
|
||||
if ( AEConfig.instance.isFeatureEnabled( AEFeature.SpawnPressesInMeteorites ) )
|
||||
{
|
||||
put( w, x, y, z, skychest );
|
||||
this.put( w, x, y, z, this.skychest );
|
||||
TileEntity te = w.getTileEntity( x, y, z );
|
||||
if ( te != null && te instanceof IInventory )
|
||||
{
|
||||
@@ -773,7 +773,7 @@ public class MeteoritePlacer
|
||||
w.setBlock( i, j, k, blk_b, meta_b, 3 );
|
||||
w.setBlock( i, j + 1, k, blk );
|
||||
}
|
||||
else if ( randomShit < 100 * crater )
|
||||
else if ( randomShit < 100 * this.crater )
|
||||
{
|
||||
double dx = i - x;
|
||||
double dy = j - y;
|
||||
@@ -784,12 +784,12 @@ public class MeteoritePlacer
|
||||
if ( !xf.isReplaceable( w.getWorld(), i, j - 1, k ) )
|
||||
{
|
||||
double extraRange = Math.random() * 0.6;
|
||||
double height = crater * (extraRange + 0.2) - Math.abs( dist - crater * 1.7 );
|
||||
double height = this.crater * (extraRange + 0.2) - Math.abs( dist - this.crater * 1.7 );
|
||||
|
||||
if ( xf != blk && height > 0 && Math.random() > 0.6 )
|
||||
{
|
||||
randomShit++;
|
||||
type.getRandomFall( w, i, j, k );
|
||||
this.type.getRandomFall( w, i, j, k );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -806,9 +806,9 @@ public class MeteoritePlacer
|
||||
double dy = j - y;
|
||||
double dz = k - z;
|
||||
|
||||
if ( dx * dx + dy * dy + dz * dz < crater * 1.6 )
|
||||
if ( dx * dx + dy * dy + dz * dz < this.crater * 1.6 )
|
||||
{
|
||||
type.getRandomInset( w, i, j, k );
|
||||
this.type.getRandomInset( w, i, j, k );
|
||||
}
|
||||
|
||||
}
|
||||
@@ -839,6 +839,6 @@ public class MeteoritePlacer
|
||||
|
||||
public NBTTagCompound getSettings()
|
||||
{
|
||||
return settings;
|
||||
return this.settings;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -46,25 +46,25 @@ public class MultiCraftingTracker
|
||||
ICraftingLink[] links = null;
|
||||
|
||||
public MultiCraftingTracker(ICraftingRequester o, int size) {
|
||||
owner = o;
|
||||
this.owner = o;
|
||||
this.size = size;
|
||||
}
|
||||
|
||||
public void readFromNBT(NBTTagCompound extra)
|
||||
{
|
||||
for (int x = 0; x < size; x++)
|
||||
for (int x = 0; x < this.size; x++)
|
||||
{
|
||||
NBTTagCompound link = extra.getCompoundTag( "links-" + x );
|
||||
if ( link != null && !link.hasNoTags() )
|
||||
setLink( x, AEApi.instance().storage().loadCraftingLink( link, owner ) );
|
||||
this.setLink( x, AEApi.instance().storage().loadCraftingLink( link, this.owner ) );
|
||||
}
|
||||
}
|
||||
|
||||
public void writeToNBT(NBTTagCompound extra)
|
||||
{
|
||||
for (int x = 0; x < size; x++)
|
||||
for (int x = 0; x < this.size; x++)
|
||||
{
|
||||
ICraftingLink link = getLink( x );
|
||||
ICraftingLink link = this.getLink( x );
|
||||
if ( link != null )
|
||||
{
|
||||
NBTTagCompound ln = new NBTTagCompound();
|
||||
@@ -78,8 +78,8 @@ public class MultiCraftingTracker
|
||||
{
|
||||
if ( ais != null && d.simulateAdd( ais.getItemStack() ) == null )
|
||||
{
|
||||
Future<ICraftingJob> craftingJob = getJob( x );
|
||||
if ( getLink( x ) != null )
|
||||
Future<ICraftingJob> craftingJob = this.getJob( x );
|
||||
if ( this.getLink( x ) != null )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -93,8 +93,8 @@ public class MultiCraftingTracker
|
||||
|
||||
if ( job != null )
|
||||
{
|
||||
setJob( x, null );
|
||||
setLink( x, cg.submitJob( job, owner, null, false, mySrc ) );
|
||||
this.setJob( x, null );
|
||||
this.setLink( x, cg.submitJob( job, this.owner, null, false, mySrc ) );
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -109,11 +109,11 @@ public class MultiCraftingTracker
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( getLink( x ) == null )
|
||||
if ( this.getLink( x ) == null )
|
||||
{
|
||||
IAEItemStack aisC = ais.copy();
|
||||
aisC.setStackSize( itemToCraft );
|
||||
setJob( x, cg.beginCraftingJob( w, g, mySrc, aisC, null ) );
|
||||
this.setJob( x, cg.beginCraftingJob( w, g, mySrc, aisC, null ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -122,51 +122,51 @@ public class MultiCraftingTracker
|
||||
|
||||
ICraftingLink getLink(int slot)
|
||||
{
|
||||
if ( links == null )
|
||||
if ( this.links == null )
|
||||
return null;
|
||||
|
||||
return links[slot];
|
||||
return this.links[slot];
|
||||
}
|
||||
|
||||
void setLink(int slot, ICraftingLink l)
|
||||
{
|
||||
if ( links == null )
|
||||
links = new ICraftingLink[size];
|
||||
if ( this.links == null )
|
||||
this.links = new ICraftingLink[this.size];
|
||||
|
||||
links[slot] = l;
|
||||
this.links[slot] = l;
|
||||
|
||||
boolean hasStuff = false;
|
||||
for (int x = 0; x < links.length; x++)
|
||||
for (int x = 0; x < this.links.length; x++)
|
||||
{
|
||||
ICraftingLink g = links[x];
|
||||
ICraftingLink g = this.links[x];
|
||||
|
||||
if ( g == null || g.isCanceled() || g.isDone() )
|
||||
links[x] = null;
|
||||
this.links[x] = null;
|
||||
else
|
||||
hasStuff = true;
|
||||
}
|
||||
|
||||
if ( !hasStuff )
|
||||
links = null;
|
||||
this.links = null;
|
||||
}
|
||||
|
||||
Future<ICraftingJob> getJob(int slot)
|
||||
{
|
||||
if ( jobs == null )
|
||||
if ( this.jobs == null )
|
||||
return null;
|
||||
|
||||
return jobs[slot];
|
||||
return this.jobs[slot];
|
||||
}
|
||||
|
||||
void setJob(int slot, Future<ICraftingJob> l)
|
||||
{
|
||||
if ( jobs == null )
|
||||
jobs = new Future[size];
|
||||
if ( this.jobs == null )
|
||||
this.jobs = new Future[this.size];
|
||||
|
||||
jobs[slot] = l;
|
||||
this.jobs[slot] = l;
|
||||
|
||||
boolean hasStuff = false;
|
||||
for (Future<ICraftingJob> job : jobs)
|
||||
for (Future<ICraftingJob> job : this.jobs)
|
||||
{
|
||||
if ( job != null )
|
||||
{
|
||||
@@ -175,26 +175,26 @@ public class MultiCraftingTracker
|
||||
}
|
||||
|
||||
if ( !hasStuff )
|
||||
jobs = null;
|
||||
this.jobs = null;
|
||||
}
|
||||
|
||||
public ImmutableSet<ICraftingLink> getRequestedJobs()
|
||||
{
|
||||
if ( links == null )
|
||||
if ( this.links == null )
|
||||
return ImmutableSet.of();
|
||||
|
||||
return ImmutableSet.copyOf( new NonNullArrayIterator( links ) );
|
||||
return ImmutableSet.copyOf( new NonNullArrayIterator( this.links ) );
|
||||
}
|
||||
|
||||
public void jobStateChange(ICraftingLink link)
|
||||
{
|
||||
if ( links != null )
|
||||
if ( this.links != null )
|
||||
{
|
||||
for (int x = 0; x < links.length; x++)
|
||||
for (int x = 0; x < this.links.length; x++)
|
||||
{
|
||||
if ( links[x] == link )
|
||||
if ( this.links[x] == link )
|
||||
{
|
||||
setLink( x, null );
|
||||
this.setLink( x, null );
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -203,11 +203,11 @@ public class MultiCraftingTracker
|
||||
|
||||
public int getSlot(ICraftingLink link)
|
||||
{
|
||||
if ( links != null )
|
||||
if ( this.links != null )
|
||||
{
|
||||
for (int x = 0; x < links.length; x++)
|
||||
for (int x = 0; x < this.links.length; x++)
|
||||
{
|
||||
if ( links[x] == link )
|
||||
if ( this.links[x] == link )
|
||||
return x;
|
||||
}
|
||||
}
|
||||
@@ -217,31 +217,31 @@ public class MultiCraftingTracker
|
||||
|
||||
public void cancel()
|
||||
{
|
||||
if ( links != null )
|
||||
if ( this.links != null )
|
||||
{
|
||||
for (ICraftingLink l : links)
|
||||
for (ICraftingLink l : this.links)
|
||||
{
|
||||
if ( l != null )
|
||||
l.cancel();
|
||||
}
|
||||
|
||||
links = null;
|
||||
this.links = null;
|
||||
}
|
||||
|
||||
if ( jobs != null )
|
||||
if ( this.jobs != null )
|
||||
{
|
||||
for (Future<ICraftingJob> l : jobs)
|
||||
for (Future<ICraftingJob> l : this.jobs)
|
||||
{
|
||||
if ( l != null )
|
||||
l.cancel( true );
|
||||
}
|
||||
|
||||
jobs = null;
|
||||
this.jobs = null;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isBusy(int slot)
|
||||
{
|
||||
return getLink( slot ) != null || getJob( slot ) != null;
|
||||
return this.getLink( slot ) != null || this.getJob( slot ) != null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -76,15 +76,15 @@ public class PatternHelper implements ICraftingPatternDetails, Comparable<Patter
|
||||
public TestLookup(int slot, Item item, int dmg)
|
||||
{
|
||||
this.slot = slot;
|
||||
ref = (dmg << Platform.DEF_OFFSET) | (Item.getIdFromItem( item ) & 0xffff);
|
||||
this.ref = (dmg << Platform.DEF_OFFSET) | (Item.getIdFromItem( item ) & 0xffff);
|
||||
int offset = 3 * slot;
|
||||
hash = (ref << offset) | (ref >> (offset + 32));
|
||||
this.hash = (this.ref << offset) | (this.ref >> (offset + 32));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode()
|
||||
{
|
||||
return hash;
|
||||
return this.hash;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -95,7 +95,7 @@ public class PatternHelper implements ICraftingPatternDetails, Comparable<Patter
|
||||
if ( obj instanceof TestLookup )
|
||||
{
|
||||
TestLookup b = (TestLookup) obj;
|
||||
equality = b.slot == slot && b.ref == ref;
|
||||
equality = b.slot == this.slot && b.ref == this.ref;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -120,12 +120,12 @@ public class PatternHelper implements ICraftingPatternDetails, Comparable<Patter
|
||||
if ( b == TestStatus.TEST || i.hasTagCompound() )
|
||||
return;
|
||||
|
||||
(b == TestStatus.ACCEPT ? passCache : failCache).add( new TestLookup( slotIndex, i ) );
|
||||
(b == TestStatus.ACCEPT ? this.passCache : this.failCache).add( new TestLookup( slotIndex, i ) );
|
||||
}
|
||||
|
||||
private TestStatus getStatus(int slotIndex, ItemStack i)
|
||||
{
|
||||
if ( crafting.getStackInSlot( slotIndex ) == null )
|
||||
if ( this.crafting.getStackInSlot( slotIndex ) == null )
|
||||
return i == null ? TestStatus.ACCEPT : TestStatus.DECLINE;
|
||||
|
||||
if ( i == null )
|
||||
@@ -134,10 +134,10 @@ public class PatternHelper implements ICraftingPatternDetails, Comparable<Patter
|
||||
if ( i.hasTagCompound() )
|
||||
return TestStatus.TEST;
|
||||
|
||||
if ( passCache.contains( new TestLookup( slotIndex, i ) ) )
|
||||
if ( this.passCache.contains( new TestLookup( slotIndex, i ) ) )
|
||||
return TestStatus.ACCEPT;
|
||||
|
||||
if ( failCache.contains( new TestLookup( slotIndex, i ) ) )
|
||||
if ( this.failCache.contains( new TestLookup( slotIndex, i ) ) )
|
||||
return TestStatus.DECLINE;
|
||||
|
||||
return TestStatus.TEST;
|
||||
@@ -152,9 +152,9 @@ public class PatternHelper implements ICraftingPatternDetails, Comparable<Patter
|
||||
|
||||
NBTTagList inTag = encodedValue.getTagList( "in", 10 );
|
||||
NBTTagList outTag = encodedValue.getTagList( "out", 10 );
|
||||
isCrafting = encodedValue.getBoolean( "crafting" );
|
||||
patternItem = is;
|
||||
pattern = AEItemStack.create( is );
|
||||
this.isCrafting = encodedValue.getBoolean( "crafting" );
|
||||
this.patternItem = is;
|
||||
this.pattern = AEItemStack.create( is );
|
||||
|
||||
List<IAEItemStack> in = new ArrayList<IAEItemStack>();
|
||||
List<IAEItemStack> out = new ArrayList<IAEItemStack>();
|
||||
@@ -162,32 +162,32 @@ public class PatternHelper implements ICraftingPatternDetails, Comparable<Patter
|
||||
for (int x = 0; x < inTag.tagCount(); x++)
|
||||
{
|
||||
ItemStack gs = ItemStack.loadItemStackFromNBT( inTag.getCompoundTagAt( x ) );
|
||||
crafting.setInventorySlotContents( x, gs );
|
||||
this.crafting.setInventorySlotContents( x, gs );
|
||||
|
||||
if ( gs != null && (!isCrafting || !gs.hasTagCompound()) )
|
||||
if ( gs != null && (!this.isCrafting || !gs.hasTagCompound()) )
|
||||
{
|
||||
markItemAs( x, gs, TestStatus.ACCEPT );
|
||||
this.markItemAs( x, gs, TestStatus.ACCEPT );
|
||||
}
|
||||
|
||||
in.add( AEApi.instance().storage().createItemStack( gs ) );
|
||||
testFrame.setInventorySlotContents( x, gs );
|
||||
this.testFrame.setInventorySlotContents( x, gs );
|
||||
}
|
||||
|
||||
if ( isCrafting )
|
||||
if ( this.isCrafting )
|
||||
{
|
||||
standardRecipe = Platform.findMatchingRecipe( crafting, w );
|
||||
if ( standardRecipe != null )
|
||||
this.standardRecipe = Platform.findMatchingRecipe( this.crafting, w );
|
||||
if ( this.standardRecipe != null )
|
||||
{
|
||||
correctOutput = standardRecipe.getCraftingResult( crafting );
|
||||
out.add( AEApi.instance().storage().createItemStack( correctOutput ) );
|
||||
this.correctOutput = this.standardRecipe.getCraftingResult( this.crafting );
|
||||
out.add( AEApi.instance().storage().createItemStack( this.correctOutput ) );
|
||||
}
|
||||
else
|
||||
throw new RuntimeException( "No pattern here!" );
|
||||
}
|
||||
else
|
||||
{
|
||||
standardRecipe = null;
|
||||
correctOutput = null;
|
||||
this.standardRecipe = null;
|
||||
this.correctOutput = null;
|
||||
|
||||
for (int x = 0; x < outTag.tagCount(); x++)
|
||||
{
|
||||
@@ -197,11 +197,11 @@ public class PatternHelper implements ICraftingPatternDetails, Comparable<Patter
|
||||
}
|
||||
}
|
||||
|
||||
outputs = out.toArray( new IAEItemStack[out.size()] );
|
||||
inputs = in.toArray( new IAEItemStack[in.size()] );
|
||||
this.outputs = out.toArray( new IAEItemStack[out.size()] );
|
||||
this.inputs = in.toArray( new IAEItemStack[in.size()] );
|
||||
|
||||
HashMap<IAEItemStack, IAEItemStack> tmpOutputs = new HashMap<IAEItemStack, IAEItemStack>();
|
||||
for (IAEItemStack io : outputs)
|
||||
for (IAEItemStack io : this.outputs)
|
||||
{
|
||||
if ( io == null )
|
||||
continue;
|
||||
@@ -214,7 +214,7 @@ public class PatternHelper implements ICraftingPatternDetails, Comparable<Patter
|
||||
}
|
||||
|
||||
HashMap<IAEItemStack, IAEItemStack> tmpInputs = new HashMap<IAEItemStack, IAEItemStack>();
|
||||
for (IAEItemStack io : inputs)
|
||||
for (IAEItemStack io : this.inputs)
|
||||
{
|
||||
if ( io == null )
|
||||
continue;
|
||||
@@ -230,25 +230,25 @@ public class PatternHelper implements ICraftingPatternDetails, Comparable<Patter
|
||||
throw new RuntimeException( "No pattern here!" );
|
||||
|
||||
int offset = 0;
|
||||
condensedInputs = new IAEItemStack[tmpInputs.size()];
|
||||
this.condensedInputs = new IAEItemStack[tmpInputs.size()];
|
||||
for (IAEItemStack io : tmpInputs.values())
|
||||
condensedInputs[offset++] = io;
|
||||
this.condensedInputs[offset++] = io;
|
||||
|
||||
offset = 0;
|
||||
condensedOutputs = new IAEItemStack[tmpOutputs.size()];
|
||||
this.condensedOutputs = new IAEItemStack[tmpOutputs.size()];
|
||||
for (IAEItemStack io : tmpOutputs.values())
|
||||
condensedOutputs[offset++] = io;
|
||||
this.condensedOutputs[offset++] = io;
|
||||
}
|
||||
|
||||
@Override
|
||||
synchronized public boolean isValidItemForSlot(int slotIndex, ItemStack i, World w)
|
||||
{
|
||||
if ( !isCrafting )
|
||||
if ( !this.isCrafting )
|
||||
{
|
||||
throw new RuntimeException( "Only crafting recipes supported." );
|
||||
}
|
||||
|
||||
TestStatus result = getStatus( slotIndex, i );
|
||||
TestStatus result = this.getStatus( slotIndex, i );
|
||||
|
||||
switch (result)
|
||||
{
|
||||
@@ -261,52 +261,52 @@ public class PatternHelper implements ICraftingPatternDetails, Comparable<Patter
|
||||
break;
|
||||
}
|
||||
|
||||
for (int x = 0; x < crafting.getSizeInventory(); x++)
|
||||
testFrame.setInventorySlotContents( x, crafting.getStackInSlot( x ) );
|
||||
for (int x = 0; x < this.crafting.getSizeInventory(); x++)
|
||||
this.testFrame.setInventorySlotContents( x, this.crafting.getStackInSlot( x ) );
|
||||
|
||||
testFrame.setInventorySlotContents( slotIndex, i );
|
||||
this.testFrame.setInventorySlotContents( slotIndex, i );
|
||||
|
||||
if ( standardRecipe.matches( testFrame, w ) )
|
||||
if ( this.standardRecipe.matches( this.testFrame, w ) )
|
||||
{
|
||||
ItemStack testOutput = standardRecipe.getCraftingResult( testFrame );
|
||||
ItemStack testOutput = this.standardRecipe.getCraftingResult( this.testFrame );
|
||||
|
||||
if ( Platform.isSameItemPrecise( correctOutput, testOutput ) )
|
||||
if ( Platform.isSameItemPrecise( this.correctOutput, testOutput ) )
|
||||
{
|
||||
testFrame.setInventorySlotContents( slotIndex, crafting.getStackInSlot( slotIndex ) );
|
||||
markItemAs( slotIndex, i, TestStatus.ACCEPT );
|
||||
this.testFrame.setInventorySlotContents( slotIndex, this.crafting.getStackInSlot( slotIndex ) );
|
||||
this.markItemAs( slotIndex, i, TestStatus.ACCEPT );
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ItemStack testOutput = CraftingManager.getInstance().findMatchingRecipe( testFrame, w );
|
||||
ItemStack testOutput = CraftingManager.getInstance().findMatchingRecipe( this.testFrame, w );
|
||||
|
||||
if ( Platform.isSameItemPrecise( correctOutput, testOutput ) )
|
||||
if ( Platform.isSameItemPrecise( this.correctOutput, testOutput ) )
|
||||
{
|
||||
testFrame.setInventorySlotContents( slotIndex, crafting.getStackInSlot( slotIndex ) );
|
||||
markItemAs( slotIndex, i, TestStatus.ACCEPT );
|
||||
this.testFrame.setInventorySlotContents( slotIndex, this.crafting.getStackInSlot( slotIndex ) );
|
||||
this.markItemAs( slotIndex, i, TestStatus.ACCEPT );
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
markItemAs( slotIndex, i, TestStatus.DECLINE );
|
||||
this.markItemAs( slotIndex, i, TestStatus.DECLINE );
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getOutput(InventoryCrafting craftingInv, World w)
|
||||
{
|
||||
if ( !isCrafting )
|
||||
if ( !this.isCrafting )
|
||||
throw new RuntimeException( "Only crafting recipes supported." );
|
||||
|
||||
for (int x = 0; x < craftingInv.getSizeInventory(); x++)
|
||||
{
|
||||
if ( !isValidItemForSlot( x, craftingInv.getStackInSlot( x ), w ) )
|
||||
if ( !this.isValidItemForSlot( x, craftingInv.getStackInSlot( x ), w ) )
|
||||
return null;
|
||||
}
|
||||
|
||||
if ( outputs != null && outputs.length > 0 )
|
||||
return outputs[0].getItemStack();
|
||||
if ( this.outputs != null && this.outputs.length > 0 )
|
||||
return this.outputs[0].getItemStack();
|
||||
|
||||
return null;
|
||||
}
|
||||
@@ -320,49 +320,49 @@ public class PatternHelper implements ICraftingPatternDetails, Comparable<Patter
|
||||
@Override
|
||||
public boolean isCraftable()
|
||||
{
|
||||
return isCrafting;
|
||||
return this.isCrafting;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IAEItemStack[] getInputs()
|
||||
{
|
||||
return inputs;
|
||||
return this.inputs;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IAEItemStack[] getOutputs()
|
||||
{
|
||||
return outputs;
|
||||
return this.outputs;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getPattern()
|
||||
{
|
||||
return patternItem;
|
||||
return this.patternItem;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IAEItemStack[] getCondensedInputs()
|
||||
{
|
||||
return condensedInputs;
|
||||
return this.condensedInputs;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IAEItemStack[] getCondensedOutputs()
|
||||
{
|
||||
return condensedOutputs;
|
||||
return this.condensedOutputs;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compareTo(PatternHelper o)
|
||||
{
|
||||
return ItemSorters.compareInt( o.priority, priority );
|
||||
return ItemSorters.compareInt( o.priority, this.priority );
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode()
|
||||
{
|
||||
return pattern.hashCode();
|
||||
return this.pattern.hashCode();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -370,11 +370,11 @@ public class PatternHelper implements ICraftingPatternDetails, Comparable<Patter
|
||||
{
|
||||
if ( obj == null )
|
||||
return false;
|
||||
if ( getClass() != obj.getClass() )
|
||||
if ( this.getClass() != obj.getClass() )
|
||||
return false;
|
||||
PatternHelper other = (PatternHelper) obj;
|
||||
if ( pattern != null && other.pattern != null )
|
||||
return pattern.equals( other.pattern );
|
||||
if ( this.pattern != null && other.pattern != null )
|
||||
return this.pattern.equals( other.pattern );
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -387,6 +387,6 @@ public class PatternHelper implements ICraftingPatternDetails, Comparable<Patter
|
||||
@Override
|
||||
public int getPriority()
|
||||
{
|
||||
return priority;
|
||||
return this.priority;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,12 +30,12 @@ public class PlayerSecurityWrapper implements ISecurityRegistry
|
||||
final HashMap<Integer, EnumSet<SecurityPermissions>> target;
|
||||
|
||||
public PlayerSecurityWrapper(HashMap<Integer, EnumSet<SecurityPermissions>> playerPerms) {
|
||||
target = playerPerms;
|
||||
this.target = playerPerms;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addPlayer(int PlayerID, EnumSet<SecurityPermissions> permissions)
|
||||
{
|
||||
target.put( PlayerID, permissions );
|
||||
this.target.put( PlayerID, permissions );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,8 +27,8 @@ public class Splotch
|
||||
{
|
||||
|
||||
public Splotch(AEColor col, boolean lit, ForgeDirection side, Vec3 Pos) {
|
||||
color = col;
|
||||
lumen = lit;
|
||||
this.color = col;
|
||||
this.lumen = lit;
|
||||
|
||||
double x, y;
|
||||
|
||||
@@ -59,18 +59,18 @@ public class Splotch
|
||||
|
||||
public Splotch(ByteBuf data) {
|
||||
|
||||
pos = data.readByte();
|
||||
this.pos = data.readByte();
|
||||
int val = data.readByte();
|
||||
|
||||
side = ForgeDirection.getOrientation( val & 0x07 );
|
||||
color = AEColor.values()[(val >> 3) & 0x0F];
|
||||
lumen = ((val >> 7) & 0x01) > 0;
|
||||
this.side = ForgeDirection.getOrientation( val & 0x07 );
|
||||
this.color = AEColor.values()[(val >> 3) & 0x0F];
|
||||
this.lumen = ((val >> 7) & 0x01) > 0;
|
||||
}
|
||||
|
||||
public void writeToStream(ByteBuf stream)
|
||||
{
|
||||
stream.writeByte( pos );
|
||||
int val = side.ordinal() | (color.ordinal() << 3) | (lumen ? 0x80 : 0x00);
|
||||
stream.writeByte( this.pos );
|
||||
int val = this.side.ordinal() | (this.color.ordinal() << 3) | (this.lumen ? 0x80 : 0x00);
|
||||
stream.writeByte( val );
|
||||
}
|
||||
|
||||
@@ -81,17 +81,17 @@ public class Splotch
|
||||
|
||||
public float x()
|
||||
{
|
||||
return (pos & 0x0f) / 15.0f;
|
||||
return (this.pos & 0x0f) / 15.0f;
|
||||
}
|
||||
|
||||
public float y()
|
||||
{
|
||||
return ((pos >> 4) & 0x0f) / 15.0f;
|
||||
return ((this.pos >> 4) & 0x0f) / 15.0f;
|
||||
}
|
||||
|
||||
public int getSeed()
|
||||
{
|
||||
int val = side.ordinal() | (color.ordinal() << 3) | (lumen ? 0x80 : 0x00);
|
||||
return Math.abs( pos + val );
|
||||
int val = this.side.ordinal() | (this.color.ordinal() << 3) | (this.lumen ? 0x80 : 0x00);
|
||||
return Math.abs( this.pos + val );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -66,20 +66,20 @@ public class WirelessTerminalGuiObject implements IPortableCell, IActionHost
|
||||
|
||||
public double getRange()
|
||||
{
|
||||
return myRange;
|
||||
return this.myRange;
|
||||
}
|
||||
|
||||
public WirelessTerminalGuiObject(IWirelessTermHandler wh, ItemStack is, EntityPlayer ep, World w, int x, int y, int z) {
|
||||
encryptionKey = wh.getEncryptionKey( is );
|
||||
effectiveItem = is;
|
||||
myPlayer = ep;
|
||||
wth = wh;
|
||||
this.encryptionKey = wh.getEncryptionKey( is );
|
||||
this.effectiveItem = is;
|
||||
this.myPlayer = ep;
|
||||
this.wth = wh;
|
||||
|
||||
Object obj = null;
|
||||
|
||||
try
|
||||
{
|
||||
long encKey = Long.parseLong( encryptionKey );
|
||||
long encKey = Long.parseLong( this.encryptionKey );
|
||||
obj = AEApi.instance().registries().locatable().findLocatableBySerial( encKey );
|
||||
}
|
||||
catch (NumberFormatException err)
|
||||
@@ -92,12 +92,12 @@ public class WirelessTerminalGuiObject implements IPortableCell, IActionHost
|
||||
IGridNode n = ((IGridHost) obj).getGridNode( ForgeDirection.UNKNOWN );
|
||||
if ( n != null )
|
||||
{
|
||||
targetGrid = n.getGrid();
|
||||
if ( targetGrid != null )
|
||||
this.targetGrid = n.getGrid();
|
||||
if ( this.targetGrid != null )
|
||||
{
|
||||
sg = targetGrid.getCache( IStorageGrid.class );
|
||||
if ( sg != null )
|
||||
itemStorage = sg.getItemInventory();
|
||||
this.sg = this.targetGrid.getCache( IStorageGrid.class );
|
||||
if ( this.sg != null )
|
||||
this.itemStorage = this.sg.getItemInventory();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -105,32 +105,32 @@ public class WirelessTerminalGuiObject implements IPortableCell, IActionHost
|
||||
|
||||
public boolean rangeCheck()
|
||||
{
|
||||
sqRange = myRange = Double.MAX_VALUE;
|
||||
this.sqRange = this.myRange = Double.MAX_VALUE;
|
||||
|
||||
if ( targetGrid != null && itemStorage != null )
|
||||
if ( this.targetGrid != null && this.itemStorage != null )
|
||||
{
|
||||
if ( myWap != null )
|
||||
if ( this.myWap != null )
|
||||
{
|
||||
if ( myWap.getGrid() == targetGrid )
|
||||
if ( this.myWap.getGrid() == this.targetGrid )
|
||||
{
|
||||
if ( testWap( myWap ) )
|
||||
if ( this.testWap( this.myWap ) )
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
IMachineSet tw = targetGrid.getMachines( TileWireless.class );
|
||||
IMachineSet tw = this.targetGrid.getMachines( TileWireless.class );
|
||||
|
||||
myWap = null;
|
||||
this.myWap = null;
|
||||
|
||||
for (IGridNode n : tw)
|
||||
{
|
||||
IWirelessAccessPoint wap = (IWirelessAccessPoint) n.getMachine();
|
||||
if ( testWap( wap ) )
|
||||
myWap = wap;
|
||||
if ( this.testWap( wap ) )
|
||||
this.myWap = wap;
|
||||
}
|
||||
|
||||
return myWap != null;
|
||||
return this.myWap != null;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@@ -142,19 +142,19 @@ public class WirelessTerminalGuiObject implements IPortableCell, IActionHost
|
||||
|
||||
DimensionalCoord dc = wap.getLocation();
|
||||
|
||||
if ( dc.getWorld() == myPlayer.worldObj )
|
||||
if ( dc.getWorld() == this.myPlayer.worldObj )
|
||||
{
|
||||
double offX = dc.x - myPlayer.posX;
|
||||
double offY = dc.y - myPlayer.posY;
|
||||
double offZ = dc.z - myPlayer.posZ;
|
||||
double offX = dc.x - this.myPlayer.posX;
|
||||
double offY = dc.y - this.myPlayer.posY;
|
||||
double offZ = dc.z - this.myPlayer.posZ;
|
||||
|
||||
double r = offX * offX + offY * offY + offZ * offZ;
|
||||
if ( r < rangeLimit && sqRange > r )
|
||||
if ( r < rangeLimit && this.sqRange > r )
|
||||
{
|
||||
if ( wap.isActive() )
|
||||
{
|
||||
sqRange = r;
|
||||
myRange = Math.sqrt( r );
|
||||
this.sqRange = r;
|
||||
this.myRange = Math.sqrt( r );
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -165,121 +165,121 @@ public class WirelessTerminalGuiObject implements IPortableCell, IActionHost
|
||||
@Override
|
||||
public IMEMonitor<IAEItemStack> getItemInventory()
|
||||
{
|
||||
if ( sg == null )
|
||||
if ( this.sg == null )
|
||||
return null;
|
||||
return sg.getItemInventory();
|
||||
return this.sg.getItemInventory();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMEMonitor<IAEFluidStack> getFluidInventory()
|
||||
{
|
||||
if ( sg == null )
|
||||
if ( this.sg == null )
|
||||
return null;
|
||||
return sg.getFluidInventory();
|
||||
return this.sg.getFluidInventory();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addListener(IMEMonitorHandlerReceiver<IAEItemStack> l, Object verificationToken)
|
||||
{
|
||||
if ( itemStorage != null )
|
||||
itemStorage.addListener( l, verificationToken );
|
||||
if ( this.itemStorage != null )
|
||||
this.itemStorage.addListener( l, verificationToken );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeListener(IMEMonitorHandlerReceiver<IAEItemStack> l)
|
||||
{
|
||||
if ( itemStorage != null )
|
||||
itemStorage.removeListener( l );
|
||||
if ( this.itemStorage != null )
|
||||
this.itemStorage.removeListener( l );
|
||||
}
|
||||
|
||||
@Override
|
||||
public IItemList<IAEItemStack> getAvailableItems(IItemList out)
|
||||
{
|
||||
if ( itemStorage != null )
|
||||
return itemStorage.getAvailableItems( out );
|
||||
if ( this.itemStorage != null )
|
||||
return this.itemStorage.getAvailableItems( out );
|
||||
return out;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IItemList<IAEItemStack> getStorageList()
|
||||
{
|
||||
if ( itemStorage != null )
|
||||
return itemStorage.getStorageList();
|
||||
if ( this.itemStorage != null )
|
||||
return this.itemStorage.getStorageList();
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AccessRestriction getAccess()
|
||||
{
|
||||
if ( itemStorage != null )
|
||||
return itemStorage.getAccess();
|
||||
if ( this.itemStorage != null )
|
||||
return this.itemStorage.getAccess();
|
||||
return AccessRestriction.NO_ACCESS;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isPrioritized(IAEItemStack input)
|
||||
{
|
||||
if ( itemStorage != null )
|
||||
return itemStorage.isPrioritized( input );
|
||||
if ( this.itemStorage != null )
|
||||
return this.itemStorage.isPrioritized( input );
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canAccept(IAEItemStack input)
|
||||
{
|
||||
if ( itemStorage != null )
|
||||
return itemStorage.canAccept( input );
|
||||
if ( this.itemStorage != null )
|
||||
return this.itemStorage.canAccept( input );
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getPriority()
|
||||
{
|
||||
if ( itemStorage != null )
|
||||
return itemStorage.getPriority();
|
||||
if ( this.itemStorage != null )
|
||||
return this.itemStorage.getPriority();
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSlot()
|
||||
{
|
||||
if ( itemStorage != null )
|
||||
return itemStorage.getSlot();
|
||||
if ( this.itemStorage != null )
|
||||
return this.itemStorage.getSlot();
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IAEItemStack injectItems(IAEItemStack input, Actionable type, BaseActionSource src)
|
||||
{
|
||||
if ( itemStorage != null )
|
||||
return itemStorage.injectItems( input, type, src );
|
||||
if ( this.itemStorage != null )
|
||||
return this.itemStorage.injectItems( input, type, src );
|
||||
return input;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IAEItemStack extractItems(IAEItemStack request, Actionable mode, BaseActionSource src)
|
||||
{
|
||||
if ( itemStorage != null )
|
||||
return itemStorage.extractItems( request, mode, src );
|
||||
if ( this.itemStorage != null )
|
||||
return this.itemStorage.extractItems( request, mode, src );
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public StorageChannel getChannel()
|
||||
{
|
||||
if ( itemStorage != null )
|
||||
return itemStorage.getChannel();
|
||||
if ( this.itemStorage != null )
|
||||
return this.itemStorage.getChannel();
|
||||
return StorageChannel.ITEMS;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double extractAEPower(double amt, Actionable mode, PowerMultiplier usePowerMultiplier)
|
||||
{
|
||||
if ( wth != null && effectiveItem != null )
|
||||
if ( this.wth != null && this.effectiveItem != null )
|
||||
{
|
||||
if ( mode == Actionable.SIMULATE )
|
||||
return wth.hasPower( myPlayer, amt, getItemStack() ) ? amt : 0;
|
||||
return wth.usePower( myPlayer, amt, getItemStack() ) ? amt : 0;
|
||||
return this.wth.hasPower( this.myPlayer, amt, this.getItemStack() ) ? amt : 0;
|
||||
return this.wth.usePower( this.myPlayer, amt, this.getItemStack() ) ? amt : 0;
|
||||
}
|
||||
return 0.0;
|
||||
}
|
||||
@@ -287,13 +287,13 @@ public class WirelessTerminalGuiObject implements IPortableCell, IActionHost
|
||||
@Override
|
||||
public ItemStack getItemStack()
|
||||
{
|
||||
return effectiveItem;
|
||||
return this.effectiveItem;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IConfigManager getConfigManager()
|
||||
{
|
||||
return wth.getConfigManager( effectiveItem );
|
||||
return this.wth.getConfigManager( this.effectiveItem );
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -317,16 +317,16 @@ public class WirelessTerminalGuiObject implements IPortableCell, IActionHost
|
||||
@Override
|
||||
public IGridNode getActionableNode()
|
||||
{
|
||||
rangeCheck();
|
||||
if ( myWap != null )
|
||||
return myWap.getActionableNode();
|
||||
this.rangeCheck();
|
||||
if ( this.myWap != null )
|
||||
return this.myWap.getActionableNode();
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean validForPass(int i)
|
||||
{
|
||||
return itemStorage.validForPass( i );
|
||||
return this.itemStorage.validForPass( i );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user