Compare commits

...

13 Commits

Author SHA1 Message Date
PrototypeTrousers 304f394497 cut crafting tree earlier if the item is available
fix job byte size to 8 per crafting + 1 per item used/stored
2021-11-02 15:33:14 -03:00
PrototypeTrousers 50f21125c8 log if non-patterned items go missing before starting a craft 2021-11-02 02:00:01 -03:00
PrototypeTrousers 30b85bd239 potential fix for showing proper item names when failing to start craft 2021-11-01 23:23:45 -03:00
PrototypeTrousers 9ce00d338f only try to extract if its already in the cache 2021-10-29 17:04:24 -03:00
PrototypeTrousers 11f5b71089 update directly instead of relying on forge events 2021-10-29 15:14:33 -03:00
PrototypeTrousers e7da72163b backported #5349 2021-10-29 15:13:46 -03:00
PrototypeTrousers 6d7c65dd70 potential fix for an infinite loop while adding nodes 2021-10-29 14:09:19 -03:00
PrototypeTrousers 5e21101619 n-to-n p2p
network monitor checks nesting by action source
2021-10-28 23:49:16 -03:00
PrototypeTrousers 3db8d0185f fix security terminal and portable cell stored items not showing 2021-10-23 17:56:15 -03:00
PrototypeTrousers 2f5ecfe638 energy fixes 2021-10-22 15:37:08 -03:00
PrototypeTrousers 75843e802d WIP 2021-10-21 12:22:00 -03:00
PrototypeTrousers e41b6943aa fix swapping cells giving wrong item/fluid count 2021-09-28 23:29:52 -03:00
PrototypeTrousers 92347ad2f5 fix looping item count and hopefully energy issues 2021-09-26 22:07:16 -03:00
42 changed files with 725 additions and 450 deletions
+1 -1
View File
@@ -3,7 +3,7 @@ aechannel=stable
aebuild=7 aebuild=7
aegroup=appeng aegroup=appeng
aebasename=appliedenergistics2 aebasename=appliedenergistics2
trousers=omni-fixes-v46aa trousers=omni-fixes-v49b
######################################################### #########################################################
# Versions # # Versions #
@@ -31,8 +31,10 @@ public enum WailaText
DeviceMissingChannel, DeviceMissingChannel,
P2PUnlinked, P2PUnlinked,
P2PInputOneOutput, P2P_INPUT_ONE_OUTPUT,
P2PInputManyOutputs, P2P_INPUT_MANY_OUTPUTS,
P2P_OUTPUT_ONE_INPUT,
P2P_OUTPUT_MANY_INPUTS,
P2POutput, P2POutput,
Locked, Locked,
@@ -25,6 +25,7 @@ import java.util.List;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import net.minecraft.util.text.TextComponentString;
import net.minecraft.world.World; import net.minecraft.world.World;
import appeng.api.AEApi; import appeng.api.AEApi;
@@ -123,18 +124,43 @@ public class CraftingTreeNode
final List<IAEItemStack> thingsUsed = new ArrayList<>(); final List<IAEItemStack> thingsUsed = new ArrayList<>();
this.what.setStackSize( l ); this.what.setStackSize( l );
if( this.getSlot() >= 0 && this.parent != null && this.parent.details.isCraftable() ) IAEItemStack available = inv.extractItems( this.what, Actionable.MODULATE, src );
if( available != null )
{
if( !this.exhausted )
{
final IAEItemStack is = this.job.checkUse( available );
if( is != null )
{
thingsUsed.add( is.copy() );
this.used.add( is );
}
}
this.bytes += available.getStackSize();
l -= available.getStackSize();
if( l == 0 )
{
return available;
}
}
else if( this.getSlot() >= 0 && this.parent != null && this.parent.details.isCraftable() )
{ {
final Collection<IAEItemStack> itemList; final Collection<IAEItemStack> itemList;
final IItemList<IAEItemStack> inventoryList = inv.getItemList(); final IItemList<IAEItemStack> inventoryList = inv.getItemList();
if( this.parent.details.canSubstitute() ) if( this.parent.details.canSubstitute() )
{ {
final List<IAEItemStack> substitutes = this.parent.details.getSubstituteInputs(this.slot); final List<IAEItemStack> substitutes = this.parent.details.getSubstituteInputs( this.slot );
itemList = new ArrayList<>(substitutes.size()); itemList = new ArrayList<>( substitutes.size() );
for (IAEItemStack stack : substitutes) { for( IAEItemStack stack : substitutes )
itemList.addAll(inventoryList.findFuzzy(stack, FuzzyMode.IGNORE_ALL)); {
itemList.addAll( inventoryList.findFuzzy( stack, FuzzyMode.IGNORE_ALL ) );
} }
} }
else else
@@ -156,7 +182,7 @@ public class CraftingTreeNode
fuzz = fuzz.copy(); fuzz = fuzz.copy();
fuzz.setStackSize( l ); fuzz.setStackSize( l );
final IAEItemStack available = inv.extractItems( fuzz, Actionable.MODULATE, src ); available = inv.extractItems( fuzz, Actionable.MODULATE, src );
if( available != null ) if( available != null )
{ {
@@ -182,32 +208,6 @@ public class CraftingTreeNode
} }
} }
} }
else
{
final IAEItemStack available = inv.extractItems( this.what, Actionable.MODULATE, src );
if( available != null )
{
if( !this.exhausted )
{
final IAEItemStack is = this.job.checkUse( available );
if( is != null )
{
thingsUsed.add( is.copy() );
this.used.add( is );
}
}
this.bytes += available.getStackSize();
l -= available.getStackSize();
if( l == 0 )
{
return available;
}
}
}
if( this.canEmit ) if( this.canEmit )
{ {
@@ -226,7 +226,7 @@ public class CraftingTreeNode
{ {
final CraftingTreeProcess pro = this.nodes.get( 0 ); final CraftingTreeProcess pro = this.nodes.get( 0 );
while( pro.possible && l > 0 ) while ( pro.possible && l > 0 )
{ {
final IAEItemStack madeWhat = pro.getAmountCrafted( this.what ); final IAEItemStack madeWhat = pro.getAmountCrafted( this.what );
@@ -234,7 +234,7 @@ public class CraftingTreeNode
madeWhat.setStackSize( l ); madeWhat.setStackSize( l );
final IAEItemStack available = inv.extractItems( madeWhat, Actionable.MODULATE, src ); available = inv.extractItems( madeWhat, Actionable.MODULATE, src );
if( available != null ) if( available != null )
{ {
@@ -258,13 +258,13 @@ public class CraftingTreeNode
{ {
try try
{ {
while( pro.possible && l > 0 ) while ( pro.possible && l > 0 )
{ {
final MECraftingInventory subInv = new MECraftingInventory( inv, true, true, true ); final MECraftingInventory subInv = new MECraftingInventory( inv, true, true, true );
pro.request( subInv, 1, src ); pro.request( subInv, 1, src );
this.what.setStackSize( l ); this.what.setStackSize( l );
final IAEItemStack available = subInv.extractItems( this.what, Actionable.MODULATE, src ); available = subInv.extractItems( this.what, Actionable.MODULATE, src );
if( available != null ) if( available != null )
{ {
@@ -321,7 +321,7 @@ public class CraftingTreeNode
} }
// missing = 0; // missing = 0;
job.addBytes( 8 + this.bytes ); job.addBytes( this.bytes );
for( final CraftingTreeProcess pro : this.nodes ) for( final CraftingTreeProcess pro : this.nodes )
{ {
@@ -358,6 +358,10 @@ public class CraftingTreeNode
if( ex == null || ex.getStackSize() != i.getStackSize() ) if( ex == null || ex.getStackSize() != i.getStackSize() )
{ {
if( src.player().isPresent() )
{
src.player().get().sendStatusMessage( new TextComponentString( "System reported " + i.getStackSize() + " " + i.getDefinition().getItem().getItemStackDisplayName( i.getDefinition() ) + " available but could not extract anything" ), false );
}
throw new CraftBranchFailure( i, i.getStackSize() ); throw new CraftBranchFailure( i, i.getStackSize() );
} }
@@ -241,7 +241,6 @@ public class CraftingTreeProcess
o.setStackSize( o.getStackSize() * i ); o.setStackSize( o.getStackSize() * i );
inv.injectItems( o, Actionable.MODULATE, src ); inv.injectItems( o, Actionable.MODULATE, src );
} }
this.crafts += i; this.crafts += i;
} }
@@ -253,7 +252,7 @@ public class CraftingTreeProcess
pro.dive( job ); pro.dive( job );
} }
job.addBytes( 8 + this.crafts + this.bytes ); job.addBytes( this.crafts * 8 + this.bytes );
} }
IAEItemStack getAmountCrafted( IAEItemStack what2 ) IAEItemStack getAmountCrafted( IAEItemStack what2 )
@@ -312,9 +312,13 @@ public class MECraftingInventory implements IMEInventory<IAEItemStack>
if( src.player().isPresent() ) if( src.player().isPresent() )
{ {
if( result == null ) if( result == null )
src.player().get().sendStatusMessage( new TextComponentString( "System reported " + extra.getStackSize() + " " + extra.getDefinition().getDisplayName() + " available but could not extract anything" ), false ); {
src.player().get().sendStatusMessage( new TextComponentString( "System reported " + extra.getStackSize() + " " + extra.getDefinition().getItem().getItemStackDisplayName( extra.getDefinition() ) + " available but could not extract anything" ), false );
}
else else
src.player().get().sendStatusMessage( new TextComponentString( "System reported " + extra.getStackSize() + " " + extra.getDefinition().getDisplayName() + " available but could only extract " + result.getStackSize() ), false ); {
src.player().get().sendStatusMessage( new TextComponentString( "System reported " + extra.getStackSize() + " " + extra.getDefinition().getItem().getItemStackDisplayName( extra.getDefinition() ) + " available but could only extract " + result.getStackSize() ), false );
}
} }
failed = true; failed = true;
if( !src.player().isPresent() ) break; if( !src.player().isPresent() ) break;
@@ -386,7 +386,7 @@ public class DualityFluidInterface implements IGridTickable, IStorageMonitorable
{ {
changed = true; changed = true;
} }
else else if( this.gridProxy.getStorage().getInventory( AEApi.instance().storage().getStorageChannel( IFluidStorageChannel.class ) ).getStorageList().findPrecise( work ) != null )
{ {
final IAEFluidStack acquired = Platform.poweredExtraction( src, dest, work, this.interfaceRequestSource ); final IAEFluidStack acquired = Platform.poweredExtraction( src, dest, work, this.interfaceRequestSource );
if( acquired != null ) if( acquired != null )
@@ -178,8 +178,9 @@ public class PartFluidFormationPlane extends PartAbstractFormationPlane<IAEFluid
this.stateChanged(); this.stateChanged();
} }
@Override
@MENetworkEventSubscribe @MENetworkEventSubscribe
public void updateChannels( final MENetworkChannelsChanged changedChannels ) public void chanRender( final MENetworkChannelsChanged changedChannels )
{ {
this.stateChanged(); this.stateChanged();
} }
@@ -90,14 +90,16 @@ public class PartFluidInterface extends PartBasicState implements IGridTickable,
return this.duality; return this.duality;
} }
@Override
@MENetworkEventSubscribe @MENetworkEventSubscribe
public void stateChange( final MENetworkChannelsChanged c ) public void chanRender( final MENetworkChannelsChanged c )
{ {
this.duality.notifyNeighbors(); this.duality.notifyNeighbors();
} }
@Override
@MENetworkEventSubscribe @MENetworkEventSubscribe
public void stateChange( final MENetworkPowerStatusChange c ) public void powerRender( final MENetworkPowerStatusChange c )
{ {
this.duality.notifyNeighbors(); this.duality.notifyNeighbors();
} }
@@ -4,7 +4,6 @@ package appeng.fluids.parts;
import java.util.Random; import java.util.Random;
import appeng.api.networking.events.MENetworkChannelChanged;
import appeng.api.storage.data.IItemList; import appeng.api.storage.data.IItemList;
import appeng.fluids.helper.IConfigurableFluidInventory; import appeng.fluids.helper.IConfigurableFluidInventory;
import appeng.me.cache.NetworkMonitor; import appeng.me.cache.NetworkMonitor;
@@ -118,7 +117,7 @@ public class PartFluidLevelEmitter extends PartUpgradeable implements IStackWatc
{ {
if( chan == AEApi.instance().storage().getStorageChannel( IFluidStorageChannel.class ) && diffStack.equals( this.config.getFluidInSlot( 0 ) ) ) if( chan == AEApi.instance().storage().getStorageChannel( IFluidStorageChannel.class ) && diffStack.equals( this.config.getFluidInSlot( 0 ) ) )
{ {
this.lastReportedValue += diffStack.getStackSize(); this.lastReportedValue = fullStack.getStackSize();
this.updateState(); this.updateState();
} }
} }
@@ -129,8 +128,9 @@ public class PartFluidLevelEmitter extends PartUpgradeable implements IStackWatc
this.configureWatchers(); this.configureWatchers();
} }
@Override
@MENetworkEventSubscribe @MENetworkEventSubscribe
public void powerStatusChange( final MENetworkPowerStatusChange powerEvent ) public void powerRender( final MENetworkPowerStatusChange powerEvent )
{ {
if (this.getProxy().isActive()) if (this.getProxy().isActive())
{ {
@@ -139,8 +139,9 @@ public class PartFluidLevelEmitter extends PartUpgradeable implements IStackWatc
this.updateState(); this.updateState();
} }
@Override
@MENetworkEventSubscribe @MENetworkEventSubscribe
public void channelChanged( final MENetworkChannelsChanged c ) public void chanRender( final MENetworkChannelsChanged c )
{ {
if (this.getProxy().isActive()) if (this.getProxy().isActive())
{ {
@@ -25,7 +25,10 @@ import java.util.Objects;
import javax.annotation.Nonnull; import javax.annotation.Nonnull;
import appeng.api.networking.storage.IStorageGrid;
import appeng.api.storage.channels.IItemStorageChannel;
import appeng.fluids.helper.IConfigurableFluidInventory; import appeng.fluids.helper.IConfigurableFluidInventory;
import appeng.me.cache.GridStorageCache;
import appeng.util.ConfigManager; import appeng.util.ConfigManager;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
@@ -170,7 +173,6 @@ public class PartFluidStorageBus extends PartSharedStorageBus implements IMEMoni
final MEInventoryHandler<IAEFluidStack> in = this.getInternalHandler(); final MEInventoryHandler<IAEFluidStack> in = this.getInternalHandler();
IItemList<IAEFluidStack> before = AEApi.instance().storage().getStorageChannel( IFluidStorageChannel.class ).createList(); IItemList<IAEFluidStack> before = AEApi.instance().storage().getStorageChannel( IFluidStorageChannel.class ).createList();
boolean denyRead = false;
if( in != null ) if( in != null )
{ {
if( accessChanged ) if( accessChanged )
@@ -179,7 +181,7 @@ public class PartFluidStorageBus extends PartSharedStorageBus implements IMEMoni
AccessRestriction oldAccess = (AccessRestriction) ( (ConfigManager) this.getConfigManager() ).getOldSetting( Settings.ACCESS ); AccessRestriction oldAccess = (AccessRestriction) ( (ConfigManager) this.getConfigManager() ).getOldSetting( Settings.ACCESS );
if( oldAccess.hasPermission( AccessRestriction.READ ) && !currentAccess.hasPermission( AccessRestriction.READ ) ) if( oldAccess.hasPermission( AccessRestriction.READ ) && !currentAccess.hasPermission( AccessRestriction.READ ) )
{ {
denyRead = true; readOncePass = true;
} }
in.setBaseAccess( oldAccess ); in.setBaseAccess( oldAccess );
before = in.getAvailableItems( before ); before = in.getAvailableItems( before );
@@ -199,16 +201,14 @@ public class PartFluidStorageBus extends PartSharedStorageBus implements IMEMoni
} }
final MEInventoryHandler<IAEFluidStack> out = this.getInternalHandler(); final MEInventoryHandler<IAEFluidStack> out = this.getInternalHandler();
IItemList<IAEFluidStack> after = AEApi.instance().storage().getStorageChannel( IFluidStorageChannel.class ).createList();
if( in != out || denyRead ) if( in != out )
{ {
IItemList<IAEFluidStack> after = AEApi.instance().storage().getStorageChannel( IFluidStorageChannel.class ).createList(); if( out != null )
if( out != null && !denyRead )
{ {
after = out.getAvailableItems( after ); after = out.getAvailableItems( after );
} }
Platform.postListChanges( before, after, this, this.source ); Platform.postListChanges( before, after, this, this.source );
} }
} }
@@ -284,24 +284,34 @@ public class PartFluidStorageBus extends PartSharedStorageBus implements IMEMoni
@Override @Override
public void postChange( final IBaseMonitor<IAEFluidStack> monitor, final Iterable<IAEFluidStack> change, final IActionSource source ) public void postChange( final IBaseMonitor<IAEFluidStack> monitor, final Iterable<IAEFluidStack> change, final IActionSource source )
{ {
if( this.source.machine().map( machine -> machine == this ).orElse( false ) && monitor != null ) if( this.getProxy().isActive() )
{ {
AccessRestriction currentAccess = (AccessRestriction) ( (ConfigManager) this.getConfigManager() ).getSetting( Settings.ACCESS ); AccessRestriction currentAccess = (AccessRestriction) ( (ConfigManager) this.getConfigManager() ).getSetting( Settings.ACCESS );
if( readOncePass )
{
readOncePass = false;
try
{
this.getProxy().getStorage().postAlterationOfStoredItems( AEApi.instance().storage().getStorageChannel( IFluidStorageChannel.class ), change, source );
}
catch( final GridAccessException e )
{
// :(
}
return;
}
if( !currentAccess.hasPermission( AccessRestriction.READ ) ) if( !currentAccess.hasPermission( AccessRestriction.READ ) )
{ {
return; return;
} }
} try
try
{
if( this.getProxy().isActive() )
{ {
this.getProxy().getStorage().postAlterationOfStoredItems( AEApi.instance().storage().getStorageChannel( IFluidStorageChannel.class ), change, this.source ); this.getProxy().getStorage().postAlterationOfStoredItems( AEApi.instance().storage().getStorageChannel( IFluidStorageChannel.class ), change, source );
}
catch( final GridAccessException e )
{
// :(
} }
}
catch( final GridAccessException e )
{
// :(
} }
} }
@@ -337,7 +347,7 @@ public class PartFluidStorageBus extends PartSharedStorageBus implements IMEMoni
if( inv instanceof ITickingMonitor ) if( inv instanceof ITickingMonitor )
{ {
this.monitor = (ITickingMonitor) inv; this.monitor = (ITickingMonitor) inv;
this.monitor.setActionSource( new MachineSource( this ) ); this.monitor.setActionSource( this.source );
this.monitor.setMode( (StorageFilter) this.getConfigManager().getSetting( Settings.STORAGE_FILTER ) ); this.monitor.setMode( (StorageFilter) this.getConfigManager().getSetting( Settings.STORAGE_FILTER ) );
} }
@@ -375,7 +385,10 @@ public class PartFluidStorageBus extends PartSharedStorageBus implements IMEMoni
if( inv instanceof IBaseMonitor ) if( inv instanceof IBaseMonitor )
{ {
( (IBaseMonitor<IAEFluidStack>) inv ).addListener( this, this.handler ); if( ( (AccessRestriction) ( (ConfigManager) this.getConfigManager() ).getSetting( Settings.ACCESS ) ).hasPermission( AccessRestriction.READ ) )
{
( (IBaseMonitor<IAEFluidStack>) inv ).addListener( this, this.handler );
}
} }
} }
} }
@@ -404,7 +417,7 @@ public class PartFluidStorageBus extends PartSharedStorageBus implements IMEMoni
try try
{ {
// force grid to update handlers... // force grid to update handlers...
this.getProxy().getGrid().postEvent( new MENetworkCellArrayUpdate() ); (( GridStorageCache ) this.getProxy().getGrid().getCache( IStorageGrid.class )).cellUpdate( null );
} }
catch( final GridAccessException ignore ) catch( final GridAccessException ignore )
{ {
@@ -856,19 +856,26 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
throw new GridAccessException(); throw new GridAccessException();
} }
final IAEItemStack acquired = Platform.poweredExtraction( src, this.destination, itemStack, this.interfaceRequestSource ); IAEItemStack storedStack = this.gridProxy.getStorage().getInventory( AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ) ).getStorageList().findPrecise( itemStack );
if( acquired != null ) if( storedStack != null )
{ {
changed = true; if( storedStack.getStackSize() > 0 )
final ItemStack issue = adaptor.addItems( acquired.createItemStack() );
if( !issue.isEmpty() )
{ {
throw new IllegalStateException( "bad attempt at managing inventory. ( addItems )" ); final IAEItemStack acquired = Platform.poweredExtraction( src, this.destination, itemStack, this.interfaceRequestSource );
if( acquired != null )
{
changed = true;
final ItemStack issue = adaptor.addItems( acquired.createItemStack() );
if( !issue.isEmpty() )
{
throw new IllegalStateException( "bad attempt at managing inventory. ( addItems )" );
}
}
}
else if( storedStack.isCraftable() )
{
changed = this.handleCrafting( x, adaptor, itemStack ) || changed;
} }
}
else
{
changed = this.handleCrafting( x, adaptor, itemStack ) || changed;
} }
} }
else if( itemStack.getStackSize() < 0 ) else if( itemStack.getStackSize() < 0 )
@@ -35,6 +35,8 @@ public enum TheOneProbeText
P2P_UNLINKED, P2P_UNLINKED,
P2P_INPUT_ONE_OUTPUT, P2P_INPUT_ONE_OUTPUT,
P2P_INPUT_MANY_OUTPUTS, P2P_INPUT_MANY_OUTPUTS,
P2P_OUTPUT_ONE_INPUT,
P2P_OUTPUT_MANY_INPUTS,
P2P_OUTPUT, P2P_OUTPUT,
P2P_FREQUENCY, P2P_FREQUENCY,
@@ -57,11 +57,11 @@ public class P2PStateInfoProvider implements IPartProbInfoProvider
// The default state // The default state
int state = STATE_UNLINKED; int state = STATE_UNLINKED;
int outputCount = 0; int outputCount = getOutputCount( tunnel );
int inputCount = getInputCount( tunnel );
if( !tunnel.isOutput() ) if( !tunnel.isOutput() )
{ {
outputCount = getOutputCount( tunnel );
if( outputCount > 0 ) if( outputCount > 0 )
{ {
// Only set it to INPUT if we know there are any outputs // Only set it to INPUT if we know there are any outputs
@@ -70,8 +70,7 @@ public class P2PStateInfoProvider implements IPartProbInfoProvider
} }
else else
{ {
final PartP2PTunnel input = tunnel.getInput(); if( inputCount > 0 )
if( input != null )
{ {
state = STATE_OUTPUT; state = STATE_OUTPUT;
} }
@@ -83,7 +82,7 @@ public class P2PStateInfoProvider implements IPartProbInfoProvider
probeInfo.text( TheOneProbeText.P2P_UNLINKED.getLocal() ); probeInfo.text( TheOneProbeText.P2P_UNLINKED.getLocal() );
break; break;
case STATE_OUTPUT: case STATE_OUTPUT:
probeInfo.text( TheOneProbeText.P2P_OUTPUT.getLocal() ); probeInfo.text( getInputText( inputCount ) );
break; break;
case STATE_INPUT: case STATE_INPUT:
probeInfo.text( getOutputText( outputCount ) ); probeInfo.text( getOutputText( outputCount ) );
@@ -110,6 +109,19 @@ public class P2PStateInfoProvider implements IPartProbInfoProvider
} }
} }
private static int getInputCount( PartP2PTunnel tunnel )
{
try
{
return Iterators.size( tunnel.getInputs().iterator() );
}
catch( GridAccessException e )
{
// Well... unknown size it is!
return 0;
}
}
private static String getOutputText( int outputs ) private static String getOutputText( int outputs )
{ {
if( outputs <= 1 ) if( outputs <= 1 )
@@ -122,4 +134,16 @@ public class P2PStateInfoProvider implements IPartProbInfoProvider
} }
} }
private static String getInputText( int inputs )
{
if( inputs <= 1 )
{
return TheOneProbeText.P2P_OUTPUT_ONE_INPUT.getLocal();
}
else
{
return String.format( TheOneProbeText.P2P_OUTPUT_MANY_INPUTS.getLocal(), inputs );
}
}
} }
@@ -21,6 +21,7 @@ package appeng.integration.modules.waila.part;
import java.util.List; import java.util.List;
import appeng.integration.modules.theoneprobe.TheOneProbeText;
import com.google.common.collect.Iterators; import com.google.common.collect.Iterators;
import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.entity.player.EntityPlayerMP;
@@ -117,11 +118,11 @@ public final class P2PStateWailaDataProvider extends BasePartWailaDataProvider
// The default state // The default state
int state = STATE_UNLINKED; int state = STATE_UNLINKED;
int outputCount = 0; int outputCount = getOutputCount( tunnel );
int inputCount = getInputCount( tunnel );
if( !tunnel.isOutput() ) if( !tunnel.isOutput() )
{ {
outputCount = getOutputCount( tunnel );
if( outputCount > 0 ) if( outputCount > 0 )
{ {
// Only set it to INPUT if we know there are any outputs // Only set it to INPUT if we know there are any outputs
@@ -130,8 +131,7 @@ public final class P2PStateWailaDataProvider extends BasePartWailaDataProvider
} }
else else
{ {
PartP2PTunnel input = tunnel.getInput(); if( inputCount > 0 )
if( input != null )
{ {
state = STATE_OUTPUT; state = STATE_OUTPUT;
} }
@@ -160,15 +160,40 @@ public final class P2PStateWailaDataProvider extends BasePartWailaDataProvider
} }
} }
private static int getInputCount( PartP2PTunnel tunnel )
{
try
{
return Iterators.size( tunnel.getInputs().iterator() );
}
catch( GridAccessException e )
{
// Well... unknown size it is!
return 0;
}
}
private static String getOutputText( int outputs ) private static String getOutputText( int outputs )
{ {
if( outputs <= 1 ) if( outputs <= 1 )
{ {
return WailaText.P2PInputOneOutput.getLocal(); return WailaText.P2P_INPUT_ONE_OUTPUT.getLocal();
} }
else else
{ {
return String.format( WailaText.P2PInputManyOutputs.getLocal(), outputs ); return String.format( WailaText.P2P_INPUT_MANY_OUTPUTS.getLocal(), outputs );
}
}
private static String getInputText( int inputs )
{
if( inputs <= 1 )
{
return WailaText.P2P_OUTPUT_ONE_INPUT.getLocal();
}
else
{
return String.format( WailaText.P2P_OUTPUT_MANY_INPUTS.getLocal(), inputs );
} }
} }
@@ -19,6 +19,7 @@
package appeng.items.contents; package appeng.items.contents;
import appeng.api.networking.security.IActionSource;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
@@ -42,6 +43,8 @@ import appeng.me.helpers.MEMonitorHandler;
import appeng.util.ConfigManager; import appeng.util.ConfigManager;
import appeng.util.Platform; import appeng.util.Platform;
import java.util.Collections;
public class PortableCellViewer extends MEMonitorHandler<IAEItemStack> implements IPortableCell, IInventorySlotAware public class PortableCellViewer extends MEMonitorHandler<IAEItemStack> implements IPortableCell, IInventorySlotAware
{ {
@@ -83,6 +86,34 @@ public class PortableCellViewer extends MEMonitorHandler<IAEItemStack> implement
return usePowerMultiplier.divide( this.ips.extractAEPower( this.target, amt, Actionable.MODULATE ) ); return usePowerMultiplier.divide( this.ips.extractAEPower( this.target, amt, Actionable.MODULATE ) );
} }
@Override
public IAEItemStack injectItems( IAEItemStack input, Actionable mode, IActionSource src )
{
final long size = input.getStackSize();
final IAEItemStack injected = super.injectItems( input, mode, src );
if( mode == Actionable.MODULATE && ( injected == null || injected.getStackSize() != size ) )
{
this.notifyListenersOfChange( Collections.singletonList( input.copy().setStackSize( input.getStackSize() - ( injected == null ? 0 : injected.getStackSize() ) ) ), null);
}
return injected;
}
@Override
public IAEItemStack extractItems( IAEItemStack request, Actionable mode, IActionSource src )
{
final IAEItemStack extractable = super.extractItems( request, mode, src );
if( mode == Actionable.MODULATE && extractable != null )
{
this.notifyListenersOfChange( Collections.singletonList( request.copy().setStackSize( -extractable.getStackSize() ) ), null );
}
return extractable;
}
@Override @Override
public <T extends IAEStack<T>> IMEMonitor<T> getInventory( IStorageChannel<T> channel ) public <T extends IAEStack<T>> IMEMonitor<T> getInventory( IStorageChannel<T> channel )
{ {
@@ -403,7 +403,7 @@ public class ToolMatterCannon extends AEBasePoweredItem implements IStorageCell<
} }
else if( pos.entityHit.attackEntityFrom( dmgSrc, dmg ) ) else if( pos.entityHit.attackEntityFrom( dmgSrc, dmg ) )
{ {
hasDestroyed = true; hasDestroyed = pos.entityHit.isEntityAlive();
} }
} }
else if( pos.typeOfHit == RayTraceResult.Type.BLOCK ) else if( pos.typeOfHit == RayTraceResult.Type.BLOCK )
+79 -72
View File
@@ -65,11 +65,9 @@ public class EnergyGridCache implements IEnergyGrid
{ {
private static final double MAX_BUFFER_STORAGE = 800; private static final double MAX_BUFFER_STORAGE = 800;
private static final Comparator<IEnergyGridProvider> COMPARATOR_HIGHEST_AMOUNT_STORED_FIRST = ( o1, o2 ) -> Double.compare( o2.getProviderStoredEnergy(), private static final Comparator<IEnergyGridProvider> COMPARATOR_HIGHEST_AMOUNT_STORED_FIRST = ( o1, o2 ) -> Double.compare( o2.getProviderStoredEnergy(), o1.getProviderStoredEnergy() );
o1.getProviderStoredEnergy() );
private static final Comparator<IEnergyGridProvider> COMPARATOR_LOWEST_PERCENTAGE_FIRST = ( o1, o2 ) -> private static final Comparator<IEnergyGridProvider> COMPARATOR_LOWEST_PERCENTAGE_FIRST = ( o1, o2 ) -> {
{
final double percent1 = ( o1.getProviderStoredEnergy() + 1 ) / ( o1.getProviderMaxEnergy() + 1 ); final double percent1 = ( o1.getProviderStoredEnergy() + 1 ) / ( o1.getProviderMaxEnergy() + 1 );
final double percent2 = ( o2.getProviderStoredEnergy() + 1 ) / ( o2.getProviderMaxEnergy() + 1 ); final double percent2 = ( o2.getProviderStoredEnergy() + 1 ) / ( o2.getProviderMaxEnergy() + 1 );
@@ -163,34 +161,33 @@ public class EnergyGridCache implements IEnergyGrid
{ {
if( ev.storage.isAEPublicPowerStorage() ) if( ev.storage.isAEPublicPowerStorage() )
{ {
switch ( ev.type ) if( ev.type == PowerEventType.PROVIDE_POWER )
{ {
case PROVIDE_POWER: if( ev.storage.getPowerFlow() != AccessRestriction.WRITE )
if( ev.storage.getPowerFlow() != AccessRestriction.WRITE ) {
if( !ongoingExtractOperation )
{ {
if( !ongoingExtractOperation ) addProvider( ev.storage );
{
addProvider( ev.storage );
}
else
{
this.providersToAdd.add( ev.storage );
}
} }
break; else
case REQUEST_POWER:
if( ev.storage.getPowerFlow() != AccessRestriction.READ )
{ {
if( !ongoingInjectOperation ) this.providersToAdd.add( ev.storage );
{
addRequester( ev.storage );
}
else
{
this.requesterToAdd.add( ev.storage );
}
} }
break; }
}
else if( ev.type == PowerEventType.REQUEST_POWER )
{
if( ev.storage.getPowerFlow() != AccessRestriction.READ )
{
if( !ongoingInjectOperation )
{
addRequester( ev.storage );
}
else
{
this.requesterToAdd.add( ev.storage );
}
}
} }
} }
else else
@@ -337,6 +334,8 @@ public class EnergyGridCache implements IEnergyGrid
this.providers.addAll( providersToAdd ); this.providers.addAll( providersToAdd );
providersToAdd.clear(); providersToAdd.clear();
providers.removeIf( providerToRemove::contains );
this.providerToRemove.clear();
final Iterator<IAEPowerStorage> it = this.providers.iterator(); final Iterator<IAEPowerStorage> it = this.providers.iterator();
@@ -347,18 +346,24 @@ public class EnergyGridCache implements IEnergyGrid
while ( extractedPower < amt && it.hasNext() ) while ( extractedPower < amt && it.hasNext() )
{ {
final IAEPowerStorage node = it.next(); final IAEPowerStorage node = it.next();
if( node != null )
if( node == localStorage && mode == Actionable.MODULATE )
{ {
ls = true; if( node == localStorage && mode == Actionable.MODULATE )
continue; {
ls = true;
continue;
}
final double req = amt - extractedPower;
final double newPower = node.extractAEPower( req, mode, PowerMultiplier.ONE );
extractedPower += newPower;
if( newPower < req && mode == Actionable.MODULATE )
{
it.remove();
}
} }
else
final double req = amt - extractedPower;
final double newPower = node.extractAEPower( req, mode, PowerMultiplier.ONE );
extractedPower += newPower;
if( newPower < req && mode == Actionable.MODULATE )
{ {
it.remove(); it.remove();
} }
@@ -366,24 +371,20 @@ public class EnergyGridCache implements IEnergyGrid
} finally } finally
{ {
ongoingExtractOperation = false; ongoingExtractOperation = false;
} if( ls && extractedPower < amt )
if( ls && extractedPower < amt )
{
final double req = amt - extractedPower;
final double newPower = localStorage.extractAEPower( req, mode, PowerMultiplier.ONE );
extractedPower += newPower;
if( newPower < req )
{ {
providers.remove( localStorage ); final double req = amt - extractedPower;
final double newPower = localStorage.extractAEPower( req, mode, PowerMultiplier.ONE );
extractedPower += newPower;
if( newPower < req )
{
providers.remove( localStorage );
}
} }
} }
providers.removeIf( p -> providerToRemove.contains( p ) );
this.providerToRemove.clear();
final double result = Math.min( extractedPower, amt ); final double result = Math.min( extractedPower, amt );
if( mode == Actionable.MODULATE ) if( mode == Actionable.MODULATE )
@@ -407,6 +408,8 @@ public class EnergyGridCache implements IEnergyGrid
this.requesters.addAll( requesterToAdd ); this.requesters.addAll( requesterToAdd );
requesterToAdd.clear(); requesterToAdd.clear();
requesters.removeIf( requesterToRemove::contains );
this.requesterToRemove.clear();
final Iterator<IAEPowerStorage> it = this.requesters.iterator(); final Iterator<IAEPowerStorage> it = this.requesters.iterator();
@@ -417,9 +420,16 @@ public class EnergyGridCache implements IEnergyGrid
{ {
final IAEPowerStorage node = it.next(); final IAEPowerStorage node = it.next();
amt = node.injectAEPower( amt, mode ); if( node != null )
{
amt = node.injectAEPower( amt, mode );
if( amt > 0 && mode == Actionable.MODULATE ) if( amt > 0 && mode == Actionable.MODULATE )
{
it.remove();
}
}
else
{ {
it.remove(); it.remove();
} }
@@ -429,9 +439,6 @@ public class EnergyGridCache implements IEnergyGrid
ongoingInjectOperation = false; ongoingInjectOperation = false;
} }
requesters.removeIf( r -> requesterToRemove.contains( r ) );
this.requesterToRemove.clear();
final double overflow = Math.max( 0.0, amt ); final double overflow = Math.max( 0.0, amt );
if( mode == Actionable.MODULATE ) if( mode == Actionable.MODULATE )
@@ -613,28 +620,28 @@ public class EnergyGridCache implements IEnergyGrid
} }
} }
private void addRequester(IAEPowerStorage requester) { private void addRequester( IAEPowerStorage requester )
Preconditions.checkState(!ongoingInjectOperation, {
"Cannot modify energy requesters while energy is being injected."); Preconditions.checkState( !ongoingInjectOperation, "Cannot modify energy requesters while energy is being injected." );
this.requesters.add(requester); this.requesters.add( requester );
} }
private void removeRequester(IAEPowerStorage requester) { private void removeRequester( IAEPowerStorage requester )
Preconditions.checkState(!ongoingInjectOperation, {
"Cannot modify energy requesters while energy is being injected."); Preconditions.checkState( !ongoingInjectOperation, "Cannot modify energy requesters while energy is being injected." );
this.requesters.remove(requester); this.requesters.remove( requester );
} }
private void addProvider(IAEPowerStorage provider) { private void addProvider( IAEPowerStorage provider )
Preconditions.checkState(!ongoingExtractOperation, {
"Cannot modify energy providers while energy is being extracted."); Preconditions.checkState( !ongoingExtractOperation, "Cannot modify energy providers while energy is being extracted." );
this.providers.add(provider); this.providers.add( provider );
} }
private void removeProvider(IAEPowerStorage provider) { private void removeProvider( IAEPowerStorage provider )
Preconditions.checkState(!ongoingExtractOperation, {
"Cannot modify energy providers while energy is being extracted."); Preconditions.checkState( !ongoingExtractOperation, "Cannot modify energy providers while energy is being extracted." );
this.providers.remove(provider); this.providers.remove( provider );
} }
+7 -10
View File
@@ -94,7 +94,7 @@ public class GridStorageCache implements IStorageGrid
this.removeCellProvider( cc, tracker ); this.removeCellProvider( cc, tracker );
this.inactiveCellProviders.remove( cc ); this.inactiveCellProviders.remove( cc );
this.getGrid().postEvent( new MENetworkCellArrayUpdate() ); cellUpdate( null );
tracker.applyChanges(); tracker.applyChanges();
} }
@@ -109,9 +109,6 @@ public class GridStorageCache implements IStorageGrid
this.watchers.remove( node ); this.watchers.remove( node );
} }
} }
this.storageMonitors.forEach( ( channel, monitor ) -> monitor.forceUpdate() );
} }
@Override @Override
@@ -122,7 +119,7 @@ public class GridStorageCache implements IStorageGrid
final ICellContainer cc = (ICellContainer) machine; final ICellContainer cc = (ICellContainer) machine;
this.inactiveCellProviders.add( cc ); this.inactiveCellProviders.add( cc );
this.getGrid().postEvent( new MENetworkCellArrayUpdate() ); cellUpdate( null );
if( node.isActive() ) if( node.isActive() )
{ {
@@ -140,9 +137,6 @@ public class GridStorageCache implements IStorageGrid
this.watchers.put( node, iw ); this.watchers.put( node, iw );
swh.updateWatcher( iw ); swh.updateWatcher( iw );
} }
this.storageMonitors.forEach( ( channel, monitor ) -> monitor.forceUpdate() );
} }
@Override @Override
@@ -176,7 +170,7 @@ public class GridStorageCache implements IStorageGrid
private CellChangeTracker addCellProvider( final ICellProvider cc, final CellChangeTracker tracker ) private CellChangeTracker addCellProvider( final ICellProvider cc, final CellChangeTracker tracker )
{ {
if( this.inactiveCellProviders.contains( cc ) ) if( this.inactiveCellProviders.contains( cc ) && !this.activeCellProviders.contains( cc ))
{ {
this.inactiveCellProviders.remove( cc ); this.inactiveCellProviders.remove( cc );
this.activeCellProviders.add( cc ); this.activeCellProviders.add( cc );
@@ -334,7 +328,10 @@ public class GridStorageCache implements IStorageGrid
public void applyChanges() public void applyChanges()
{ {
GridStorageCache.this.postChangesToNetwork( this.channel, this.up_or_down, this.list, this.src ); if( !this.list.isEmpty() )
{
GridStorageCache.this.postChangesToNetwork( this.channel, this.up_or_down, this.list, this.src );
}
} }
} }
+82 -43
View File
@@ -40,16 +40,17 @@ import com.google.common.collect.Queues;
import it.unimi.dsi.fastutil.objects.Object2ObjectMap; import it.unimi.dsi.fastutil.objects.Object2ObjectMap;
import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap;
import java.util.Collection; import java.util.*;
import java.util.Deque;
import java.util.Iterator;
import java.util.Map.Entry; import java.util.Map.Entry;
public class NetworkMonitor<T extends IAEStack<T>> implements IMEMonitor<T> public class NetworkMonitor<T extends IAEStack<T>> implements IMEMonitor<T>
{ {
@Nonnull @Nonnull
private static final Deque<NetworkMonitor<?>> GLOBAL_DEPTH = Queues.newArrayDeque(); private static final Set<NetworkMonitor<?>> NESTED_MONITORS = new HashSet<>();
private static final HashMap<IActionSource, Set<NetworkMonitor<?>>> sourceSetHashMap = new HashMap<>();
protected static boolean nested = false;
protected boolean isNested = false;
@Nonnull @Nonnull
private final GridStorageCache myGridCache; private final GridStorageCache myGridCache;
@@ -125,10 +126,6 @@ public class NetworkMonitor<T extends IAEStack<T>> implements IMEMonitor<T>
public long getGridCurrentCount() public long getGridCurrentCount()
{ {
if( forceUpdate )
{
getStorageList();
}
if( myChannel == AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ) ) if( myChannel == AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ) )
{ {
return gridItemCount; return gridItemCount;
@@ -140,7 +137,7 @@ public class NetworkMonitor<T extends IAEStack<T>> implements IMEMonitor<T>
return 0; return 0;
} }
public void incGridCurrentCount(long count) public void incGridCurrentCount( long count )
{ {
if( myChannel == AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ) ) if( myChannel == AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ) )
{ {
@@ -156,26 +153,6 @@ public class NetworkMonitor<T extends IAEStack<T>> implements IMEMonitor<T>
@Override @Override
public IItemList<T> getStorageList() public IItemList<T> getStorageList()
{ {
if( forceUpdate )
{
forceUpdate = false;
this.cachedList.resetStatus();
this.getAvailableItems( this.cachedList );
long count = 0;
for (T stack : this.cachedList) {
count += stack.getStackSize();
}
if( myChannel == AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ) )
{
gridItemCount = count;
}
else if( myChannel == AEApi.instance().storage().getStorageChannel( IFluidStorageChannel.class ) )
{
gridFluidCount = count;
}
}
return this.cachedList; return this.cachedList;
} }
@@ -222,6 +199,7 @@ public class NetworkMonitor<T extends IAEStack<T>> implements IMEMonitor<T>
{ {
final Entry<IMEMonitorHandlerReceiver<T>, Object> o = i.next(); final Entry<IMEMonitorHandlerReceiver<T>, Object> o = i.next();
final IMEMonitorHandlerReceiver<T> receiver = o.getKey(); final IMEMonitorHandlerReceiver<T> receiver = o.getKey();
if( receiver.isValid( o.getValue() ) ) if( receiver.isValid( o.getValue() ) )
{ {
receiver.postChange( this, diff, src ); receiver.postChange( this, diff, src );
@@ -251,27 +229,30 @@ public class NetworkMonitor<T extends IAEStack<T>> implements IMEMonitor<T>
protected void postChange( final boolean add, final Iterable<T> changes, final IActionSource src ) protected void postChange( final boolean add, final Iterable<T> changes, final IActionSource src )
{ {
if( this.localDepthSemaphore > 0 || GLOBAL_DEPTH.contains( this ) )
if( sourceSetHashMap.get( src ) != null && sourceSetHashMap.get( src ).contains( this ) )
{ {
NESTED_MONITORS.add( this );
nested = true;
return; return;
} }
this.localDepthSemaphore++; sourceSetHashMap.putIfAbsent( src, new HashSet<>() );
GLOBAL_DEPTH.push( this ); sourceSetHashMap.get( src ).add( this );
this.sendEvent = true; this.sendEvent = true;
for( final T changed : changes ) for( final T change : changes )
{ {
T change = changed; //T change = changed;
if( !add && change != null ) if( !add && change != null )
{ {
change = changed.copy(); //change = changed.copy();
change.setStackSize( -change.getStackSize() ); change.setStackSize( -change.getStackSize() );
} }
incGridCurrentCount( change.getStackSize() ); incGridCurrentCount( change.getStackSize() );
this.cachedList.add( change ); this.cachedList.addStorage( change );
if( this.myGridCache.getInterestManager().containsKey( change ) ) if( this.myGridCache.getInterestManager().containsKey( change ) )
{ {
@@ -301,18 +282,77 @@ public class NetworkMonitor<T extends IAEStack<T>> implements IMEMonitor<T>
this.notifyListenersOfChange( changes, src ); this.notifyListenersOfChange( changes, src );
final NetworkMonitor<?> last = GLOBAL_DEPTH.pop(); sourceSetHashMap.get( src ).remove( this );
this.localDepthSemaphore--; if( sourceSetHashMap.get( src ).isEmpty() )
if( last != this )
{ {
throw new IllegalStateException( "Invalid Access to Networked Storage API detected." ); sourceSetHashMap.remove( src );
}
if( sourceSetHashMap.isEmpty() )
{
for( NetworkMonitor<?> nm : NESTED_MONITORS )
{
nm.setupForceUpdate();
}
nested = false;
NESTED_MONITORS.clear();
}
}
void setupForceUpdate()
{
if( nested != isNested )
{
isNested = nested;
forceUpdate();
} }
} }
void forceUpdate() void forceUpdate()
{ {
this.forceUpdate = true; forceUpdate = false;
this.cachedList.resetStatus();
this.getAvailableItems( this.cachedList );
long count = 0;
for( T stack : this.cachedList )
{
count += stack.getStackSize();
if( this.myGridCache.getInterestManager().containsKey( stack ) )
{
final Collection<ItemWatcher> list = this.myGridCache.getInterestManager().get( stack );
if( !list.isEmpty() )
{
IAEStack<T> fullStack = this.getStorageList().findPrecise( stack );
if( fullStack == null )
{
fullStack = stack.copy();
fullStack.setStackSize( 0 );
}
this.myGridCache.getInterestManager().enableTransactions();
for ( final ItemWatcher iw : list )
{
iw.getHost().onStackChange( this.getStorageList(), fullStack, stack, null, this.getChannel() );
}
this.myGridCache.getInterestManager().disableTransactions();
}
}
}
if( myChannel == AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ) )
{
gridItemCount = count;
}
else if( myChannel == AEApi.instance().storage().getStorageChannel( IFluidStorageChannel.class ) )
{
gridFluidCount = count;
}
final Iterator<Entry<IMEMonitorHandlerReceiver<T>, Object>> i = this.getListeners(); final Iterator<Entry<IMEMonitorHandlerReceiver<T>, Object>> i = this.getListeners();
while ( i.hasNext() ) while ( i.hasNext() )
@@ -338,6 +378,5 @@ public class NetworkMonitor<T extends IAEStack<T>> implements IMEMonitor<T>
this.sendEvent = false; this.sendEvent = false;
this.myGridCache.getGrid().postEvent( new MENetworkStorageEvent( this, this.myChannel ) ); this.myGridCache.getGrid().postEvent( new MENetworkStorageEvent( this, this.myChannel ) );
} }
} }
} }
+56 -17
View File
@@ -19,7 +19,7 @@
package appeng.me.cache; package appeng.me.cache;
import java.util.HashMap; import java.util.Collection;
import java.util.Random; import java.util.Random;
import com.google.common.collect.LinkedHashMultimap; import com.google.common.collect.LinkedHashMultimap;
@@ -46,7 +46,7 @@ public class P2PCache implements IGridCache
private static final TunnelCollection<PartP2PTunnel> NULL_COLLECTION = new TunnelCollection<PartP2PTunnel>( null, null ); private static final TunnelCollection<PartP2PTunnel> NULL_COLLECTION = new TunnelCollection<PartP2PTunnel>( null, null );
private final IGrid myGrid; private final IGrid myGrid;
private final HashMap<Short, PartP2PTunnel> inputs = new HashMap<>(); private final Multimap<Short, PartP2PTunnel> inputs = LinkedHashMultimap.create();
private final Multimap<Short, PartP2PTunnel> outputs = LinkedHashMultimap.create(); private final Multimap<Short, PartP2PTunnel> outputs = LinkedHashMultimap.create();
private final Random frequencyGenerator; private final Random frequencyGenerator;
@@ -110,10 +110,19 @@ public class P2PCache implements IGridCache
} }
else else
{ {
this.inputs.remove( t.getFrequency() ); this.inputs.remove( t.getFrequency(), t );
} }
this.updateTunnel( t.getFrequency(), !t.isOutput(), false ); if( this.inputs.get( t.getFrequency() ).isEmpty() )
{
this.inputs.removeAll( t.getFrequency() );
}
if( this.outputs.get( t.getFrequency() ).isEmpty() )
{
this.outputs.removeAll( t.getFrequency() );
}
this.updateTunnel( t.getFrequency(), t.isOutput(), false );
} }
} }
@@ -142,7 +151,7 @@ public class P2PCache implements IGridCache
this.inputs.put( t.getFrequency(), t ); this.inputs.put( t.getFrequency(), t );
} }
this.updateTunnel( t.getFrequency(), !t.isOutput(), false ); this.updateTunnel( t.getFrequency(), t.isOutput(), false );
} }
} }
@@ -164,6 +173,20 @@ public class P2PCache implements IGridCache
} }
public void removeTunnel( final PartP2PTunnel t, short freq )
{
this.outputs.remove( freq, t );
this.inputs.remove( freq, t );
if( this.inputs.get( t.getFrequency() ).isEmpty() )
{
this.inputs.removeAll( t.getFrequency() );
}
if( this.outputs.get( t.getFrequency() ).isEmpty() )
{
this.outputs.removeAll( t.getFrequency() );
}
}
private void updateTunnel( final short freq, final boolean updateOutputs, final boolean configChange ) private void updateTunnel( final short freq, final boolean updateOutputs, final boolean configChange )
{ {
for( final PartP2PTunnel p : this.outputs.get( freq ) ) for( final PartP2PTunnel p : this.outputs.get( freq ) )
@@ -175,8 +198,7 @@ public class P2PCache implements IGridCache
p.onTunnelNetworkChange(); p.onTunnelNetworkChange();
} }
final PartP2PTunnel in = this.inputs.get( freq ); for( final PartP2PTunnel in : this.inputs.get( freq ) )
if( in != null )
{ {
if( configChange ) if( configChange )
{ {
@@ -195,7 +217,7 @@ public class P2PCache implements IGridCache
if( this.inputs.containsValue( t ) ) if( this.inputs.containsValue( t ) )
{ {
this.inputs.remove( t.getFrequency() ); this.inputs.remove( t.getFrequency(), t );
} }
t.setFrequency( newFrequency ); t.setFrequency( newFrequency );
@@ -211,7 +233,6 @@ public class P2PCache implements IGridCache
// AELog.info( "update-" + (t.output ? "output: " : "input: ") + t.freq ); // AELog.info( "update-" + (t.output ? "output: " : "input: ") + t.freq );
this.updateTunnel( t.getFrequency(), t.isOutput(), true ); this.updateTunnel( t.getFrequency(), t.isOutput(), true );
this.updateTunnel( t.getFrequency(), !t.isOutput(), true );
} }
public short newFrequency() public short newFrequency()
@@ -236,25 +257,43 @@ public class P2PCache implements IGridCache
public TunnelCollection<PartP2PTunnel> getOutputs( final short freq, final Class<? extends PartP2PTunnel> c ) public TunnelCollection<PartP2PTunnel> getOutputs( final short freq, final Class<? extends PartP2PTunnel> c )
{ {
final PartP2PTunnel in = this.inputs.get( freq ); Collection<PartP2PTunnel> in = this.inputs.get( freq );
if( in == null ) if( in == null )
{ {
return NULL_COLLECTION; return NULL_COLLECTION;
} }
final TunnelCollection<PartP2PTunnel> out = this.inputs.get( freq ).getCollection( this.outputs.get( freq ), c ); TunnelCollection<PartP2PTunnel> out;
for( PartP2PTunnel part : this.inputs.get( freq ) )
{
out = part.getCollection( this.outputs.get( freq ), c );
if( out != null )
{
return out;
}
}
return NULL_COLLECTION;
}
public TunnelCollection<PartP2PTunnel> getInputs( final short freq, final Class<? extends PartP2PTunnel> c )
{
Collection<PartP2PTunnel> out = this.outputs.get( freq );
if( out == null ) if( out == null )
{ {
return NULL_COLLECTION; return NULL_COLLECTION;
} }
return out; TunnelCollection<PartP2PTunnel> in;
} for( PartP2PTunnel part : this.outputs.get( freq ) )
{
public PartP2PTunnel getInput( final short freq ) in = part.getCollection( this.inputs.get( freq ), c );
{ if( in != null )
return this.inputs.get( freq ); {
return in;
}
}
return NULL_COLLECTION;
} }
} }
@@ -23,11 +23,10 @@ import java.util.ArrayList;
import java.util.Collection; import java.util.Collection;
import java.util.List; import java.util.List;
import appeng.api.config.FuzzyMode;
import appeng.api.storage.data.IAEStack;
import appeng.util.item.AEItemStack;
import com.google.common.collect.Multimap; import com.google.common.collect.Multimap;
import appeng.api.storage.data.IAEStack;
public class GenericInterestManager<T> public class GenericInterestManager<T>
{ {
@@ -102,30 +101,12 @@ public class GenericInterestManager<T>
public boolean containsKey( final IAEStack stack ) public boolean containsKey( final IAEStack stack )
{ {
if( stack.isItem() && ( ( AEItemStack ) stack ).getItem().isDamageable() )
{
return this.container.keySet().stream().filter( s -> s.isItem() )
.anyMatch( s -> s.fuzzyComparison( stack, FuzzyMode.IGNORE_ALL ) );
}
return this.container.containsKey( stack ); return this.container.containsKey( stack );
} }
public Collection<T> get( final IAEStack stack ) public Collection<T> get( final IAEStack stack )
{ {
Collection<T> watchers = new ArrayList<>(); return this.container.get( stack );
if( stack.isItem() && ( ( AEItemStack ) stack ).getItem().isDamageable() )
{
this.container.keySet().stream().filter( s -> s.isItem() )
.filter( k -> k.fuzzyComparison( stack, FuzzyMode.IGNORE_ALL ) )
.forEach( key ->
watchers.addAll( this.container.get( key ) )
);
}
else
{
return this.container.get( stack );
}
return watchers;
} }
private class SavedTransactions private class SavedTransactions
@@ -28,8 +28,6 @@ import java.util.HashMap;
import java.util.Iterator; import java.util.Iterator;
import java.util.Map.Entry; import java.util.Map.Entry;
import com.google.common.collect.ImmutableList;
import appeng.api.config.AccessRestriction; import appeng.api.config.AccessRestriction;
import appeng.api.config.Actionable; import appeng.api.config.Actionable;
import appeng.api.networking.security.IActionSource; import appeng.api.networking.security.IActionSource;
@@ -85,11 +83,7 @@ public class MEMonitorHandler<T extends IAEStack<T>> implements IMEMonitor<T>
@Override @Override
public T injectItems( final T input, final Actionable mode, final IActionSource src ) public T injectItems( final T input, final Actionable mode, final IActionSource src )
{ {
if( mode == Actionable.SIMULATE ) return this.getHandler().injectItems( input, mode, src );
{
return this.getHandler().injectItems( input, mode, src );
}
return this.monitorDifference( input.copy(), this.getHandler().injectItems( input, mode, src ), false, src );
} }
protected IMEInventoryHandler<T> getHandler() protected IMEInventoryHandler<T> getHandler()
@@ -97,28 +91,7 @@ public class MEMonitorHandler<T extends IAEStack<T>> implements IMEMonitor<T>
return this.internalHandler; return this.internalHandler;
} }
private T monitorDifference( final T original, final T leftOvers, final boolean extraction, final IActionSource src ) public void postChangesToListeners( final Iterable<T> changes, final IActionSource src )
{
final T diff = original.copy();
if( extraction )
{
diff.setStackSize( leftOvers == null ? 0 : -leftOvers.getStackSize() );
}
else if( leftOvers != null )
{
diff.decStackSize( leftOvers.getStackSize() );
}
if( diff.getStackSize() != 0 )
{
this.postChangesToListeners( ImmutableList.of( diff ), src );
}
return leftOvers;
}
protected void postChangesToListeners( final Iterable<T> changes, final IActionSource src )
{ {
this.notifyListenersOfChange( changes, src ); this.notifyListenersOfChange( changes, src );
} }
@@ -150,11 +123,7 @@ public class MEMonitorHandler<T extends IAEStack<T>> implements IMEMonitor<T>
@Override @Override
public T extractItems( final T request, final Actionable mode, final IActionSource src ) public T extractItems( final T request, final Actionable mode, final IActionSource src )
{ {
if( mode == Actionable.SIMULATE ) return this.getHandler().extractItems( request, mode, src );
{
return this.getHandler().extractItems( request, mode, src );
}
return this.monitorDifference( request.copy(), this.getHandler().extractItems( request, mode, src ), true, src );
} }
@Override @Override
@@ -19,6 +19,7 @@
package appeng.me.helpers; package appeng.me.helpers;
import java.util.Objects;
import java.util.Optional; import java.util.Optional;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
@@ -55,4 +56,24 @@ public class MachineSource implements IActionSource
return Optional.empty(); return Optional.empty();
} }
@Override
public boolean equals( Object o )
{
if( this == o )
{
return true;
}
if( o == null || getClass() != o.getClass() )
{
return false;
}
MachineSource that = (MachineSource) o;
return via.equals( that.via );
}
@Override
public int hashCode()
{
return Objects.hash( via );
}
} }
@@ -19,19 +19,20 @@
package appeng.me.storage; package appeng.me.storage;
import appeng.core.features.registries.cell.CreativeCellHandler;
import appeng.me.GridAccessException; import appeng.me.GridAccessException;
import appeng.me.helpers.MachineSource; import appeng.me.helpers.MachineSource;
import appeng.tile.storage.TileDrive; import appeng.tile.storage.TileDrive;
import com.google.common.collect.ImmutableList;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import appeng.api.config.Actionable; import appeng.api.config.Actionable;
import appeng.api.implementations.tiles.IChestOrDrive;
import appeng.api.networking.security.IActionSource; import appeng.api.networking.security.IActionSource;
import appeng.api.storage.ICellHandler; import appeng.api.storage.ICellHandler;
import appeng.api.storage.ICellInventoryHandler; import appeng.api.storage.ICellInventoryHandler;
import appeng.api.storage.data.IAEStack; import appeng.api.storage.data.IAEStack;
import java.util.Collections;
public class DriveWatcher<T extends IAEStack<T>> extends MEInventoryHandler<T> public class DriveWatcher<T extends IAEStack<T>> extends MEInventoryHandler<T>
{ {
@@ -39,16 +40,16 @@ public class DriveWatcher<T extends IAEStack<T>> extends MEInventoryHandler<T>
private int oldStatus = 0; private int oldStatus = 0;
private final ItemStack is; private final ItemStack is;
private final ICellHandler handler; private final ICellHandler handler;
private final IChestOrDrive cord; private final TileDrive drive;
private IActionSource source; private IActionSource source;
public DriveWatcher( final ICellInventoryHandler<T> i, final ItemStack is, final ICellHandler han, final IChestOrDrive cod ) public DriveWatcher( final ICellInventoryHandler<T> i, final ItemStack is, final ICellHandler han, final TileDrive drive )
{ {
super( i, i.getChannel() ); super( i, i.getChannel() );
this.is = is; this.is = is;
this.handler = han; this.handler = han;
this.cord = cod; this.drive = drive;
this.source = new MachineSource( cod ); this.source = new MachineSource( drive );
} }
public int getStatus() public int getStatus()
@@ -61,55 +62,58 @@ public class DriveWatcher<T extends IAEStack<T>> extends MEInventoryHandler<T>
{ {
final long size = input.getStackSize(); final long size = input.getStackSize();
final T a = super.injectItems( input, type, src ); final T remainder = super.injectItems( input, type, src );
if( type == Actionable.MODULATE && ( a == null || a.getStackSize() != size ) ) if( type == Actionable.MODULATE && ( remainder == null || remainder.getStackSize() != size ) )
{ {
final int newStatus = this.getStatus(); final int newStatus = this.getStatus();
if( newStatus != this.oldStatus ) if( newStatus != this.oldStatus )
{ {
this.cord.blinkCell( this.getSlot() ); this.drive.blinkCell( this.getSlot() );
this.oldStatus = newStatus; this.oldStatus = newStatus;
} }
try if (this.drive.getProxy().isActive() && !(handler instanceof CreativeCellHandler))
{ {
( (TileDrive) this.cord ).getProxy().getStorage().postAlterationOfStoredItems( this.getChannel(), ImmutableList.of( input.copy().setStackSize( input.getStackSize() - ( a == null ? 0 : a.getStackSize() ) ) ), this.source ); try
} {
catch( GridAccessException e ) this.drive.getProxy().getStorage().postAlterationOfStoredItems( this.getChannel(), Collections.singletonList( input.copy().setStackSize( input.getStackSize() - ( remainder == null ? 0 : remainder.getStackSize() ) ) ), this.source );
{ } catch ( GridAccessException e )
e.printStackTrace(); {
e.printStackTrace();
}
} }
} }
return a; return remainder;
} }
@Override @Override
public T extractItems( final T request, final Actionable type, final IActionSource src ) public T extractItems( final T request, final Actionable type, final IActionSource src )
{ {
final T a = super.extractItems( request, type, src ); final T extractable = super.extractItems( request, type, src );
if( type == Actionable.MODULATE && a != null ) if( type == Actionable.MODULATE && extractable != null )
{ {
final int newStatus = this.getStatus(); final int newStatus = this.getStatus();
if( newStatus != this.oldStatus ) if( newStatus != this.oldStatus )
{ {
this.cord.blinkCell( this.getSlot() ); this.drive.blinkCell( this.getSlot() );
this.oldStatus = newStatus; this.oldStatus = newStatus;
} }
if (this.drive.getProxy().isActive() && !(handler instanceof CreativeCellHandler ))
try
{ {
( (TileDrive) this.cord ).getProxy().getStorage().postAlterationOfStoredItems( this.getChannel(), ImmutableList.of( request.copy().setStackSize( -a.getStackSize() ) ), this.source ); try
} {
catch( GridAccessException e ) this.drive.getProxy().getStorage().postAlterationOfStoredItems( this.getChannel(), Collections.singletonList( request.copy().setStackSize( -extractable.getStackSize() ) ), this.source );
{ } catch ( GridAccessException e )
e.printStackTrace(); {
e.printStackTrace();
}
} }
} }
return a; return extractable;
} }
} }
@@ -288,24 +288,4 @@ public class MEMonitorIInventory implements IMEMonitor<IAEItemStack>, ITickingMo
this.mySource = mySource; this.mySource = mySource;
} }
private static class CachedItemStack
{
private final ItemStack itemStack;
private final IAEItemStack aeStack;
public CachedItemStack( final ItemStack is )
{
if( is.isEmpty() )
{
this.itemStack = ItemStack.EMPTY;
this.aeStack = null;
}
else
{
this.itemStack = is.copy();
this.aeStack = AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ).createStack( is );
}
}
}
} }
@@ -171,4 +171,5 @@ public class MEMonitorPassThrough<T extends IAEStack<T>> extends MEPassThrough<T
{ {
this.changeSource = changeSource; this.changeSource = changeSource;
} }
} }
@@ -19,6 +19,8 @@
package appeng.me.storage; package appeng.me.storage;
import appeng.me.helpers.MEMonitorHandler;
import appeng.me.helpers.MachineSource;
import com.mojang.authlib.GameProfile; import com.mojang.authlib.GameProfile;
import appeng.api.AEApi; import appeng.api.AEApi;
@@ -35,16 +37,20 @@ import appeng.api.storage.data.IItemList;
import appeng.me.GridAccessException; import appeng.me.GridAccessException;
import appeng.tile.misc.TileSecurityStation; import appeng.tile.misc.TileSecurityStation;
import java.util.Collections;
public class SecurityStationInventory implements IMEInventoryHandler<IAEItemStack> public class SecurityStationInventory implements IMEInventoryHandler<IAEItemStack>
{ {
private final IItemList<IAEItemStack> storedItems = AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ).createList(); private final IItemList<IAEItemStack> storedItems = AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ).createList();
private final TileSecurityStation securityTile; private final TileSecurityStation securityTile;
private final MachineSource src;
public SecurityStationInventory( final TileSecurityStation ts ) public SecurityStationInventory( final TileSecurityStation ts )
{ {
this.securityTile = ts; this.securityTile = ts;
this.src = new MachineSource( securityTile );
} }
@Override @Override
@@ -61,6 +67,11 @@ public class SecurityStationInventory implements IMEInventoryHandler<IAEItemStac
return null; return null;
} }
if( securityTile.getProxy().isActive() )
{
( ( MEMonitorHandler<IAEItemStack> ) securityTile.getInventory( AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ) ) ).postChangesToListeners( Collections.singletonList( input.copy() ), this.src );
}
this.getStoredItems().add( input ); this.getStoredItems().add( input );
this.securityTile.inventoryChanged(); this.securityTile.inventoryChanged();
return null; return null;
@@ -101,6 +112,11 @@ public class SecurityStationInventory implements IMEInventoryHandler<IAEItemStac
return output; return output;
} }
if( securityTile.getProxy().isActive() )
{
( ( MEMonitorHandler<IAEItemStack> ) securityTile.getInventory( AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ) ) ).postChangesToListeners( Collections.singletonList( target.copy().setStackSize( -target.getStackSize() ) ), this.src );
}
target.setStackSize( 0 ); target.setStackSize( 0 );
this.securityTile.inventoryChanged(); this.securityTile.inventoryChanged();
return output; return output;
@@ -187,8 +187,9 @@ public class PartFormationPlane extends PartAbstractFormationPlane<IAEItemStack>
this.stateChanged(); this.stateChanged();
} }
@Override
@MENetworkEventSubscribe @MENetworkEventSubscribe
public void updateChannels( final MENetworkChannelsChanged changedChannels ) public void chanRender( final MENetworkChannelsChanged changedChannels )
{ {
this.stateChanged(); this.stateChanged();
} }
@@ -184,8 +184,9 @@ public class PartLevelEmitter extends PartUpgradeable implements IEnergyWatcherH
return flipState ? this.reportingValue >= this.lastReportedValue + 1 : this.reportingValue < this.lastReportedValue + 1; return flipState ? this.reportingValue >= this.lastReportedValue + 1 : this.reportingValue < this.lastReportedValue + 1;
} }
@Override
@MENetworkEventSubscribe @MENetworkEventSubscribe
public void powerStatusChange( final MENetworkPowerStatusChange powerEvent ) public void powerRender( final MENetworkPowerStatusChange powerEvent )
{ {
if (this.getProxy().isActive()) if (this.getProxy().isActive())
{ {
@@ -194,8 +195,9 @@ public class PartLevelEmitter extends PartUpgradeable implements IEnergyWatcherH
this.updateState(); this.updateState();
} }
@Override
@MENetworkEventSubscribe @MENetworkEventSubscribe
public void channelChanged( final MENetworkChannelsChanged c ) public void chanRender( final MENetworkChannelsChanged c )
{ {
if (this.getProxy().isActive()) if (this.getProxy().isActive())
{ {
@@ -288,37 +290,24 @@ public class PartLevelEmitter extends PartUpgradeable implements IEnergyWatcherH
try try
{ {
if( this.getInstalledUpgrades( Upgrades.FUZZY ) > 0 || myStack == null )
if( myStack == null )
{ {
this.getProxy().getStorage().getInventory( AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ) ).addListener( this, this.getProxy().getGrid() ); this.getProxy()
.getStorage()
.getInventory( AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ) )
.addListener( this,
this.getProxy().getGrid() );
} }
else else
{ {
this.getProxy().getStorage().getInventory( AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ) ).removeListener( this ); this.getProxy().getStorage().getInventory( AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ) ).removeListener( this );
if( this.myWatcher != null ) if( this.myWatcher != null )
{ {
if( this.getInstalledUpgrades( Upgrades.FUZZY ) > 0 ) this.myWatcher.add( myStack );
{
Optional<OreReference> ores = OreHelper.INSTANCE.getOre( myStack.getDefinition() );
if( ores.isPresent() )
{
for( IAEItemStack iaeItemStack : ores.get().getAEEquivalents() )
{
this.myWatcher.add( iaeItemStack );
}
}
else
{
this.myWatcher.add( myStack );
}
}
else
{
this.myWatcher.add( myStack );
}
} }
} }
this.updateReportingValue( this.getProxy().getStorage().getInventory( AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ) ) ); this.updateReportingValue( this.getProxy().getStorage().getInventory( AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ) ) );
} }
catch( final GridAccessException e ) catch( final GridAccessException e )
@@ -95,14 +95,16 @@ public class PartInterface extends PartBasicState implements IGridTickable, ISto
super( is ); super( is );
} }
@Override
@MENetworkEventSubscribe @MENetworkEventSubscribe
public void stateChange( final MENetworkChannelsChanged c ) public void chanRender( final MENetworkChannelsChanged c )
{ {
this.duality.notifyNeighbors(); this.duality.notifyNeighbors();
} }
@Override
@MENetworkEventSubscribe @MENetworkEventSubscribe
public void stateChange( final MENetworkPowerStatusChange c ) public void powerRender( final MENetworkPowerStatusChange c )
{ {
this.duality.notifyNeighbors(); this.duality.notifyNeighbors();
} }
@@ -62,6 +62,7 @@ public abstract class PartSharedStorageBus extends PartUpgradeable implements IG
private boolean wasActive = false; private boolean wasActive = false;
private int priority = 0; private int priority = 0;
protected boolean accessChanged; protected boolean accessChanged;
protected boolean readOncePass;
public PartSharedStorageBus( ItemStack is ) public PartSharedStorageBus( ItemStack is )
{ {
@@ -86,8 +87,9 @@ public abstract class PartSharedStorageBus extends PartUpgradeable implements IG
} }
} }
@Override
@MENetworkEventSubscribe @MENetworkEventSubscribe
public void updateChannels( final MENetworkChannelsChanged changedChannels ) public void chanRender( final MENetworkChannelsChanged changedChannels )
{ {
this.updateStatus(); this.updateStatus();
} }
@@ -153,7 +155,7 @@ public abstract class PartSharedStorageBus extends PartUpgradeable implements IG
@Override @Override
public void updateSetting( final IConfigManager manager, final Enum settingName, final Enum newValue ) public void updateSetting( final IConfigManager manager, final Enum settingName, final Enum newValue )
{ {
if( settingName instanceof AccessRestriction ) if( settingName.name().equals( "ACCESS" ) )
{ {
this.accessChanged = true; this.accessChanged = true;
} }
@@ -178,7 +180,7 @@ public abstract class PartSharedStorageBus extends PartUpgradeable implements IG
this.resetCache(); this.resetCache();
} }
} }
if( te == null || te instanceof TileFluidInterface ) else if( te == null || te instanceof TileFluidInterface )
{ {
this.resetCache( true ); this.resetCache( true );
this.resetCache(); this.resetCache();
@@ -195,6 +197,7 @@ public abstract class PartSharedStorageBus extends PartUpgradeable implements IG
{ {
super.readFromNBT( data ); super.readFromNBT( data );
this.priority = data.getInteger( "priority" ); this.priority = data.getInteger( "priority" );
this.accessChanged = false;
} }
@Override @Override
@@ -23,9 +23,8 @@ import java.util.Collections;
import java.util.List; import java.util.List;
import java.util.Objects; import java.util.Objects;
import appeng.fluids.parts.FluidHandlerAdapter; import appeng.api.networking.storage.IStorageGrid;
import appeng.me.storage.MEPassThrough; import appeng.me.cache.GridStorageCache;
import appeng.parts.AEBasePart;
import appeng.tile.misc.TileInterface; import appeng.tile.misc.TileInterface;
import appeng.tile.networking.TileCableBus; import appeng.tile.networking.TileCableBus;
import appeng.util.ConfigManager; import appeng.util.ConfigManager;
@@ -92,7 +91,6 @@ import appeng.me.GridAccessException;
import appeng.me.helpers.MachineSource; import appeng.me.helpers.MachineSource;
import appeng.me.storage.ITickingMonitor; import appeng.me.storage.ITickingMonitor;
import appeng.me.storage.MEInventoryHandler; import appeng.me.storage.MEInventoryHandler;
import appeng.me.storage.MEMonitorIInventory;
import appeng.parts.PartModel; import appeng.parts.PartModel;
import appeng.parts.automation.PartUpgradeable; import appeng.parts.automation.PartUpgradeable;
import appeng.tile.inventory.AppEngInternalAEInventory; import appeng.tile.inventory.AppEngInternalAEInventory;
@@ -128,6 +126,7 @@ public class PartStorageBus extends PartUpgradeable implements IGridTickable, IC
private boolean wasActive = false; private boolean wasActive = false;
private byte resetCacheLogic = 0; private byte resetCacheLogic = 0;
private boolean accessChanged; private boolean accessChanged;
private boolean readOncePass;
@Reflected @Reflected
public PartStorageBus( final ItemStack is ) public PartStorageBus( final ItemStack is )
@@ -164,8 +163,9 @@ public class PartStorageBus extends PartUpgradeable implements IGridTickable, IC
} }
} }
@Override
@MENetworkEventSubscribe @MENetworkEventSubscribe
public void updateChannels( final MENetworkChannelsChanged changedChannels ) public void chanRender( final MENetworkChannelsChanged changedChannels )
{ {
this.updateStatus(); this.updateStatus();
} }
@@ -179,7 +179,7 @@ public class PartStorageBus extends PartUpgradeable implements IGridTickable, IC
@Override @Override
public void updateSetting( final IConfigManager manager, final Enum settingName, final Enum newValue ) public void updateSetting( final IConfigManager manager, final Enum settingName, final Enum newValue )
{ {
if( settingName instanceof AccessRestriction ) if( settingName.name().equals( "ACCESS" ) )
{ {
this.accessChanged = true; this.accessChanged = true;
} }
@@ -211,6 +211,7 @@ public class PartStorageBus extends PartUpgradeable implements IGridTickable, IC
super.readFromNBT( data ); super.readFromNBT( data );
this.Config.readFromNBT( data, "config" ); this.Config.readFromNBT( data, "config" );
this.priority = data.getInteger( "priority" ); this.priority = data.getInteger( "priority" );
this.accessChanged = false;
} }
@Override @Override
@@ -269,24 +270,34 @@ public class PartStorageBus extends PartUpgradeable implements IGridTickable, IC
@Override @Override
public void postChange( final IBaseMonitor<IAEItemStack> monitor, final Iterable<IAEItemStack> change, final IActionSource source ) public void postChange( final IBaseMonitor<IAEItemStack> monitor, final Iterable<IAEItemStack> change, final IActionSource source )
{ {
if( this.mySrc.machine().map( machine -> machine == this ).orElse( false ) && monitor != null ) if( this.getProxy().isActive() )
{ {
AccessRestriction currentAccess = (AccessRestriction) ( (ConfigManager) this.getConfigManager() ).getSetting( Settings.ACCESS ); AccessRestriction currentAccess = (AccessRestriction) ( (ConfigManager) this.getConfigManager() ).getSetting( Settings.ACCESS );
if( readOncePass )
{
readOncePass = false;
try
{
this.getProxy().getStorage().postAlterationOfStoredItems( AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ), change, source );
}
catch( final GridAccessException e )
{
// :(
}
return;
}
if( !currentAccess.hasPermission( AccessRestriction.READ ) ) if( !currentAccess.hasPermission( AccessRestriction.READ ) )
{ {
return; return;
} }
} try
try
{
if( this.getProxy().isActive() )
{ {
this.getProxy().getStorage().postAlterationOfStoredItems( AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ), change, this.mySrc ); this.getProxy().getStorage().postAlterationOfStoredItems( AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ), change, source );
}
catch( final GridAccessException e )
{
// :(
} }
}
catch( final GridAccessException e )
{
// :(
} }
} }
@@ -321,7 +332,7 @@ public class PartStorageBus extends PartUpgradeable implements IGridTickable, IC
this.resetCache(); this.resetCache();
} }
} }
if( te == null || te instanceof TileInterface ) else if( te == null || te instanceof TileInterface )
{ {
this.resetCache( true ); this.resetCache( true );
this.resetCache(); this.resetCache();
@@ -377,8 +388,8 @@ public class PartStorageBus extends PartUpgradeable implements IGridTickable, IC
this.resetCacheLogic = 0; this.resetCacheLogic = 0;
final MEInventoryHandler<IAEItemStack> in = this.getInternalHandler(); final MEInventoryHandler<IAEItemStack> in = this.getInternalHandler();
IItemList<IAEItemStack> before = AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ).createList(); IItemList<IAEItemStack> before = AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ).createList();
boolean denyRead = false;
if( in != null ) if( in != null )
{ {
if( accessChanged ) if( accessChanged )
@@ -387,7 +398,7 @@ public class PartStorageBus extends PartUpgradeable implements IGridTickable, IC
AccessRestriction oldAccess = (AccessRestriction) ( (ConfigManager) this.getConfigManager() ).getOldSetting( Settings.ACCESS ); AccessRestriction oldAccess = (AccessRestriction) ( (ConfigManager) this.getConfigManager() ).getOldSetting( Settings.ACCESS );
if( oldAccess.hasPermission( AccessRestriction.READ ) && !currentAccess.hasPermission( AccessRestriction.READ ) ) if( oldAccess.hasPermission( AccessRestriction.READ ) && !currentAccess.hasPermission( AccessRestriction.READ ) )
{ {
denyRead = true; readOncePass = true;
} }
in.setBaseAccess( oldAccess ); in.setBaseAccess( oldAccess );
before = in.getAvailableItems( before ); before = in.getAvailableItems( before );
@@ -408,17 +419,15 @@ public class PartStorageBus extends PartUpgradeable implements IGridTickable, IC
final MEInventoryHandler<IAEItemStack> out = this.getInternalHandler(); final MEInventoryHandler<IAEItemStack> out = this.getInternalHandler();
if( in != out || denyRead ) IItemList<IAEItemStack> after = AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ).createList();
{
IItemList<IAEItemStack> after = AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ).createList();
if( out != null && !denyRead ) if( in != out )
{
if( out != null )
{ {
after = out.getAvailableItems( after ); after = out.getAvailableItems( after );
} }
Platform.postListChanges( before, after, this, this.mySrc ); Platform.postListChanges( before, after, this, this.mySrc );
} }
} }
@@ -522,7 +531,7 @@ public class PartStorageBus extends PartUpgradeable implements IGridTickable, IC
if( inv instanceof ITickingMonitor ) if( inv instanceof ITickingMonitor )
{ {
this.monitor = (ITickingMonitor) inv; this.monitor = (ITickingMonitor) inv;
this.monitor.setActionSource( new MachineSource( this ) ); this.monitor.setActionSource( mySrc );
this.monitor.setMode( (StorageFilter) this.getConfigManager().getSetting( Settings.STORAGE_FILTER ) ); this.monitor.setMode( (StorageFilter) this.getConfigManager().getSetting( Settings.STORAGE_FILTER ) );
} }
@@ -561,7 +570,10 @@ public class PartStorageBus extends PartUpgradeable implements IGridTickable, IC
if( inv instanceof IBaseMonitor ) if( inv instanceof IBaseMonitor )
{ {
( (IBaseMonitor<IAEItemStack>) inv ).addListener( this, this.handler ); if( ( (AccessRestriction) ( (ConfigManager) this.getConfigManager() ).getSetting( Settings.ACCESS ) ).hasPermission( AccessRestriction.READ ) )
{
( (IBaseMonitor<IAEItemStack>) inv ).addListener( this, this.handler );
}
} }
} }
} }
@@ -590,7 +602,7 @@ public class PartStorageBus extends PartUpgradeable implements IGridTickable, IC
try try
{ {
// force grid to update handlers... // force grid to update handlers...
this.getProxy().getGrid().postEvent( new MENetworkCellArrayUpdate() ); (( GridStorageCache ) this.getProxy().getGrid().getCache( IStorageGrid.class )).cellUpdate( null );
} }
catch( final GridAccessException e ) catch( final GridAccessException e )
{ {
@@ -83,10 +83,19 @@ public class PartP2PFluids extends PartP2PTunnel<PartP2PFluids> implements IFlui
if( this.isOutput() ) if( this.isOutput() )
{ {
final PartP2PFluids in = this.getInput(); try
if( in != null )
{ {
in.onTunnelNetworkChange(); for( PartP2PFluids in : this.getInputs() )
{
if( in != null )
{
in.onTunnelNetworkChange();
}
}
}
catch( GridAccessException e )
{
e.printStackTrace();
} }
} }
} }
@@ -124,13 +133,21 @@ public class PartP2PFluids extends PartP2PTunnel<PartP2PFluids> implements IFlui
{ {
if( !this.isOutput() ) if( !this.isOutput() )
{ {
final PartP2PFluids tun = this.getInput(); try
if( tun != null )
{ {
return ACTIVE_TANK; for( PartP2PFluids tun : this.getInputs() )
{
if( tun != null )
{
return ACTIVE_TANK;
}
}
}
catch( GridAccessException e )
{
e.printStackTrace();
} }
} }
return INACTIVE_TANK; return INACTIVE_TANK;
} }
@@ -74,10 +74,19 @@ public class PartP2PItems extends PartP2PTunnel<PartP2PItems> implements IItemHa
public void onNeighborChanged( IBlockAccess w, BlockPos pos, BlockPos neighbor ) public void onNeighborChanged( IBlockAccess w, BlockPos pos, BlockPos neighbor )
{ {
this.cachedInv = null; this.cachedInv = null;
final PartP2PItems input = this.getInput(); try
if( input != null && this.isOutput() )
{ {
input.onTunnelNetworkChange(); for( PartP2PItems input : this.getInputs() )
{
if( input != null && this.isOutput() )
{
input.onTunnelNetworkChange();
}
}
}
catch( GridAccessException e )
{
e.printStackTrace();
} }
} }
@@ -222,10 +231,19 @@ public class PartP2PItems extends PartP2PTunnel<PartP2PItems> implements IItemHa
} }
else else
{ {
final PartP2PItems input = this.getInput(); try
if( input != null )
{ {
input.getHost().notifyNeighbors(); for( PartP2PItems input : this.getInputs() )
{
if( input != null )
{
input.getHost().notifyNeighbors();
}
}
}
catch( GridAccessException e )
{
e.printStackTrace();
} }
} }
} }
@@ -196,14 +196,23 @@ public class PartP2PLight extends PartP2PTunnel<PartP2PLight> implements IGridTi
{ {
if( this.isOutput() ) if( this.isOutput() )
{ {
final PartP2PLight src = this.getInput(); try
if( src != null && src.getProxy().isActive() )
{ {
this.setLightLevel( src.lastValue ); for( PartP2PLight src : this.getInputs() )
{
if( src != null && src.getProxy().isActive() )
{
this.setLightLevel( src.lastValue );
}
else
{
this.getHost().markForUpdate();
}
}
} }
else catch( GridAccessException e )
{ {
this.getHost().markForUpdate(); e.printStackTrace();
} }
} }
else else
@@ -70,10 +70,19 @@ public class PartP2PRedstone extends PartP2PTunnel<PartP2PRedstone>
{ {
if( this.isOutput() ) if( this.isOutput() )
{ {
final PartP2PRedstone in = this.getInput(); try
if( in != null )
{ {
this.putInput( in.power ); for( PartP2PRedstone in : this.getInputs() )
{
if( in != null )
{
this.putInput( in.power );
}
}
}
catch( GridAccessException e )
{
e.printStackTrace();
} }
} }
} }
@@ -53,6 +53,7 @@ import appeng.me.cache.P2PCache;
import appeng.me.cache.helpers.TunnelCollection; import appeng.me.cache.helpers.TunnelCollection;
import appeng.parts.PartBasicState; import appeng.parts.PartBasicState;
import appeng.util.Platform; import appeng.util.Platform;
import org.lwjgl.input.Keyboard;
public abstract class PartP2PTunnel<T extends PartP2PTunnel> extends PartBasicState public abstract class PartP2PTunnel<T extends PartP2PTunnel> extends PartBasicState
@@ -77,26 +78,13 @@ public abstract class PartP2PTunnel<T extends PartP2PTunnel> extends PartBasicSt
return null; return null;
} }
public T getInput() public TunnelCollection<T> getInputs() throws GridAccessException
{ {
if( this.getFrequency() == 0 ) if( this.getProxy().isActive() && this.getFrequency() != 0 )
{ {
return null; return (TunnelCollection<T>) this.getProxy().getP2P().getInputs( this.getFrequency(), this.getClass() );
} }
return new TunnelCollection( new ArrayList(), this.getClass() );
try
{
final PartP2PTunnel tunnel = this.getProxy().getP2P().getInput( this.getFrequency() );
if( this.getClass().isInstance( tunnel ) )
{
return (T) tunnel;
}
}
catch( final GridAccessException e )
{
// :P
}
return null;
} }
public TunnelCollection<T> getOutputs() throws GridAccessException public TunnelCollection<T> getOutputs() throws GridAccessException
@@ -211,14 +199,28 @@ public abstract class PartP2PTunnel<T extends PartP2PTunnel> extends PartBasicSt
final IPart testPart = ( (IPartItem) newType.getItem() ).createPartFromItemStack( newType ); final IPart testPart = ( (IPartItem) newType.getItem() ).createPartFromItemStack( newType );
if( testPart instanceof PartP2PTunnel ) if( testPart instanceof PartP2PTunnel )
{ {
try
{
this.getProxy().getP2P().removeTunnel( this, this.getFrequency() );
}
catch( GridAccessException e )
{
e.printStackTrace();
}
this.getHost().removePart( this.getSide(), true ); this.getHost().removePart( this.getSide(), true );
final AEPartLocation dir = this.getHost().addPart( newType, this.getSide(), player, hand ); final AEPartLocation dir = this.getHost().addPart( newType, this.getSide(), player, hand );
final IPart newBus = this.getHost().getPart( dir ); final IPart newBus = this.getHost().getPart( dir );
if( newBus instanceof PartP2PTunnel ) if( newBus instanceof PartP2PTunnel )
{ {
final PartP2PTunnel newTunnel = (PartP2PTunnel) newBus; final PartP2PTunnel newTunnel = (PartP2PTunnel) newBus;
newTunnel.setOutput( true ); if( !Keyboard.isKeyDown( Keyboard.KEY_LCONTROL ) && !Keyboard.isKeyDown( Keyboard.KEY_RCONTROL ) )
{
newTunnel.setOutput( true );
}
try try
{ {
@@ -295,7 +297,17 @@ public abstract class PartP2PTunnel<T extends PartP2PTunnel> extends PartBasicSt
final boolean oldOutput = this.isOutput(); final boolean oldOutput = this.isOutput();
final short myFreq = this.getFrequency(); final short myFreq = this.getFrequency();
try
{
this.getProxy().getP2P().removeTunnel( this, this.getFrequency() );
}
catch( GridAccessException e )
{
e.printStackTrace();
}
this.getHost().removePart( this.getSide(), false ); this.getHost().removePart( this.getSide(), false );
final AEPartLocation dir = this.getHost().addPart( newType, this.getSide(), player, hand ); final AEPartLocation dir = this.getHost().addPart( newType, this.getSide(), player, hand );
final IPart newBus = this.getHost().getPart( dir ); final IPart newBus = this.getHost().getPart( dir );
@@ -303,7 +315,6 @@ public abstract class PartP2PTunnel<T extends PartP2PTunnel> extends PartBasicSt
{ {
final PartP2PTunnel newTunnel = (PartP2PTunnel) newBus; final PartP2PTunnel newTunnel = (PartP2PTunnel) newBus;
newTunnel.setOutput( oldOutput ); newTunnel.setOutput( oldOutput );
newTunnel.onTunnelNetworkChange();
try try
{ {
@@ -314,9 +325,10 @@ public abstract class PartP2PTunnel<T extends PartP2PTunnel> extends PartBasicSt
{ {
// :P // :P
} }
newTunnel.onTunnelNetworkChange();
} }
Platform.notifyBlocksOfNeighbors( this.getTile().getWorld(), this.getTile().getPos() );
return true; return true;
} }
} }
@@ -353,7 +365,17 @@ public abstract class PartP2PTunnel<T extends PartP2PTunnel> extends PartBasicSt
final ItemStack newType = this.getHost().getPart( this.getSide() ).getItemStack( PartItemStack.WRENCH ); final ItemStack newType = this.getHost().getPart( this.getSide() ).getItemStack( PartItemStack.WRENCH );
try
{
this.getProxy().getP2P().removeTunnel( this, this.getFrequency() );
}
catch( GridAccessException e )
{
e.printStackTrace();
}
this.getHost().removePart( this.getSide(), false ); this.getHost().removePart( this.getSide(), false );
final AEPartLocation dir = this.getHost().addPart( newType, this.getSide(), player, hand ); final AEPartLocation dir = this.getHost().addPart( newType, this.getSide(), player, hand );
final IPart newBus = this.getHost().getPart( dir ); final IPart newBus = this.getHost().getPart( dir );
@@ -361,14 +383,17 @@ public abstract class PartP2PTunnel<T extends PartP2PTunnel> extends PartBasicSt
{ {
final PartP2PTunnel newTunnel = (PartP2PTunnel) newBus; final PartP2PTunnel newTunnel = (PartP2PTunnel) newBus;
newTunnel.setOutput( false ); newTunnel.setOutput( false );
newTunnel.onTunnelNetworkChange();
newTunnel.getProxy().getP2P().updateFreq( newTunnel, newFreq ); newTunnel.getProxy().getP2P().updateFreq( newTunnel, newFreq );
newTunnel.onTunnelNetworkChange();
} }
} }
else else
{ {
this.getProxy().getP2P().updateFreq( this, newFreq ); this.getProxy().getP2P().updateFreq( this, newFreq );
this.onTunnelNetworkChange();
} }
Platform.notifyBlocksOfNeighbors( this.getTile().getWorld(), this.getTile().getPos() );
} }
catch( final GridAccessException e ) catch( final GridAccessException e )
{ {
@@ -418,7 +443,6 @@ public abstract class PartP2PTunnel<T extends PartP2PTunnel> extends PartBasicSt
public void onTunnelNetworkChange() public void onTunnelNetworkChange()
{ {
} }
protected void queueTunnelDrain( final PowerUnits unit, final double f ) protected void queueTunnelDrain( final PowerUnits unit, final double f )
@@ -417,7 +417,7 @@ public abstract class AbstractPartMonitor extends AbstractPartDisplay implements
@Override @Override
public void onStackChange( IItemList<?> o, IAEStack<?> fullStack, IAEStack<?> diffStack, IActionSource src, IStorageChannel<?> chan ) public void onStackChange( IItemList<?> o, IAEStack<?> fullStack, IAEStack<?> diffStack, IActionSource src, IStorageChannel<?> chan )
{ {
this.configuredAmount = this.configuredAmount + diffStack.getStackSize(); this.configuredAmount = fullStack.getStackSize();
if( this.configuredItem != null ) if( this.configuredItem != null )
{ {
@@ -123,7 +123,7 @@ public class AppEngInternalInventory extends ItemStackHandler implements Iterabl
ItemStack oldStack = this.previousStack; ItemStack oldStack = this.previousStack;
InvOperation op = InvOperation.SET; InvOperation op = InvOperation.SET;
if( newStack.isEmpty() || oldStack.isEmpty() || ItemStack.areItemsEqual( newStack, oldStack ) ) if( newStack.isEmpty() || oldStack.isEmpty() || ( oldStack.getCount() < oldStack.getMaxStackSize() && oldStack.getCount() < this.getSlotLimit( slot ) && ItemStack.areItemsEqual( newStack, oldStack ) ) )
{ {
if( newStack.getCount() > oldStack.getCount() ) if( newStack.getCount() > oldStack.getCount() )
{ {
@@ -155,7 +155,7 @@ public class TileEnergyCell extends AENetworkTile implements IAEPowerStorage
return 0; return 0;
} }
if( this.internalCurrentPower < 0.01 && amt > 0.01 ) if( this.internalCurrentPower < 0.01 && amt > 0 )
{ {
this.getProxy().getNode().getGrid().postEvent( new MENetworkPowerStorage( this, PowerEventType.PROVIDE_POWER ) ); this.getProxy().getNode().getGrid().postEvent( new MENetworkPowerStorage( this, PowerEventType.PROVIDE_POWER ) );
} }
@@ -217,7 +217,7 @@ public class TileEnergyCell extends AENetworkTile implements IAEPowerStorage
final boolean wasFull = this.internalCurrentPower >= this.getInternalMaxPower() - 0.001; final boolean wasFull = this.internalCurrentPower >= this.getInternalMaxPower() - 0.001;
if( wasFull && amt > 0.001 ) if( wasFull && amt > 0 )
{ {
try try
{ {
@@ -26,6 +26,8 @@ import java.util.List;
import javax.annotation.Nonnull; import javax.annotation.Nonnull;
import javax.annotation.Nullable; import javax.annotation.Nullable;
import appeng.me.storage.BasicCellInventoryHandler;
import appeng.me.storage.CreativeCellInventory;
import io.netty.buffer.ByteBuf; import io.netty.buffer.ByteBuf;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
@@ -735,7 +737,15 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, ITerminal
{ {
return input; return input;
} }
return super.injectItems( input, mode, src ); T injected = super.injectItems( input, mode, src );
if (mode == Actionable.MODULATE && ( injected == null || injected.getStackSize() != input.getStackSize() ))
{
if( TileChest.this.getProxy().isActive() && this.getInternalHandler().getCellInv() != null )
{
TileChest.this.cellHandler.postChangesToListeners(Collections.singletonList( input.copy().setStackSize( input.getStackSize() - ( injected == null ? 0 : injected.getStackSize() ) ) ), TileChest.this.mySrc );
}
}
return injected;
} }
private boolean securityCheck( final EntityPlayer player, final SecurityPermissions requiredPermission ) private boolean securityCheck( final EntityPlayer player, final SecurityPermissions requiredPermission )
@@ -779,7 +789,15 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, ITerminal
{ {
return null; return null;
} }
return super.extractItems( request, mode, src ); T extracted = super.extractItems( request, mode, src );
if( mode == Actionable.MODULATE && extracted != null )
{
if( TileChest.this.getProxy().isActive() && this.getInternalHandler().getCellInv() != null )
{
TileChest.this.cellHandler.postChangesToListeners(Collections.singletonList( request.copy().setStackSize( -extracted.getStackSize() ) ), TileChest.this.mySrc );
}
}
return extracted;
} }
} }
@@ -405,8 +405,10 @@ waila.appliedenergistics2.Showing=Showing
waila.appliedenergistics2.Contains=Contains waila.appliedenergistics2.Contains=Contains
waila.appliedenergistics2.Channels=%1$d of %2$d Channels waila.appliedenergistics2.Channels=%1$d of %2$d Channels
waila.appliedenergistics2.P2PUnlinked=Unlinked waila.appliedenergistics2.P2PUnlinked=Unlinked
waila.appliedenergistics2.P2PInputOneOutput=Linked (Input Side) waila.appliedenergistics2.p2p_input_one_output=Linked (Input Side) - 1 Output
waila.appliedenergistics2.P2PInputManyOutputs=Linked (Input Side) - %d Outputs waila.appliedenergistics2.p2p_input_many_outputs=Linked (Input Side) - %d Outputs
waila.appliedenergistics2.p2p_output_one_input=Linked (Output Side) - 1 Input
waila.appliedenergistics2.p2p_output_many_inputs=Linked (Output Side) - %d Inputs
waila.appliedenergistics2.P2POutput=Linked (Output Side) waila.appliedenergistics2.P2POutput=Linked (Output Side)
// TheOneProbe // TheOneProbe
@@ -420,8 +422,10 @@ theoneprobe.appliedenergistics2.showing=Showing
theoneprobe.appliedenergistics2.contains=Contains theoneprobe.appliedenergistics2.contains=Contains
theoneprobe.appliedenergistics2.channels=%1$d of %2$d Channels theoneprobe.appliedenergistics2.channels=%1$d of %2$d Channels
theoneprobe.appliedenergistics2.p2p_unlinked=Unlinked theoneprobe.appliedenergistics2.p2p_unlinked=Unlinked
theoneprobe.appliedenergistics2.p2p_input_one_output=Linked (Input Side) theoneprobe.appliedenergistics2.p2p_input_one_output=Linked (Input Side) - 1 Output
theoneprobe.appliedenergistics2.p2p_input_many_outputs=Linked (Input Side) - %d Outputs theoneprobe.appliedenergistics2.p2p_input_many_outputs=Linked (Input Side) - %d Outputs
theoneprobe.appliedenergistics2.p2p_output_one_input=Linked (Output Side) - 1 Input
theoneprobe.appliedenergistics2.p2p_output_many_inputs=Linked (Output Side) - %d Inputs
theoneprobe.appliedenergistics2.p2p_output=Linked (Output Side) theoneprobe.appliedenergistics2.p2p_output=Linked (Output Side)
theoneprobe.appliedenergistics2.p2p_frequency=Frequency: %1$s theoneprobe.appliedenergistics2.p2p_frequency=Frequency: %1$s
theoneprobe.appliedenergistics2.stored_energy=%1$d / %2$d theoneprobe.appliedenergistics2.stored_energy=%1$d / %2$d