Puts everywhere brackets
This commit is contained in:
@@ -123,7 +123,9 @@ public abstract class AEBasePart implements IPart, IGridProxyable, IActionHost,
|
||||
protected AEColor getColor()
|
||||
{
|
||||
if( this.host == null )
|
||||
{
|
||||
return AEColor.Transparent;
|
||||
}
|
||||
return this.host.getColor();
|
||||
}
|
||||
|
||||
@@ -376,7 +378,9 @@ public abstract class AEBasePart implements IPart, IGridProxyable, IActionHost,
|
||||
{
|
||||
IConfigManager cm = this.getConfigManager();
|
||||
if( cm != null )
|
||||
{
|
||||
cm.readFromNBT( compound );
|
||||
}
|
||||
}
|
||||
|
||||
if( this instanceof IPriorityHost )
|
||||
@@ -392,7 +396,9 @@ public abstract class AEBasePart implements IPart, IGridProxyable, IActionHost,
|
||||
AppEngInternalAEInventory tmp = new AppEngInternalAEInventory( null, target.getSizeInventory() );
|
||||
tmp.readFromNBT( compound, "config" );
|
||||
for( int x = 0; x < tmp.getSizeInventory(); x++ )
|
||||
{
|
||||
target.setInventorySlotContents( x, tmp.getStackInSlot( x ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -409,7 +415,9 @@ public abstract class AEBasePart implements IPart, IGridProxyable, IActionHost,
|
||||
|
||||
IConfigManager cm = this.getConfigManager();
|
||||
if( cm != null )
|
||||
{
|
||||
cm.writeToNBT( output );
|
||||
}
|
||||
|
||||
if( this instanceof IPriorityHost )
|
||||
{
|
||||
@@ -472,7 +480,9 @@ public abstract class AEBasePart implements IPart, IGridProxyable, IActionHost,
|
||||
memoryCard.notifyUser( player, MemoryCardMessages.SETTINGS_LOADED );
|
||||
}
|
||||
else
|
||||
{
|
||||
memoryCard.notifyUser( player, MemoryCardMessages.INVALID_MACHINE );
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@@ -483,7 +493,9 @@ public abstract class AEBasePart implements IPart, IGridProxyable, IActionHost,
|
||||
public final boolean onActivate( EntityPlayer player, Vec3 pos )
|
||||
{
|
||||
if( this.useMemoryCard( player ) )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return this.onPartActivate( player, pos );
|
||||
}
|
||||
@@ -492,7 +504,9 @@ public abstract class AEBasePart implements IPart, IGridProxyable, IActionHost,
|
||||
public final boolean onShiftActivate( EntityPlayer player, Vec3 pos )
|
||||
{
|
||||
if( this.useMemoryCard( player ) )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return this.onPartShiftActivate( player, pos );
|
||||
}
|
||||
|
||||
@@ -112,7 +112,9 @@ public class CableBusContainer extends CableBusStorage implements AEMultiTile, I
|
||||
newSides[ForgeDirection.NORTH.ordinal()] = this.getSide( ForgeDirection.WEST );
|
||||
|
||||
for( ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS )
|
||||
{
|
||||
this.setSide( dir, newSides[dir.ordinal()] );
|
||||
}
|
||||
|
||||
this.getFacadeContainer().rotateLeft();
|
||||
}
|
||||
@@ -127,7 +129,9 @@ public class CableBusContainer extends CableBusStorage implements AEMultiTile, I
|
||||
public boolean canAddPart( ItemStack is, ForgeDirection side )
|
||||
{
|
||||
if( PartPlacement.isFacade( is, side ) != null )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
if( is.getItem() instanceof IPartItem )
|
||||
{
|
||||
@@ -143,11 +147,17 @@ public class CableBusContainer extends CableBusStorage implements AEMultiTile, I
|
||||
{
|
||||
boolean canPlace = true;
|
||||
for( ForgeDirection d : ForgeDirection.VALID_DIRECTIONS )
|
||||
{
|
||||
if( this.getPart( d ) != null && !this.getPart( d ).canBePlacedOn( ( (IPartCable) bp ).supportsBuses() ) )
|
||||
{
|
||||
canPlace = false;
|
||||
}
|
||||
}
|
||||
|
||||
if( !canPlace )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return this.getPart( ForgeDirection.UNKNOWN ) == null;
|
||||
}
|
||||
@@ -155,7 +165,9 @@ public class CableBusContainer extends CableBusStorage implements AEMultiTile, I
|
||||
{
|
||||
IPart cable = this.getPart( ForgeDirection.UNKNOWN );
|
||||
if( cable != null && !bp.canBePlacedOn( ( (IPartCable) cable ).supportsBuses() ) )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return this.getPart( side ) == null;
|
||||
}
|
||||
@@ -181,23 +193,35 @@ public class CableBusContainer extends CableBusStorage implements AEMultiTile, I
|
||||
{
|
||||
boolean canPlace = true;
|
||||
for( ForgeDirection d : ForgeDirection.VALID_DIRECTIONS )
|
||||
{
|
||||
if( this.getPart( d ) != null && !this.getPart( d ).canBePlacedOn( ( (IPartCable) bp ).supportsBuses() ) )
|
||||
{
|
||||
canPlace = false;
|
||||
}
|
||||
}
|
||||
|
||||
if( !canPlace )
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
if( this.getPart( ForgeDirection.UNKNOWN ) != null )
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
this.setCenter( (IPartCable) bp );
|
||||
bp.setPartHostInfo( ForgeDirection.UNKNOWN, this, this.tcb.getTile() );
|
||||
|
||||
if( player != null )
|
||||
{
|
||||
bp.onPlacement( player, is, side );
|
||||
}
|
||||
|
||||
if( this.inWorld )
|
||||
{
|
||||
bp.addToWorld();
|
||||
}
|
||||
|
||||
IGridNode cn = this.getCenter().getGridNode();
|
||||
if( cn != null )
|
||||
@@ -237,16 +261,22 @@ public class CableBusContainer extends CableBusStorage implements AEMultiTile, I
|
||||
{
|
||||
IPart cable = this.getPart( ForgeDirection.UNKNOWN );
|
||||
if( cable != null && !bp.canBePlacedOn( ( (IPartCable) cable ).supportsBuses() ) )
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
this.setSide( side, bp );
|
||||
bp.setPartHostInfo( side, this, this.getTile() );
|
||||
|
||||
if( player != null )
|
||||
{
|
||||
bp.onPlacement( player, is, side );
|
||||
}
|
||||
|
||||
if( this.inWorld )
|
||||
{
|
||||
bp.addToWorld();
|
||||
}
|
||||
|
||||
if( this.getCenter() != null )
|
||||
{
|
||||
@@ -286,7 +316,9 @@ public class CableBusContainer extends CableBusStorage implements AEMultiTile, I
|
||||
public IPart getPart( ForgeDirection side )
|
||||
{
|
||||
if( side == ForgeDirection.UNKNOWN )
|
||||
{
|
||||
return this.getCenter();
|
||||
}
|
||||
return this.getSide( side );
|
||||
}
|
||||
|
||||
@@ -296,13 +328,17 @@ public class CableBusContainer extends CableBusStorage implements AEMultiTile, I
|
||||
if( side == ForgeDirection.UNKNOWN )
|
||||
{
|
||||
if( this.getCenter() != null )
|
||||
{
|
||||
this.getCenter().removeFromWorld();
|
||||
}
|
||||
this.setCenter( null );
|
||||
}
|
||||
else
|
||||
{
|
||||
if( this.getSide( side ) != null )
|
||||
{
|
||||
this.getSide( side ).removeFromWorld();
|
||||
}
|
||||
this.setSide( side, null );
|
||||
}
|
||||
|
||||
@@ -445,7 +481,9 @@ public class CableBusContainer extends CableBusStorage implements AEMultiTile, I
|
||||
public boolean hasRedstone( ForgeDirection side )
|
||||
{
|
||||
if( this.hasRedstone == YesNo.UNDECIDED )
|
||||
{
|
||||
this.updateRedstone();
|
||||
}
|
||||
|
||||
return this.hasRedstone == YesNo.YES;
|
||||
}
|
||||
@@ -458,13 +496,17 @@ public class CableBusContainer extends CableBusStorage implements AEMultiTile, I
|
||||
{
|
||||
IPart part = this.getPart( s );
|
||||
if( part != null )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if( s != ForgeDirection.UNKNOWN )
|
||||
{
|
||||
IFacadePart fp = fc.getFacade( s );
|
||||
if( fp != null )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
@@ -507,7 +549,9 @@ public class CableBusContainer extends CableBusStorage implements AEMultiTile, I
|
||||
{
|
||||
IPart p = this.getPart( s );
|
||||
if( p != null )
|
||||
{
|
||||
this.requiresDynamicRender = this.requiresDynamicRender || p.requireDynamicRender();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -523,20 +567,26 @@ public class CableBusContainer extends CableBusStorage implements AEMultiTile, I
|
||||
for( ForgeDirection s : ForgeDirection.VALID_DIRECTIONS )
|
||||
{
|
||||
if( this.getPart( s ) != null || this.isBlocked( s ) )
|
||||
{
|
||||
sides.remove( s );
|
||||
}
|
||||
}
|
||||
|
||||
this.getCenter().setValidSides( sides );
|
||||
IGridNode n = this.getCenter().getGridNode();
|
||||
if( n != null )
|
||||
{
|
||||
n.updateState();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void addToWorld()
|
||||
{
|
||||
if( this.inWorld )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
this.inWorld = true;
|
||||
IS_LOADING.set( true );
|
||||
@@ -592,7 +642,9 @@ public class CableBusContainer extends CableBusStorage implements AEMultiTile, I
|
||||
public void removeFromWorld()
|
||||
{
|
||||
if( !this.inWorld )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
this.inWorld = false;
|
||||
|
||||
@@ -600,7 +652,9 @@ public class CableBusContainer extends CableBusStorage implements AEMultiTile, I
|
||||
{
|
||||
IPart part = this.getPart( s );
|
||||
if( part != null )
|
||||
{
|
||||
part.removeFromWorld();
|
||||
}
|
||||
}
|
||||
|
||||
this.partChanged();
|
||||
@@ -614,11 +668,15 @@ public class CableBusContainer extends CableBusStorage implements AEMultiTile, I
|
||||
{
|
||||
IGridNode n = part.getExternalFacingNode();
|
||||
if( n != null )
|
||||
{
|
||||
return n;
|
||||
}
|
||||
}
|
||||
|
||||
if( this.getCenter() != null )
|
||||
{
|
||||
return this.getCenter().getGridNode();
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
@@ -631,7 +689,9 @@ public class CableBusContainer extends CableBusStorage implements AEMultiTile, I
|
||||
{
|
||||
AECableType t = ( (IGridHost) part ).getCableConnectionType( dir );
|
||||
if( t != null && t != AECableType.NONE )
|
||||
{
|
||||
return t;
|
||||
}
|
||||
}
|
||||
|
||||
if( this.getCenter() != null )
|
||||
@@ -649,7 +709,9 @@ public class CableBusContainer extends CableBusStorage implements AEMultiTile, I
|
||||
{
|
||||
IPart p = this.getPart( d );
|
||||
if( p instanceof IGridHost )
|
||||
{
|
||||
( (IGridHost) p ).securityBreak();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -666,9 +728,13 @@ public class CableBusContainer extends CableBusStorage implements AEMultiTile, I
|
||||
if( part != null )
|
||||
{
|
||||
if( ignoreCableConnections && part instanceof IPartCable )
|
||||
{
|
||||
bch.addBox( 6.0, 6.0, 6.0, 10.0, 10.0, 10.0 );
|
||||
}
|
||||
else
|
||||
{
|
||||
part.getBoxes( bch );
|
||||
}
|
||||
}
|
||||
|
||||
if( AEApi.instance().partHelper().getCableRenderMode().opaqueFacades || !visual )
|
||||
@@ -677,7 +743,9 @@ public class CableBusContainer extends CableBusStorage implements AEMultiTile, I
|
||||
{
|
||||
IFacadePart fp = fc.getFacade( s );
|
||||
if( fp != null )
|
||||
{
|
||||
fp.getBoxes( bch, e );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -706,7 +774,9 @@ public class CableBusContainer extends CableBusStorage implements AEMultiTile, I
|
||||
{
|
||||
IPart part = this.getPart( dir );
|
||||
if( part != null && part.canConnectRedstone() )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@@ -718,7 +788,9 @@ public class CableBusContainer extends CableBusStorage implements AEMultiTile, I
|
||||
{
|
||||
IPart part = this.getPart( s );
|
||||
if( part != null )
|
||||
{
|
||||
part.onEntityCollision( entity );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -742,7 +814,9 @@ public class CableBusContainer extends CableBusStorage implements AEMultiTile, I
|
||||
{
|
||||
IPart part = this.getPart( s );
|
||||
if( part != null )
|
||||
{
|
||||
part.onNeighborChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -750,12 +824,16 @@ public class CableBusContainer extends CableBusStorage implements AEMultiTile, I
|
||||
public boolean isSolidOnSide( ForgeDirection side )
|
||||
{
|
||||
if( side == null || side == ForgeDirection.UNKNOWN )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// facades are solid..
|
||||
IFacadePart fp = this.getFacadeContainer().getFacade( side );
|
||||
if( fp != null )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
// buses can be too.
|
||||
IPart part = this.getPart( side );
|
||||
@@ -771,7 +849,9 @@ public class CableBusContainer extends CableBusStorage implements AEMultiTile, I
|
||||
if( p != null )
|
||||
{
|
||||
if( p.isLadder( entity ) )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -800,11 +880,15 @@ public class CableBusContainer extends CableBusStorage implements AEMultiTile, I
|
||||
{
|
||||
IPart p = this.getPart( d );
|
||||
if( p != null )
|
||||
{
|
||||
light = Math.max( p.getLightLevel(), light );
|
||||
}
|
||||
}
|
||||
|
||||
if( light > 0 && AppEng.instance.isIntegrationEnabled( IntegrationType.CLApi ) )
|
||||
{
|
||||
return ( (ICLApi) AppEng.instance.getIntegration( IntegrationType.CLApi ) ).colorLight( this.getColor(), light );
|
||||
}
|
||||
|
||||
return light;
|
||||
}
|
||||
@@ -875,7 +959,9 @@ public class CableBusContainer extends CableBusStorage implements AEMultiTile, I
|
||||
if( current != null && current.getItem() == myItem && current.getItemDamage() == dmgValue )
|
||||
{
|
||||
if( p.readFromStream( data ) )
|
||||
{
|
||||
updateBlock = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -887,15 +973,21 @@ public class CableBusContainer extends CableBusStorage implements AEMultiTile, I
|
||||
p.readFromStream( data );
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new IllegalStateException( "Invalid Stream For CableBus Container." );
|
||||
}
|
||||
}
|
||||
}
|
||||
else if( this.getPart( side ) != null )
|
||||
{
|
||||
this.removePart( side, false );
|
||||
}
|
||||
}
|
||||
|
||||
if( this.getFacadeContainer().readFromStream( data ) )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return updateBlock;
|
||||
}
|
||||
@@ -927,14 +1019,18 @@ public class CableBusContainer extends CableBusStorage implements AEMultiTile, I
|
||||
ForgeDirection getSide( IPart part )
|
||||
{
|
||||
if( this.getCenter() == part )
|
||||
{
|
||||
return ForgeDirection.UNKNOWN;
|
||||
}
|
||||
else
|
||||
{
|
||||
for( ForgeDirection side : ForgeDirection.VALID_DIRECTIONS )
|
||||
{
|
||||
if( this.getSide( side ) == part )
|
||||
{
|
||||
return side;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
throw new IllegalStateException( "Uhh Bad Part (" + part + ") on Side." );
|
||||
@@ -943,7 +1039,9 @@ public class CableBusContainer extends CableBusStorage implements AEMultiTile, I
|
||||
public void readFromNBT( NBTTagCompound data )
|
||||
{
|
||||
if( data.hasKey( "hasRedstone" ) )
|
||||
{
|
||||
this.hasRedstone = YesNo.values()[data.getInteger( "hasRedstone" )];
|
||||
}
|
||||
|
||||
for( int x = 0; x < 7; x++ )
|
||||
{
|
||||
@@ -956,12 +1054,16 @@ public class CableBusContainer extends CableBusStorage implements AEMultiTile, I
|
||||
IPart p = this.getPart( side );
|
||||
ItemStack iss = ItemStack.loadItemStackFromNBT( def );
|
||||
if( iss == null )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
ItemStack current = p == null ? null : p.getItemStack( PartItemStack.World );
|
||||
|
||||
if( Platform.isSameItemType( iss, current ) )
|
||||
{
|
||||
p.readFromNBT( extra );
|
||||
}
|
||||
else
|
||||
{
|
||||
this.removePart( side, true );
|
||||
@@ -978,7 +1080,9 @@ public class CableBusContainer extends CableBusStorage implements AEMultiTile, I
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
this.removePart( side, false );
|
||||
}
|
||||
}
|
||||
|
||||
this.getFacadeContainer().readFromNBT( data );
|
||||
@@ -999,7 +1103,9 @@ public class CableBusContainer extends CableBusStorage implements AEMultiTile, I
|
||||
{
|
||||
IFacadePart fp = this.getFacadeContainer().getFacade( s );
|
||||
if( fp != null )
|
||||
{
|
||||
drops.add( fp.getItemStack() );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -50,7 +50,9 @@ public class CableBusStorage
|
||||
{
|
||||
int x = side.ordinal();
|
||||
if( this.sides != null && this.sides.length > x )
|
||||
{
|
||||
return this.sides[x];
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
@@ -75,15 +77,23 @@ public class CableBusStorage
|
||||
{
|
||||
int newSize = -1;
|
||||
for( int x = 0; x < in.length; x++ )
|
||||
{
|
||||
if( in[x] != null )
|
||||
{
|
||||
newSize = x;
|
||||
}
|
||||
}
|
||||
|
||||
if( newSize == -1 )
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
newSize++;
|
||||
if( newSize == in.length )
|
||||
{
|
||||
return in;
|
||||
}
|
||||
|
||||
T[] newArray = (T[]) ( parts ? new IPart[newSize] : new IFacadePart[newSize] );
|
||||
System.arraycopy( in, 0, newArray, 0, newSize );
|
||||
@@ -94,13 +104,17 @@ public class CableBusStorage
|
||||
private <T> T[] grow( T[] in, int new_value, boolean parts )
|
||||
{
|
||||
if( in != null && in.length > new_value )
|
||||
{
|
||||
return in;
|
||||
}
|
||||
|
||||
int newSize = new_value + 1;
|
||||
|
||||
T[] newArray = (T[]) ( parts ? new IPart[newSize] : new IFacadePart[newSize] );
|
||||
if( in != null )
|
||||
{
|
||||
System.arraycopy( in, 0, newArray, 0, in.length );
|
||||
}
|
||||
|
||||
return newArray;
|
||||
}
|
||||
@@ -108,7 +122,9 @@ public class CableBusStorage
|
||||
public IFacadePart getFacade( int x )
|
||||
{
|
||||
if( this.facades != null && this.facades.length > x )
|
||||
{
|
||||
return this.facades[x];
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -110,10 +110,14 @@ public abstract class PartBasicState extends AEBasePart implements IPowerChannel
|
||||
try
|
||||
{
|
||||
if( this.proxy.getEnergy().isNetworkPowered() )
|
||||
{
|
||||
this.clientFlags |= this.POWERED_FLAG;
|
||||
}
|
||||
|
||||
if( this.proxy.getNode().meetsChannelRequirements() )
|
||||
{
|
||||
this.clientFlags |= this.CHANNEL_FLAG;
|
||||
}
|
||||
|
||||
this.clientFlags = this.populateFlags( this.clientFlags );
|
||||
}
|
||||
|
||||
@@ -76,21 +76,27 @@ public class PartPlacement
|
||||
public static boolean place( ItemStack held, int x, int y, int z, int face, EntityPlayer player, World world, PlaceType pass, int depth )
|
||||
{
|
||||
if( depth > 3 )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
ForgeDirection side = ForgeDirection.getOrientation( face );
|
||||
|
||||
if( held != null && Platform.isWrench( player, held, x, y, z ) && player.isSneaking() )
|
||||
{
|
||||
if( !Platform.hasPermissions( new DimensionalCoord( world, x, y, z ), player ) )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
Block block = world.getBlock( x, y, z );
|
||||
TileEntity tile = world.getTileEntity( x, y, z );
|
||||
IPartHost host = null;
|
||||
|
||||
if( tile instanceof IPartHost )
|
||||
{
|
||||
host = (IPartHost) tile;
|
||||
}
|
||||
|
||||
if( host != null )
|
||||
{
|
||||
@@ -118,7 +124,9 @@ public class PartPlacement
|
||||
}
|
||||
|
||||
if( host.isEmpty() )
|
||||
{
|
||||
host.cleanup();
|
||||
}
|
||||
|
||||
if( !is.isEmpty() )
|
||||
{
|
||||
@@ -141,7 +149,9 @@ public class PartPlacement
|
||||
IPartHost host = null;
|
||||
|
||||
if( tile instanceof IPartHost )
|
||||
{
|
||||
host = (IPartHost) tile;
|
||||
}
|
||||
|
||||
if( held != null )
|
||||
{
|
||||
@@ -153,7 +163,9 @@ public class PartPlacement
|
||||
if( !world.isRemote )
|
||||
{
|
||||
if( host.getPart( ForgeDirection.UNKNOWN ) == null )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if( host.canAddPart( held, side ) )
|
||||
{
|
||||
@@ -185,10 +197,14 @@ public class PartPlacement
|
||||
}
|
||||
|
||||
if( host == null && tile != null && AppEng.instance.isIntegrationEnabled( IntegrationType.FMP ) )
|
||||
{
|
||||
host = ( (IFMP) AppEng.instance.getIntegration( IntegrationType.FMP ) ).getOrCreateHost( tile );
|
||||
}
|
||||
|
||||
if( host == null && tile != null && AppEng.instance.isIntegrationEnabled( IntegrationType.ImmibisMicroblocks ) )
|
||||
{
|
||||
host = ( (IImmibisMicroblocks) AppEng.instance.getIntegration( IntegrationType.ImmibisMicroblocks ) ).getOrCreateHost( player, face, tile );
|
||||
}
|
||||
|
||||
// if ( held == null )
|
||||
{
|
||||
@@ -202,6 +218,7 @@ public class PartPlacement
|
||||
mop.hitVec = mop.hitVec.addVector( -mop.blockX, -mop.blockY, -mop.blockZ );
|
||||
SelectedPart sPart = selectPart( player, host, mop.hitVec );
|
||||
if( sPart != null && sPart.part != null )
|
||||
{
|
||||
if( sPart.part.onShiftActivate( player, mop.hitVec ) )
|
||||
{
|
||||
if( world.isRemote )
|
||||
@@ -210,12 +227,15 @@ public class PartPlacement
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if( held == null || !( held.getItem() instanceof IPartItem ) )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
int te_x = x;
|
||||
int te_y = y;
|
||||
@@ -231,7 +251,9 @@ public class PartPlacement
|
||||
{
|
||||
offset = side;
|
||||
if( Platform.isServer() )
|
||||
{
|
||||
side = side.getOpposite();
|
||||
}
|
||||
}
|
||||
|
||||
te_x = x + offset.offsetX;
|
||||
@@ -240,13 +262,19 @@ public class PartPlacement
|
||||
|
||||
tile = world.getTileEntity( te_x, te_y, te_z );
|
||||
if( tile instanceof IPartHost )
|
||||
{
|
||||
host = (IPartHost) tile;
|
||||
}
|
||||
|
||||
if( host == null && tile != null && AppEng.instance.isIntegrationEnabled( IntegrationType.FMP ) )
|
||||
{
|
||||
host = ( (IFMP) AppEng.instance.getIntegration( IntegrationType.FMP ) ).getOrCreateHost( tile );
|
||||
}
|
||||
|
||||
if( host == null && tile != null && AppEng.instance.isIntegrationEnabled( IntegrationType.ImmibisMicroblocks ) )
|
||||
{
|
||||
host = ( (IImmibisMicroblocks) AppEng.instance.getIntegration( IntegrationType.ImmibisMicroblocks ) ).getOrCreateHost( player, face, tile );
|
||||
}
|
||||
|
||||
final Optional<ItemStack> maybeMultiPartStack = multiPart.maybeStack( 1 );
|
||||
final Optional<Block> maybeMultiPartBlock = multiPart.maybeBlock();
|
||||
@@ -263,7 +291,9 @@ public class PartPlacement
|
||||
tile = world.getTileEntity( te_x, te_y, te_z );
|
||||
|
||||
if( tile instanceof IPartHost )
|
||||
{
|
||||
host = (IPartHost) tile;
|
||||
}
|
||||
|
||||
pass = PlaceType.INTERACT_SECOND_PASS;
|
||||
}
|
||||
@@ -281,7 +311,9 @@ public class PartPlacement
|
||||
}
|
||||
|
||||
if( host == null )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if( !host.canAddPart( held, side ) )
|
||||
{
|
||||
@@ -295,10 +327,14 @@ public class PartPlacement
|
||||
tile = world.getTileEntity( te_x, te_y, te_z );
|
||||
|
||||
if( tile != null && AppEng.instance.isIntegrationEnabled( IntegrationType.FMP ) )
|
||||
{
|
||||
host = ( (IFMP) AppEng.instance.getIntegration( IntegrationType.FMP ) ).getOrCreateHost( tile );
|
||||
}
|
||||
|
||||
if( ( blkID == null || blkID.isReplaceable( world, te_x, te_y, te_z ) || host != null ) && side != ForgeDirection.UNKNOWN )
|
||||
{
|
||||
return place( held, te_x, te_y, te_z, side.getOpposite().ordinal(), player, world, pass == PlaceType.INTERACT_FIRST_PASS ? PlaceType.INTERACT_SECOND_PASS : PlaceType.PLACE_ITEM, depth + 1 );
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@@ -315,13 +351,17 @@ public class PartPlacement
|
||||
if( sp.part != null )
|
||||
{
|
||||
if( !player.isSneaking() && sp.part.onActivate( player, mop.hitVec ) )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
DimensionalCoord dc = host.getLocation();
|
||||
if( !Platform.hasPermissions( dc, player ) )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
ForgeDirection mySide = host.addPart( held, side, player );
|
||||
if( mySide != null )
|
||||
@@ -355,7 +395,9 @@ public class PartPlacement
|
||||
private static float getEyeOffset( EntityPlayer p )
|
||||
{
|
||||
if( p.worldObj.isRemote )
|
||||
{
|
||||
return Platform.getEyeOffset( p );
|
||||
}
|
||||
|
||||
return eyeHeight;
|
||||
}
|
||||
@@ -372,13 +414,17 @@ public class PartPlacement
|
||||
public static IFacadePart isFacade( ItemStack held, ForgeDirection side )
|
||||
{
|
||||
if( held.getItem() instanceof IFacadeItem )
|
||||
{
|
||||
return ( (IFacadeItem) held.getItem() ).createPartFromItemStack( held, side );
|
||||
}
|
||||
|
||||
if( AppEng.instance.isIntegrationEnabled( IntegrationType.BC ) )
|
||||
{
|
||||
IBC bc = (IBC) AppEng.instance.getIntegration( IntegrationType.BC );
|
||||
if( bc.isFacade( held ) )
|
||||
{
|
||||
return bc.createFacadePart( held, side );
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
@@ -408,7 +454,9 @@ public class PartPlacement
|
||||
World w = event.entity.worldObj;
|
||||
TileEntity te = w.getTileEntity( mop.blockX, mop.blockY, mop.blockZ );
|
||||
if( te instanceof IPartHost && this.wasCanceled )
|
||||
{
|
||||
event.setCanceled( true );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -427,7 +475,9 @@ public class PartPlacement
|
||||
else if( event.action == Action.RIGHT_CLICK_BLOCK && event.entityPlayer.worldObj.isRemote )
|
||||
{
|
||||
if( this.placing.get() != null )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
this.placing.set( event );
|
||||
|
||||
|
||||
@@ -39,7 +39,9 @@ public class NonNullArrayIterator<E> implements Iterator<E>
|
||||
public boolean hasNext()
|
||||
{
|
||||
while( this.offset < this.g.length && this.g[this.offset] == null )
|
||||
{
|
||||
this.offset++;
|
||||
}
|
||||
|
||||
return this.offset != this.g.length;
|
||||
}
|
||||
|
||||
@@ -100,7 +100,9 @@ public class PartExportBus extends PartSharedItemBus implements ICraftingRequest
|
||||
TickRateModulation doBusWork()
|
||||
{
|
||||
if( !this.proxy.isActive() )
|
||||
{
|
||||
return TickRateModulation.IDLE;
|
||||
}
|
||||
|
||||
this.itemToSend = 1;
|
||||
this.didSomething = false;
|
||||
@@ -141,7 +143,9 @@ public class PartExportBus extends PartSharedItemBus implements ICraftingRequest
|
||||
if( ais == null || this.itemToSend <= 0 || this.craftOnly() )
|
||||
{
|
||||
if( this.isCraftingEnabled() )
|
||||
{
|
||||
this.didSomething = this.cratingTracker.handleCrafting( x, this.itemToSend, ais, d, this.getTile().getWorldObj(), this.proxy.getGrid(), cg, this.mySrc ) || this.didSomething;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -153,14 +157,20 @@ public class PartExportBus extends PartSharedItemBus implements ICraftingRequest
|
||||
{
|
||||
this.pushItemIntoTarget( d, energy, inv, o );
|
||||
if( this.itemToSend <= 0 )
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
this.pushItemIntoTarget( d, energy, inv, ais );
|
||||
}
|
||||
|
||||
if( this.itemToSend == before && this.isCraftingEnabled() )
|
||||
{
|
||||
this.didSomething = this.cratingTracker.handleCrafting( x, this.itemToSend, ais, d, this.getTile().getWorldObj(), this.proxy.getGrid(), cg, this.mySrc ) || this.didSomething;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -234,7 +244,9 @@ public class PartExportBus extends PartSharedItemBus implements ICraftingRequest
|
||||
if( !player.isSneaking() )
|
||||
{
|
||||
if( Platform.isClient() )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
Platform.openGUI( player, this.getHost().getTile(), this.side, GuiBridge.GUI_BUS );
|
||||
return true;
|
||||
@@ -302,7 +314,9 @@ public class PartExportBus extends PartSharedItemBus implements ICraftingRequest
|
||||
inv.injectItems( ais, Actionable.MODULATE, this.mySrc );
|
||||
}
|
||||
else
|
||||
{
|
||||
this.didSomething = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -328,7 +342,9 @@ public class PartExportBus extends PartSharedItemBus implements ICraftingRequest
|
||||
if( energy.extractAEPower( power, mode, PowerMultiplier.CONFIG ) > power - 0.01 )
|
||||
{
|
||||
if( mode == Actionable.MODULATE )
|
||||
{
|
||||
return AEItemStack.create( d.addItems( items.getItemStack() ) );
|
||||
}
|
||||
return AEItemStack.create( d.simulateAdd( items.getItemStack() ) );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -113,13 +113,19 @@ public class PartFormationPlane extends PartUpgradeable implements ICellContaine
|
||||
{
|
||||
IAEItemStack is = this.Config.getAEStackInSlot( x );
|
||||
if( is != null )
|
||||
{
|
||||
priorityList.add( is );
|
||||
}
|
||||
}
|
||||
|
||||
if( this.getInstalledUpgrades( Upgrades.FUZZY ) > 0 )
|
||||
{
|
||||
this.myHandler.setPartitionList( new FuzzyPriorityList( priorityList, (FuzzyMode) this.getConfigManager().getSetting( Settings.FUZZY_MODE ) ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
this.myHandler.setPartitionList( new PrecisePriorityList( priorityList ) );
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
@@ -150,7 +156,9 @@ public class PartFormationPlane extends PartUpgradeable implements ICellContaine
|
||||
super.onChangeInventory( inv, slot, mc, removedStack, newStack );
|
||||
|
||||
if( inv == this.Config )
|
||||
{
|
||||
this.updateHandler();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -180,7 +188,9 @@ public class PartFormationPlane extends PartUpgradeable implements ICellContaine
|
||||
public IInventory getInventoryByName( String name )
|
||||
{
|
||||
if( name.equals( "config" ) )
|
||||
{
|
||||
return this.Config;
|
||||
}
|
||||
|
||||
return super.getInventoryByName( name );
|
||||
}
|
||||
@@ -231,16 +241,24 @@ public class PartFormationPlane extends PartUpgradeable implements ICellContaine
|
||||
ForgeDirection u = bch.getWorldY();
|
||||
|
||||
if( this.isTransitionPlane( te.getWorldObj().getTileEntity( x - e.offsetX, y - e.offsetY, z - e.offsetZ ), this.side ) )
|
||||
{
|
||||
minX = 0;
|
||||
}
|
||||
|
||||
if( this.isTransitionPlane( te.getWorldObj().getTileEntity( x + e.offsetX, y + e.offsetY, z + e.offsetZ ), this.side ) )
|
||||
{
|
||||
maxX = 16;
|
||||
}
|
||||
|
||||
if( this.isTransitionPlane( te.getWorldObj().getTileEntity( x - u.offsetX, y - u.offsetY, z - u.offsetZ ), this.side ) )
|
||||
{
|
||||
minY = 0;
|
||||
}
|
||||
|
||||
if( this.isTransitionPlane( te.getWorldObj().getTileEntity( x + u.offsetX, y + u.offsetY, z + u.offsetZ ), this.side ) )
|
||||
{
|
||||
maxY = 16;
|
||||
}
|
||||
}
|
||||
|
||||
bch.addBox( 5, 5, 14, 11, 11, 15 );
|
||||
@@ -275,16 +293,24 @@ public class PartFormationPlane extends PartUpgradeable implements ICellContaine
|
||||
TileEntity te = this.getHost().getTile();
|
||||
|
||||
if( this.isTransitionPlane( te.getWorldObj().getTileEntity( x - e.offsetX, y - e.offsetY, z - e.offsetZ ), this.side ) )
|
||||
{
|
||||
minX = 0;
|
||||
}
|
||||
|
||||
if( this.isTransitionPlane( te.getWorldObj().getTileEntity( x + e.offsetX, y + e.offsetY, z + e.offsetZ ), this.side ) )
|
||||
{
|
||||
maxX = 16;
|
||||
}
|
||||
|
||||
if( this.isTransitionPlane( te.getWorldObj().getTileEntity( x - u.offsetX, y - u.offsetY, z - u.offsetZ ), this.side ) )
|
||||
{
|
||||
minY = 0;
|
||||
}
|
||||
|
||||
if( this.isTransitionPlane( te.getWorldObj().getTileEntity( x + u.offsetX, y + u.offsetY, z + u.offsetZ ), this.side ) )
|
||||
{
|
||||
maxY = 16;
|
||||
}
|
||||
|
||||
boolean isActive = ( this.clientFlags & ( this.POWERED_FLAG | this.CHANNEL_FLAG ) ) == ( this.POWERED_FLAG | this.CHANNEL_FLAG );
|
||||
|
||||
@@ -328,7 +354,9 @@ public class PartFormationPlane extends PartUpgradeable implements ICellContaine
|
||||
if( !player.isSneaking() )
|
||||
{
|
||||
if( Platform.isClient() )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
Platform.openGUI( player, this.getHost().getTile(), this.side, GuiBridge.GUI_FORMATION_PLANE );
|
||||
return true;
|
||||
@@ -383,7 +411,9 @@ public class PartFormationPlane extends PartUpgradeable implements ICellContaine
|
||||
public IAEItemStack injectItems( IAEItemStack input, Actionable type, BaseActionSource src )
|
||||
{
|
||||
if( this.blocked || input == null || input.getStackSize() <= 0 )
|
||||
{
|
||||
return input;
|
||||
}
|
||||
|
||||
YesNo placeBlock = (YesNo) this.getConfigManager().getSetting( Settings.PLACE_BLOCK );
|
||||
|
||||
@@ -413,9 +443,13 @@ public class PartFormationPlane extends PartUpgradeable implements ICellContaine
|
||||
Chunk c = w.getChunkFromBlockCoords( x, z );
|
||||
int sum = 0;
|
||||
for( List Z : c.entityLists )
|
||||
{
|
||||
sum += Z.size();
|
||||
}
|
||||
if( sum > 32 )
|
||||
{
|
||||
return input;
|
||||
}
|
||||
}
|
||||
maxStorage = is.stackSize;
|
||||
worked = true;
|
||||
@@ -426,16 +460,24 @@ public class PartFormationPlane extends PartUpgradeable implements ICellContaine
|
||||
boolean Worked = false;
|
||||
|
||||
if( side.offsetX == 0 && side.offsetZ == 0 )
|
||||
{
|
||||
Worked = i.onItemUse( is, player, w, x + side.offsetX, y + side.offsetY, z + side.offsetZ, side.getOpposite().ordinal(), side.offsetX, side.offsetY, side.offsetZ );
|
||||
}
|
||||
|
||||
if( !Worked && side.offsetX == 0 && side.offsetZ == 0 )
|
||||
{
|
||||
Worked = i.onItemUse( is, player, w, x - side.offsetX, y - side.offsetY, z - side.offsetZ, side.ordinal(), side.offsetX, side.offsetY, side.offsetZ );
|
||||
}
|
||||
|
||||
if( !Worked && side.offsetY == 0 )
|
||||
{
|
||||
Worked = i.onItemUse( is, player, w, x, y - 1, z, ForgeDirection.UP.ordinal(), side.offsetX, side.offsetY, side.offsetZ );
|
||||
}
|
||||
|
||||
if( !Worked )
|
||||
{
|
||||
i.onItemUse( is, player, w, x, y, z, side.getOpposite().ordinal(), side.offsetX, side.offsetY, side.offsetZ );
|
||||
}
|
||||
|
||||
maxStorage -= is.stackSize;
|
||||
}
|
||||
@@ -446,7 +488,9 @@ public class PartFormationPlane extends PartUpgradeable implements ICellContaine
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
maxStorage = 1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -454,7 +498,9 @@ public class PartFormationPlane extends PartUpgradeable implements ICellContaine
|
||||
Chunk c = w.getChunkFromBlockCoords( x, z );
|
||||
int sum = 0;
|
||||
for( List Z : c.entityLists )
|
||||
{
|
||||
sum += Z.size();
|
||||
}
|
||||
|
||||
if( sum < AEConfig.instance.formationPlaneEntityLimit )
|
||||
{
|
||||
@@ -478,9 +524,13 @@ public class PartFormationPlane extends PartUpgradeable implements ICellContaine
|
||||
{
|
||||
result = is.getItem().createEntity( w, ei, is );
|
||||
if( result != null )
|
||||
{
|
||||
ei.setDead();
|
||||
}
|
||||
else
|
||||
{
|
||||
result = ei;
|
||||
}
|
||||
}
|
||||
|
||||
if( !w.spawnEntityInWorld( result ) )
|
||||
@@ -491,7 +541,9 @@ public class PartFormationPlane extends PartUpgradeable implements ICellContaine
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
worked = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -502,7 +554,9 @@ public class PartFormationPlane extends PartUpgradeable implements ICellContaine
|
||||
IAEItemStack out = input.copy();
|
||||
out.decStackSize( maxStorage );
|
||||
if( out.getStackSize() == 0 )
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
|
||||
@@ -78,11 +78,15 @@ public class PartImportBus extends PartSharedItemBus implements IInventoryDestin
|
||||
public boolean canInsert( ItemStack stack )
|
||||
{
|
||||
if( stack == null || stack.getItem() == null )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
IAEItemStack out = this.destination.injectItems( this.lastItemChecked = AEApi.instance().storage().createItemStack( stack ), Actionable.SIMULATE, this.source );
|
||||
if( out == null )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return out.getStackSize() != stack.stackSize;
|
||||
}
|
||||
|
||||
@@ -145,7 +149,9 @@ public class PartImportBus extends PartSharedItemBus implements IInventoryDestin
|
||||
if( !player.isSneaking() )
|
||||
{
|
||||
if( Platform.isClient() )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
Platform.openGUI( player, this.getHost().getTile(), this.side, GuiBridge.GUI_BUS );
|
||||
return true;
|
||||
@@ -170,7 +176,9 @@ public class PartImportBus extends PartSharedItemBus implements IInventoryDestin
|
||||
TickRateModulation doBusWork()
|
||||
{
|
||||
if( !this.proxy.isActive() )
|
||||
{
|
||||
return TickRateModulation.IDLE;
|
||||
}
|
||||
|
||||
this.worked = false;
|
||||
|
||||
@@ -215,7 +223,9 @@ public class PartImportBus extends PartSharedItemBus implements IInventoryDestin
|
||||
while( this.itemToSend > 0 )
|
||||
{
|
||||
if( this.importStuff( myAdaptor, ais, inv, energy, fzMode ) )
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -225,7 +235,9 @@ public class PartImportBus extends PartSharedItemBus implements IInventoryDestin
|
||||
while( this.itemToSend > 0 )
|
||||
{
|
||||
if( this.importStuff( myAdaptor, null, inv, energy, fzMode ) )
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -235,7 +247,9 @@ public class PartImportBus extends PartSharedItemBus implements IInventoryDestin
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return TickRateModulation.SLEEP;
|
||||
}
|
||||
|
||||
return this.worked ? TickRateModulation.FASTER : TickRateModulation.SLOWER;
|
||||
}
|
||||
@@ -245,13 +259,19 @@ public class PartImportBus extends PartSharedItemBus implements IInventoryDestin
|
||||
int toSend = this.itemToSend;
|
||||
|
||||
if( toSend > 64 )
|
||||
{
|
||||
toSend = 64;
|
||||
}
|
||||
|
||||
ItemStack newItems;
|
||||
if( this.getInstalledUpgrades( Upgrades.FUZZY ) > 0 )
|
||||
{
|
||||
newItems = myAdaptor.removeSimilarItems( toSend, whatToImport == null ? null : whatToImport.getItemStack(), fzMode, this.configDestination( inv ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
newItems = myAdaptor.removeItems( toSend, whatToImport == null ? null : whatToImport.getItemStack(), this.configDestination( inv ) );
|
||||
}
|
||||
|
||||
if( newItems != null )
|
||||
{
|
||||
@@ -259,9 +279,13 @@ public class PartImportBus extends PartSharedItemBus implements IInventoryDestin
|
||||
this.itemToSend -= newItems.stackSize;
|
||||
|
||||
if( this.lastItemChecked == null || !this.lastItemChecked.isSameType( newItems ) )
|
||||
{
|
||||
this.lastItemChecked = AEApi.instance().storage().createItemStack( newItems );
|
||||
}
|
||||
else
|
||||
{
|
||||
this.lastItemChecked.setStackSize( newItems.stackSize );
|
||||
}
|
||||
|
||||
IAEItemStack failed = Platform.poweredInsert( energy, this.destination, this.lastItemChecked, this.source );
|
||||
// destination.injectItems( lastItemChecked, Actionable.MODULATE );
|
||||
@@ -271,10 +295,14 @@ public class PartImportBus extends PartSharedItemBus implements IInventoryDestin
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.worked = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -120,9 +120,13 @@ public class PartLevelEmitter extends PartUpgradeable implements IEnergyWatcherH
|
||||
{
|
||||
this.reportingValue = v;
|
||||
if( this.getConfigManager().getSetting( Settings.LEVEL_TYPE ) == LevelType.ENERGY_LEVEL )
|
||||
{
|
||||
this.configureWatchers();
|
||||
}
|
||||
else
|
||||
{
|
||||
this.updateState();
|
||||
}
|
||||
}
|
||||
|
||||
@MENetworkEventSubscribe
|
||||
@@ -211,13 +215,19 @@ public class PartLevelEmitter extends PartUpgradeable implements IEnergyWatcherH
|
||||
IAEItemStack myStack = this.config.getAEStackInSlot( 0 );
|
||||
|
||||
if( this.myWatcher != null )
|
||||
{
|
||||
this.myWatcher.clear();
|
||||
}
|
||||
|
||||
if( this.myEnergyWatcher != null )
|
||||
{
|
||||
this.myEnergyWatcher.clear();
|
||||
}
|
||||
|
||||
if( this.myCraftingWatcher != null )
|
||||
{
|
||||
this.myCraftingWatcher.clear();
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
@@ -231,7 +241,9 @@ public class PartLevelEmitter extends PartUpgradeable implements IEnergyWatcherH
|
||||
if( this.getInstalledUpgrades( Upgrades.CRAFTING ) > 0 )
|
||||
{
|
||||
if( this.myCraftingWatcher != null && myStack != null )
|
||||
{
|
||||
this.myCraftingWatcher.add( myStack );
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
@@ -239,7 +251,9 @@ public class PartLevelEmitter extends PartUpgradeable implements IEnergyWatcherH
|
||||
if( this.getConfigManager().getSetting( Settings.LEVEL_TYPE ) == LevelType.ENERGY_LEVEL )
|
||||
{
|
||||
if( this.myEnergyWatcher != null )
|
||||
{
|
||||
this.myEnergyWatcher.add( (double) this.reportingValue );
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
@@ -269,7 +283,9 @@ public class PartLevelEmitter extends PartUpgradeable implements IEnergyWatcherH
|
||||
this.proxy.getStorage().getItemInventory().removeListener( this );
|
||||
|
||||
if( this.myWatcher != null )
|
||||
{
|
||||
this.myWatcher.add( myStack );
|
||||
}
|
||||
}
|
||||
|
||||
this.updateReportingValue( this.proxy.getStorage().getItemInventory() );
|
||||
@@ -288,7 +304,9 @@ public class PartLevelEmitter extends PartUpgradeable implements IEnergyWatcherH
|
||||
{
|
||||
this.lastReportedValue = 0;
|
||||
for( IAEItemStack st : monitor.getStorageList() )
|
||||
{
|
||||
this.lastReportedValue += st.getStackSize();
|
||||
}
|
||||
}
|
||||
else if( this.getInstalledUpgrades( Upgrades.FUZZY ) > 0 )
|
||||
{
|
||||
@@ -296,15 +314,21 @@ public class PartLevelEmitter extends PartUpgradeable implements IEnergyWatcherH
|
||||
FuzzyMode fzMode = (FuzzyMode) this.getConfigManager().getSetting( Settings.FUZZY_MODE );
|
||||
Collection<IAEItemStack> fuzzyList = monitor.getStorageList().findFuzzy( myStack, fzMode );
|
||||
for( IAEItemStack st : fuzzyList )
|
||||
{
|
||||
this.lastReportedValue += st.getStackSize();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
IAEItemStack r = monitor.getStorageList().findPrecise( myStack );
|
||||
if( r == null )
|
||||
{
|
||||
this.lastReportedValue = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.lastReportedValue = r.getStackSize();
|
||||
}
|
||||
}
|
||||
|
||||
this.updateState();
|
||||
@@ -624,7 +648,9 @@ public class PartLevelEmitter extends PartUpgradeable implements IEnergyWatcherH
|
||||
if( !player.isSneaking() )
|
||||
{
|
||||
if( Platform.isClient() )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
Platform.openGUI( player, this.getHost().getTile(), this.side, GuiBridge.GUI_LEVEL_EMITTER );
|
||||
return true;
|
||||
@@ -643,7 +669,9 @@ public class PartLevelEmitter extends PartUpgradeable implements IEnergyWatcherH
|
||||
public void onChangeInventory( IInventory inv, int slot, InvOperation mc, ItemStack removedStack, ItemStack newStack )
|
||||
{
|
||||
if( inv == this.config )
|
||||
{
|
||||
this.configureWatchers();
|
||||
}
|
||||
|
||||
super.onChangeInventory( inv, slot, mc, removedStack, newStack );
|
||||
}
|
||||
@@ -684,7 +712,9 @@ public class PartLevelEmitter extends PartUpgradeable implements IEnergyWatcherH
|
||||
public IInventory getInventoryByName( String name )
|
||||
{
|
||||
if( name.equals( "config" ) )
|
||||
{
|
||||
return this.config;
|
||||
}
|
||||
|
||||
return super.getInventoryByName( name );
|
||||
}
|
||||
@@ -710,7 +740,9 @@ public class PartLevelEmitter extends PartUpgradeable implements IEnergyWatcherH
|
||||
{
|
||||
IAEItemStack what = this.config.getAEStackInSlot( 0 );
|
||||
if( what != null )
|
||||
{
|
||||
craftingTracker.setEmitable( what );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -76,7 +76,9 @@ public abstract class PartSharedItemBus extends PartUpgradeable implements IGrid
|
||||
public IInventory getInventoryByName( String name )
|
||||
{
|
||||
if( name.equals( "config" ) )
|
||||
{
|
||||
return this.config;
|
||||
}
|
||||
|
||||
return super.getInventoryByName( name );
|
||||
}
|
||||
@@ -86,9 +88,13 @@ public abstract class PartSharedItemBus extends PartUpgradeable implements IGrid
|
||||
try
|
||||
{
|
||||
if( !this.isSleeping() )
|
||||
{
|
||||
this.proxy.getTick().wakeDevice( this.proxy.getNode() );
|
||||
}
|
||||
else
|
||||
{
|
||||
this.proxy.getTick().sleepDevice( this.proxy.getNode() );
|
||||
}
|
||||
}
|
||||
catch( GridAccessException e )
|
||||
{
|
||||
@@ -104,7 +110,9 @@ public abstract class PartSharedItemBus extends PartUpgradeable implements IGrid
|
||||
int newAdaptorHash = Platform.generateTileHash( target );
|
||||
|
||||
if( this.adaptorHash == newAdaptorHash && newAdaptorHash != 0 )
|
||||
{
|
||||
return this.adaptor;
|
||||
}
|
||||
|
||||
this.adaptorHash = newAdaptorHash;
|
||||
this.adaptor = InventoryAdaptor.getAdaptor( target, this.side.getOpposite() );
|
||||
@@ -132,7 +140,9 @@ public abstract class PartSharedItemBus extends PartUpgradeable implements IGrid
|
||||
{
|
||||
this.lastRedstone = !this.lastRedstone;
|
||||
if( this.lastRedstone && this.getRSMode() == RedstoneMode.SIGNAL_PULSE )
|
||||
{
|
||||
this.doBusWork();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -83,13 +83,17 @@ public abstract class PartUpgradeable extends PartBasicState implements IAEAppEn
|
||||
|
||||
case HIGH_SIGNAL:
|
||||
if( this.host.hasRedstone( this.side ) )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case LOW_SIGNAL:
|
||||
if( !this.host.hasRedstone( this.side ) )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
@@ -136,8 +140,12 @@ public abstract class PartUpgradeable extends PartBasicState implements IAEAppEn
|
||||
public void getDrops( List<ItemStack> drops, boolean wrenched )
|
||||
{
|
||||
for( ItemStack is : this.upgrades )
|
||||
{
|
||||
if( is != null )
|
||||
{
|
||||
drops.add( is );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -150,7 +158,9 @@ public abstract class PartUpgradeable extends PartBasicState implements IAEAppEn
|
||||
public IInventory getInventoryByName( String name )
|
||||
{
|
||||
if( name.equals( "upgrades" ) )
|
||||
{
|
||||
return this.upgrades;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -67,7 +67,9 @@ public abstract class UpgradeInventory extends AppEngInternalInventory implement
|
||||
public boolean isItemValidForSlot( int i, ItemStack itemstack )
|
||||
{
|
||||
if( itemstack == null )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
Item it = itemstack.getItem();
|
||||
if( it instanceof IUpgradeModule )
|
||||
{
|
||||
@@ -83,7 +85,9 @@ public abstract class UpgradeInventory extends AppEngInternalInventory implement
|
||||
public int getInstalledUpgrades( Upgrades u )
|
||||
{
|
||||
if( !this.cached )
|
||||
{
|
||||
this.updateUpgradeInfo();
|
||||
}
|
||||
|
||||
switch( u )
|
||||
{
|
||||
@@ -114,7 +118,9 @@ public abstract class UpgradeInventory extends AppEngInternalInventory implement
|
||||
for( ItemStack is : this )
|
||||
{
|
||||
if( is == null || is.getItem() == null || !( is.getItem() instanceof IUpgradeModule ) )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
Upgrades myUpgrade = ( (IUpgradeModule) is.getItem() ).getType( is );
|
||||
switch( myUpgrade )
|
||||
@@ -168,6 +174,8 @@ public abstract class UpgradeInventory extends AppEngInternalInventory implement
|
||||
{
|
||||
this.cached = false;
|
||||
if( this.parent != null && Platform.isServer() )
|
||||
{
|
||||
this.parent.onChangeInventory( inv, slot, mc, removedStack, newStack );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -47,7 +47,9 @@ public class InvLayerData
|
||||
public ItemStack decreaseStackSize( int slot, int amount )
|
||||
{
|
||||
if( this.isSlotValid( slot ) )
|
||||
{
|
||||
return this.slots.get( slot ).decreaseStackSize( amount );
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
@@ -67,7 +69,9 @@ public class InvLayerData
|
||||
public int getSizeInventory()
|
||||
{
|
||||
if( this.slots == null )
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
return this.slots.size();
|
||||
}
|
||||
@@ -75,7 +79,9 @@ public class InvLayerData
|
||||
public ItemStack getStackInSlot( int slot )
|
||||
{
|
||||
if( this.isSlotValid( slot ) )
|
||||
{
|
||||
return this.slots.get( slot ).getStackInSlot();
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
@@ -83,7 +89,9 @@ public class InvLayerData
|
||||
public boolean isItemValidForSlot( int slot, ItemStack itemstack )
|
||||
{
|
||||
if( this.isSlotValid( slot ) )
|
||||
{
|
||||
return this.slots.get( slot ).isItemValidForSlot( itemstack );
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
@@ -91,13 +99,17 @@ public class InvLayerData
|
||||
public void setInventorySlotContents( int slot, ItemStack itemstack )
|
||||
{
|
||||
if( this.isSlotValid( slot ) )
|
||||
{
|
||||
this.slots.get( slot ).setInventorySlotContents( itemstack );
|
||||
}
|
||||
}
|
||||
|
||||
public boolean canExtractItem( int slot, ItemStack itemstack, int side )
|
||||
{
|
||||
if( this.isSlotValid( slot ) )
|
||||
{
|
||||
return this.slots.get( slot ).canExtractItem( itemstack, side );
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
@@ -105,7 +117,9 @@ public class InvLayerData
|
||||
public boolean canInsertItem( int slot, ItemStack itemstack, int side )
|
||||
{
|
||||
if( this.isSlotValid( slot ) )
|
||||
{
|
||||
return this.slots.get( slot ).canInsertItem( itemstack, side );
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
@@ -115,14 +129,18 @@ public class InvLayerData
|
||||
if( this.inventories != null )
|
||||
{
|
||||
for( IInventory inv : this.inventories )
|
||||
{
|
||||
inv.markDirty();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public int[] getAccessibleSlotsFromSide( int side )
|
||||
{
|
||||
if( this.sides == null || side < 0 || side > 5 )
|
||||
{
|
||||
return NULL_SIDES;
|
||||
}
|
||||
return this.sides[side];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -38,7 +38,9 @@ public class LayerIEnergyHandler extends LayerBase implements IEnergyHandler
|
||||
{
|
||||
IPart part = this.getPart( from );
|
||||
if( part instanceof IEnergyReceiver )
|
||||
{
|
||||
return ( (IEnergyReceiver) part ).receiveEnergy( from, maxReceive, simulate );
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -48,7 +50,9 @@ public class LayerIEnergyHandler extends LayerBase implements IEnergyHandler
|
||||
{
|
||||
IPart part = this.getPart( from );
|
||||
if( part instanceof IEnergyProvider )
|
||||
{
|
||||
return ( (IEnergyProvider) part ).extractEnergy( from, maxExtract, simulate );
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -58,7 +62,9 @@ public class LayerIEnergyHandler extends LayerBase implements IEnergyHandler
|
||||
{
|
||||
IPart part = this.getPart( from );
|
||||
if( part instanceof IEnergyProvider )
|
||||
{
|
||||
return ( (IEnergyProvider) part ).getEnergyStored( from );
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -68,7 +74,9 @@ public class LayerIEnergyHandler extends LayerBase implements IEnergyHandler
|
||||
{
|
||||
IPart part = this.getPart( from );
|
||||
if( part instanceof IEnergyProvider )
|
||||
{
|
||||
return ( (IEnergyProvider) part ).getMaxEnergyStored( from );
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -78,7 +86,9 @@ public class LayerIEnergyHandler extends LayerBase implements IEnergyHandler
|
||||
{
|
||||
IPart part = this.getPart( from );
|
||||
if( part instanceof IEnergyConnection )
|
||||
{
|
||||
return ( (IEnergyConnection) part ).canConnectEnergy( from );
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -46,7 +46,9 @@ public class LayerIEnergySink extends LayerBase implements IEnergySink
|
||||
private World getEnergySinkWorld()
|
||||
{
|
||||
if( this.getEnergySinkTile() == null )
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return this.getEnergySinkTile().getWorldObj();
|
||||
}
|
||||
@@ -56,7 +58,9 @@ public class LayerIEnergySink extends LayerBase implements IEnergySink
|
||||
TileEntity te = this.getEnergySinkTile();
|
||||
|
||||
if( te == null )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return !te.isInvalid() && te.getWorldObj().blockExists( te.xCoord, te.yCoord, te.zCoord );
|
||||
}
|
||||
@@ -64,7 +68,9 @@ public class LayerIEnergySink extends LayerBase implements IEnergySink
|
||||
private void addToENet()
|
||||
{
|
||||
if( this.getEnergySinkWorld() == null )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// re-add
|
||||
this.removeFromENet();
|
||||
@@ -79,7 +85,9 @@ public class LayerIEnergySink extends LayerBase implements IEnergySink
|
||||
private void removeFromENet()
|
||||
{
|
||||
if( this.getEnergySinkWorld() == null )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if( this.isInIC2() && Platform.isServer() )
|
||||
{
|
||||
@@ -91,7 +99,9 @@ public class LayerIEnergySink extends LayerBase implements IEnergySink
|
||||
private boolean interestedInIC2()
|
||||
{
|
||||
if( !( (IPartHost) this ).isInWorld() )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
int interested = 0;
|
||||
for( ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS )
|
||||
@@ -111,20 +121,28 @@ public class LayerIEnergySink extends LayerBase implements IEnergySink
|
||||
super.partChanged();
|
||||
|
||||
if( this.interestedInIC2() )
|
||||
{
|
||||
this.addToENet();
|
||||
}
|
||||
else
|
||||
{
|
||||
this.removeFromENet();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean acceptsEnergyFrom( TileEntity emitter, ForgeDirection direction )
|
||||
{
|
||||
if( !this.isInIC2() )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
IPart part = this.getPart( direction );
|
||||
if( part instanceof IEnergySink )
|
||||
{
|
||||
return ( (IEnergySink) part ).acceptsEnergyFrom( emitter, direction );
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -137,7 +155,9 @@ public class LayerIEnergySink extends LayerBase implements IEnergySink
|
||||
public double getDemandedEnergy()
|
||||
{
|
||||
if( !this.isInIC2() )
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
// this is a flawed implementation, that requires a change to the IC2 API.
|
||||
|
||||
@@ -164,7 +184,9 @@ public class LayerIEnergySink extends LayerBase implements IEnergySink
|
||||
public double injectEnergy( ForgeDirection directionFrom, double amount, double voltage )
|
||||
{
|
||||
if( !this.isInIC2() )
|
||||
{
|
||||
return amount;
|
||||
}
|
||||
|
||||
for( ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS )
|
||||
{
|
||||
|
||||
@@ -48,7 +48,9 @@ public class LayerIEnergySource extends LayerBase implements IEnergySource
|
||||
private World getEnergySourceWorld()
|
||||
{
|
||||
if( this.getEnergySourceTile() == null )
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return this.getEnergySourceTile().getWorldObj();
|
||||
}
|
||||
|
||||
@@ -56,14 +58,18 @@ public class LayerIEnergySource extends LayerBase implements IEnergySource
|
||||
{
|
||||
TileEntity te = this.getEnergySourceTile();
|
||||
if( te == null )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return !te.isInvalid();
|
||||
}
|
||||
|
||||
private void addToENet()
|
||||
{
|
||||
if( this.getEnergySourceWorld() == null )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// re-add
|
||||
this.removeFromENet();
|
||||
@@ -78,7 +84,9 @@ public class LayerIEnergySource extends LayerBase implements IEnergySource
|
||||
private void removeFromENet()
|
||||
{
|
||||
if( this.getEnergySourceWorld() == null )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if( this.isInIC2() && Platform.isServer() )
|
||||
{
|
||||
@@ -90,7 +98,9 @@ public class LayerIEnergySource extends LayerBase implements IEnergySource
|
||||
private boolean interestedInIC2()
|
||||
{
|
||||
if( !( (IPartHost) this ).isInWorld() )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
int interested = 0;
|
||||
for( ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS )
|
||||
@@ -110,20 +120,28 @@ public class LayerIEnergySource extends LayerBase implements IEnergySource
|
||||
super.partChanged();
|
||||
|
||||
if( this.interestedInIC2() )
|
||||
{
|
||||
this.addToENet();
|
||||
}
|
||||
else
|
||||
{
|
||||
this.removeFromENet();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean emitsEnergyTo( TileEntity receiver, ForgeDirection direction )
|
||||
{
|
||||
if( !this.isInIC2() )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
IPart part = this.getPart( direction );
|
||||
if( part instanceof IEnergySink )
|
||||
{
|
||||
return ( (IEnergyEmitter) part ).emitsEnergyTo( receiver, direction );
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -136,7 +154,9 @@ public class LayerIEnergySource extends LayerBase implements IEnergySource
|
||||
public double getOfferedEnergy()
|
||||
{
|
||||
if( !this.isInIC2() )
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
// this is a flawed implementation, that requires a change to the IC2 API.
|
||||
|
||||
|
||||
@@ -38,7 +38,9 @@ public class LayerIFluidHandler extends LayerBase implements IFluidHandler
|
||||
{
|
||||
IPart part = this.getPart( from );
|
||||
if( part instanceof IFluidHandler )
|
||||
{
|
||||
return ( (IFluidHandler) part ).fill( from, resource, doFill );
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -47,7 +49,9 @@ public class LayerIFluidHandler extends LayerBase implements IFluidHandler
|
||||
{
|
||||
IPart part = this.getPart( from );
|
||||
if( part instanceof IFluidHandler )
|
||||
{
|
||||
return ( (IFluidHandler) part ).drain( from, resource, doDrain );
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -56,7 +60,9 @@ public class LayerIFluidHandler extends LayerBase implements IFluidHandler
|
||||
{
|
||||
IPart part = this.getPart( from );
|
||||
if( part instanceof IFluidHandler )
|
||||
{
|
||||
return ( (IFluidHandler) part ).drain( from, maxDrain, doDrain );
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -65,7 +71,9 @@ public class LayerIFluidHandler extends LayerBase implements IFluidHandler
|
||||
{
|
||||
IPart part = this.getPart( from );
|
||||
if( part instanceof IFluidHandler )
|
||||
{
|
||||
return ( (IFluidHandler) part ).canFill( from, fluid );
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -74,7 +82,9 @@ public class LayerIFluidHandler extends LayerBase implements IFluidHandler
|
||||
{
|
||||
IPart part = this.getPart( from );
|
||||
if( part instanceof IFluidHandler )
|
||||
{
|
||||
return ( (IFluidHandler) part ).canDrain( from, fluid );
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -83,7 +93,9 @@ public class LayerIFluidHandler extends LayerBase implements IFluidHandler
|
||||
{
|
||||
IPart part = this.getPart( from );
|
||||
if( part instanceof IFluidHandler )
|
||||
{
|
||||
return ( (IFluidHandler) part ).getTankInfo( from );
|
||||
}
|
||||
return EMPTY_LIST;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,7 +36,9 @@ public class LayerIPipeConnection extends LayerBase implements IPipeConnection
|
||||
{
|
||||
IPart part = this.getPart( with );
|
||||
if( part instanceof IPipeConnection )
|
||||
{
|
||||
return ( (IPipeConnection) part ).overridePipeConnection( type, with );
|
||||
}
|
||||
return ConnectOverride.DEFAULT;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -95,11 +95,13 @@ public class LayerISidedInventory extends LayerBase implements ISidedInventory
|
||||
|
||||
ForgeDirection currentSide = ForgeDirection.UNKNOWN;
|
||||
for( ForgeDirection side : ForgeDirection.VALID_DIRECTIONS )
|
||||
{
|
||||
if( this.getPart( side ) == sides )
|
||||
{
|
||||
currentSide = side;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
int[] cSidesList = sideData[currentSide.ordinal()] = new int[slotCount];
|
||||
for( int cSlot = 0; cSlot < slotCount; cSlot++ )
|
||||
@@ -113,9 +115,13 @@ public class LayerISidedInventory extends LayerBase implements ISidedInventory
|
||||
}
|
||||
|
||||
if( sideData == null || slots == null )
|
||||
{
|
||||
this.invLayer = null;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.invLayer = new InvLayerData( sideData, inventories, slots );
|
||||
}
|
||||
|
||||
// make sure inventory is updated before we call FMP.
|
||||
super.notifyNeighbors();
|
||||
@@ -125,7 +131,9 @@ public class LayerISidedInventory extends LayerBase implements ISidedInventory
|
||||
public int getSizeInventory()
|
||||
{
|
||||
if( this.invLayer == null )
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
return this.invLayer.getSizeInventory();
|
||||
}
|
||||
@@ -134,7 +142,9 @@ public class LayerISidedInventory extends LayerBase implements ISidedInventory
|
||||
public ItemStack getStackInSlot( int slot )
|
||||
{
|
||||
if( this.invLayer == null )
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return this.invLayer.getStackInSlot( slot );
|
||||
}
|
||||
@@ -143,7 +153,9 @@ public class LayerISidedInventory extends LayerBase implements ISidedInventory
|
||||
public ItemStack decrStackSize( int slot, int amount )
|
||||
{
|
||||
if( this.invLayer == null )
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return this.invLayer.decreaseStackSize( slot, amount );
|
||||
}
|
||||
@@ -158,7 +170,9 @@ public class LayerISidedInventory extends LayerBase implements ISidedInventory
|
||||
public void setInventorySlotContents( int slot, ItemStack itemstack )
|
||||
{
|
||||
if( this.invLayer == null )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
this.invLayer.setInventorySlotContents( slot, itemstack );
|
||||
}
|
||||
@@ -201,7 +215,9 @@ public class LayerISidedInventory extends LayerBase implements ISidedInventory
|
||||
public boolean isItemValidForSlot( int slot, ItemStack itemstack )
|
||||
{
|
||||
if( this.invLayer == null )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return this.invLayer.isItemValidForSlot( slot, itemstack );
|
||||
}
|
||||
@@ -210,7 +226,9 @@ public class LayerISidedInventory extends LayerBase implements ISidedInventory
|
||||
public void markDirty()
|
||||
{
|
||||
if( this.invLayer != null )
|
||||
{
|
||||
this.invLayer.markDirty();
|
||||
}
|
||||
|
||||
super.markForSave();
|
||||
}
|
||||
@@ -219,7 +237,9 @@ public class LayerISidedInventory extends LayerBase implements ISidedInventory
|
||||
public int[] getAccessibleSlotsFromSide( int side )
|
||||
{
|
||||
if( this.invLayer != null )
|
||||
{
|
||||
return this.invLayer.getAccessibleSlotsFromSide( side );
|
||||
}
|
||||
|
||||
return NULL_SIDES;
|
||||
}
|
||||
@@ -228,7 +248,9 @@ public class LayerISidedInventory extends LayerBase implements ISidedInventory
|
||||
public boolean canInsertItem( int slot, ItemStack itemstack, int side )
|
||||
{
|
||||
if( this.invLayer == null )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return this.invLayer.canInsertItem( slot, itemstack, side );
|
||||
}
|
||||
@@ -237,7 +259,9 @@ public class LayerISidedInventory extends LayerBase implements ISidedInventory
|
||||
public boolean canExtractItem( int slot, ItemStack itemstack, int side )
|
||||
{
|
||||
if( this.invLayer == null )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return this.invLayer.canExtractItem( slot, itemstack, side );
|
||||
}
|
||||
|
||||
@@ -36,7 +36,9 @@ public class LayerITileStorageMonitorable extends LayerBase implements ITileStor
|
||||
{
|
||||
IPart part = this.getPart( side );
|
||||
if( part instanceof ITileStorageMonitorable )
|
||||
{
|
||||
return ( (ITileStorageMonitorable) part ).getMonitorable( side, src );
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -67,9 +67,13 @@ public class PartCableAnchor implements IPart
|
||||
public void getBoxes( IPartCollisionHelper bch )
|
||||
{
|
||||
if( this.host != null && this.host.getFacadeContainer().getFacade( this.mySide ) != null )
|
||||
{
|
||||
bch.addBox( 7, 7, 10, 9, 9, 14 );
|
||||
}
|
||||
else
|
||||
{
|
||||
bch.addBox( 7, 7, 10, 9, 9, 16 );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -96,9 +100,13 @@ public class PartCableAnchor implements IPart
|
||||
IIcon myIcon = this.is.getIconIndex();
|
||||
rh.setTexture( myIcon );
|
||||
if( this.host != null && this.host.getFacadeContainer().getFacade( this.mySide ) != null )
|
||||
{
|
||||
rh.setBounds( 7, 7, 10, 9, 9, 14 );
|
||||
}
|
||||
else
|
||||
{
|
||||
rh.setBounds( 7, 7, 10, 9, 9, 16 );
|
||||
}
|
||||
rh.renderBlock( x, y, z, renderer );
|
||||
rh.setTexture( null );
|
||||
}
|
||||
|
||||
@@ -203,10 +203,14 @@ public class PartInterface extends PartBasicState implements IGridTickable, ISto
|
||||
public boolean onPartActivate( EntityPlayer p, Vec3 pos )
|
||||
{
|
||||
if( p.isSneaking() )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if( Platform.isServer() )
|
||||
{
|
||||
Platform.openGUI( p, this.getTileEntity(), this.side, GuiBridge.GUI_INTERFACE );
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -163,7 +163,9 @@ public class PartStorageBus extends PartUpgradeable implements IGridTickable, IC
|
||||
super.onChangeInventory( inv, slot, mc, removedStack, newStack );
|
||||
|
||||
if( inv == this.Config )
|
||||
{
|
||||
this.resetCache( true );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -193,7 +195,9 @@ public class PartStorageBus extends PartUpgradeable implements IGridTickable, IC
|
||||
public IInventory getInventoryByName( String name )
|
||||
{
|
||||
if( name.equals( "config" ) )
|
||||
{
|
||||
return this.Config;
|
||||
}
|
||||
|
||||
return super.getInventoryByName( name );
|
||||
}
|
||||
@@ -201,12 +205,18 @@ public class PartStorageBus extends PartUpgradeable implements IGridTickable, IC
|
||||
private void resetCache( boolean fullReset )
|
||||
{
|
||||
if( this.host == null || this.host.getTile() == null || this.host.getTile().getWorldObj() == null || this.host.getTile().getWorldObj().isRemote )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if( fullReset )
|
||||
{
|
||||
this.resetCacheLogic = 2;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.resetCacheLogic = 1;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
@@ -230,7 +240,9 @@ public class PartStorageBus extends PartUpgradeable implements IGridTickable, IC
|
||||
try
|
||||
{
|
||||
if( this.proxy.isActive() )
|
||||
{
|
||||
this.proxy.getStorage().postAlterationOfStoredItems( StorageChannel.ITEMS, change, this.mySrc );
|
||||
}
|
||||
}
|
||||
catch( GridAccessException e )
|
||||
{
|
||||
@@ -312,7 +324,9 @@ public class PartStorageBus extends PartUpgradeable implements IGridTickable, IC
|
||||
if( !player.isSneaking() )
|
||||
{
|
||||
if( Platform.isClient() )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
Platform.openGUI( player, this.getHost().getTile(), this.side, GuiBridge.GUI_STORAGEBUS );
|
||||
return true;
|
||||
@@ -331,10 +345,14 @@ public class PartStorageBus extends PartUpgradeable implements IGridTickable, IC
|
||||
public TickRateModulation tickingRequest( IGridNode node, int TicksSinceLastCall )
|
||||
{
|
||||
if( this.resetCacheLogic != 0 )
|
||||
{
|
||||
this.resetCache();
|
||||
}
|
||||
|
||||
if( this.monitor != null )
|
||||
{
|
||||
return this.monitor.onTick();
|
||||
}
|
||||
|
||||
return TickRateModulation.SLEEP;
|
||||
}
|
||||
@@ -347,20 +365,28 @@ public class PartStorageBus extends PartUpgradeable implements IGridTickable, IC
|
||||
IMEInventory<IAEItemStack> in = this.getInternalHandler();
|
||||
IItemList<IAEItemStack> before = AEApi.instance().storage().createItemList();
|
||||
if( in != null )
|
||||
{
|
||||
before = in.getAvailableItems( before );
|
||||
}
|
||||
|
||||
this.cached = false;
|
||||
if( fullReset )
|
||||
{
|
||||
this.handlerHash = 0;
|
||||
}
|
||||
|
||||
IMEInventory<IAEItemStack> out = this.getInternalHandler();
|
||||
|
||||
if( this.monitor != null )
|
||||
{
|
||||
this.monitor.onTick();
|
||||
}
|
||||
|
||||
IItemList<IAEItemStack> after = AEApi.instance().storage().createItemList();
|
||||
if( out != null )
|
||||
{
|
||||
after = out.getAvailableItems( after );
|
||||
}
|
||||
|
||||
Platform.postListChanges( before, after, this, this.mySrc );
|
||||
}
|
||||
@@ -368,7 +394,9 @@ public class PartStorageBus extends PartUpgradeable implements IGridTickable, IC
|
||||
public MEInventoryHandler getInternalHandler()
|
||||
{
|
||||
if( this.cached )
|
||||
{
|
||||
return this.handler;
|
||||
}
|
||||
|
||||
boolean wasSleeping = this.monitor == null;
|
||||
|
||||
@@ -379,7 +407,9 @@ public class PartStorageBus extends PartUpgradeable implements IGridTickable, IC
|
||||
int newHandlerHash = Platform.generateTileHash( target );
|
||||
|
||||
if( this.handlerHash == newHandlerHash && this.handlerHash != 0 )
|
||||
{
|
||||
return this.handler;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
@@ -409,7 +439,9 @@ public class PartStorageBus extends PartUpgradeable implements IGridTickable, IC
|
||||
}
|
||||
|
||||
if( inv instanceof MEMonitorIInventory )
|
||||
{
|
||||
this.monitor = (MEMonitorIInventory) inv;
|
||||
}
|
||||
|
||||
if( inv != null )
|
||||
{
|
||||
@@ -428,16 +460,24 @@ public class PartStorageBus extends PartUpgradeable implements IGridTickable, IC
|
||||
{
|
||||
IAEItemStack is = this.Config.getAEStackInSlot( x );
|
||||
if( is != null )
|
||||
{
|
||||
priorityList.add( is );
|
||||
}
|
||||
}
|
||||
|
||||
if( this.getInstalledUpgrades( Upgrades.FUZZY ) > 0 )
|
||||
{
|
||||
this.handler.setPartitionList( new FuzzyPriorityList( priorityList, (FuzzyMode) this.getConfigManager().getSetting( Settings.FUZZY_MODE ) ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
this.handler.setPartitionList( new PrecisePriorityList( priorityList ) );
|
||||
}
|
||||
|
||||
if( inv instanceof IMEMonitor )
|
||||
{
|
||||
( (IMEMonitor) inv ).addListener( this, this.handler );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -449,9 +489,13 @@ public class PartStorageBus extends PartUpgradeable implements IGridTickable, IC
|
||||
{
|
||||
ITickManager tm = this.proxy.getTick();
|
||||
if( this.monitor == null )
|
||||
{
|
||||
tm.sleepDevice( this.proxy.getNode() );
|
||||
}
|
||||
else
|
||||
{
|
||||
tm.wakeDevice( this.proxy.getNode() );
|
||||
}
|
||||
}
|
||||
catch( GridAccessException e )
|
||||
{
|
||||
@@ -467,13 +511,17 @@ public class PartStorageBus extends PartUpgradeable implements IGridTickable, IC
|
||||
IInterfaceHost achievement = null;
|
||||
|
||||
if( target instanceof IInterfaceHost )
|
||||
{
|
||||
achievement = (IInterfaceHost) target;
|
||||
}
|
||||
|
||||
if( target instanceof IPartHost )
|
||||
{
|
||||
Object part = ( (IPartHost) target ).getPart( side );
|
||||
if( part instanceof IInterfaceHost )
|
||||
{
|
||||
achievement = (IInterfaceHost) part;
|
||||
}
|
||||
}
|
||||
|
||||
if( achievement != null && achievement.getActionableNode() != null )
|
||||
@@ -490,7 +538,9 @@ public class PartStorageBus extends PartUpgradeable implements IGridTickable, IC
|
||||
{
|
||||
IMEInventoryHandler out = this.proxy.isActive() ? this.getInternalHandler() : null;
|
||||
if( out != null )
|
||||
{
|
||||
return Collections.singletonList( out );
|
||||
}
|
||||
}
|
||||
return Arrays.asList( new IMEInventoryHandler[] {} );
|
||||
}
|
||||
|
||||
@@ -82,9 +82,13 @@ public class PartCableCovered extends PartCable
|
||||
{
|
||||
IGridNode n = this.getGridNode();
|
||||
if( n != null )
|
||||
{
|
||||
this.connections = n.getConnectedSides();
|
||||
}
|
||||
else
|
||||
{
|
||||
this.connections.clear();
|
||||
}
|
||||
}
|
||||
|
||||
for( ForgeDirection of : this.connections )
|
||||
|
||||
@@ -86,9 +86,13 @@ public class PartCableSmart extends PartCable
|
||||
{
|
||||
IGridNode n = this.getGridNode();
|
||||
if( n != null )
|
||||
{
|
||||
this.connections = n.getConnectedSides();
|
||||
}
|
||||
else
|
||||
{
|
||||
this.connections.clear();
|
||||
}
|
||||
}
|
||||
|
||||
for( ForgeDirection of : this.connections )
|
||||
|
||||
@@ -90,9 +90,13 @@ public class PartDenseCable extends PartCable
|
||||
{
|
||||
IGridNode n = this.getGridNode();
|
||||
if( n != null )
|
||||
{
|
||||
this.connections = n.getConnectedSides();
|
||||
}
|
||||
else
|
||||
{
|
||||
this.connections.clear();
|
||||
}
|
||||
}
|
||||
|
||||
for( ForgeDirection of : this.connections )
|
||||
@@ -222,7 +226,9 @@ public class PartDenseCable extends PartCable
|
||||
for( ForgeDirection of : this.connections )
|
||||
{
|
||||
if( !this.isDense( of ) )
|
||||
{
|
||||
hasBuses = true;
|
||||
}
|
||||
}
|
||||
|
||||
if( sides.size() != 2 || !this.nonLinear( sides ) || hasBuses )
|
||||
@@ -230,11 +236,17 @@ public class PartDenseCable extends PartCable
|
||||
for( ForgeDirection of : this.connections )
|
||||
{
|
||||
if( this.isDense( of ) )
|
||||
{
|
||||
this.renderDenseConnection( x, y, z, rh, renderer, this.channelsOnSide[of.ordinal()], of );
|
||||
}
|
||||
else if( this.isSmart( of ) )
|
||||
{
|
||||
this.renderSmartConnection( x, y, z, rh, renderer, this.channelsOnSide[of.ordinal()], of );
|
||||
}
|
||||
else
|
||||
{
|
||||
this.renderCoveredConnection( x, y, z, rh, renderer, this.channelsOnSide[of.ordinal()], of );
|
||||
}
|
||||
}
|
||||
|
||||
rh.setTexture( this.getDenseTexture( this.getCableColor() ) );
|
||||
@@ -388,9 +400,13 @@ public class PartDenseCable extends PartCable
|
||||
|
||||
rh.setFacesToRender( EnumSet.complementOf( EnumSet.of( of, of.getOpposite() ) ) );
|
||||
if( ghh != null && partHost != null && ghh.getCableConnectionType( of ) != AECableType.GLASS && partHost.getColor() != AEColor.Transparent && partHost.getPart( of.getOpposite() ) == null )
|
||||
{
|
||||
rh.setTexture( this.getTexture( myColor = partHost.getColor() ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
rh.setTexture( this.getTexture( this.getCableColor() ) );
|
||||
}
|
||||
|
||||
switch( of )
|
||||
{
|
||||
|
||||
@@ -188,7 +188,9 @@ public class PartQuartzFiber extends AEBasePart implements IEnergyGridProvider
|
||||
{
|
||||
IEnergyGrid eg = this.proxy.getEnergy();
|
||||
if( !seen.contains( eg ) )
|
||||
{
|
||||
return eg.injectAEPower( amt, mode, seen );
|
||||
}
|
||||
}
|
||||
catch( GridAccessException e )
|
||||
{
|
||||
@@ -199,7 +201,9 @@ public class PartQuartzFiber extends AEBasePart implements IEnergyGridProvider
|
||||
{
|
||||
IEnergyGrid eg = this.outerProxy.getEnergy();
|
||||
if( !seen.contains( eg ) )
|
||||
{
|
||||
return eg.injectAEPower( amt, mode, seen );
|
||||
}
|
||||
}
|
||||
catch( GridAccessException e )
|
||||
{
|
||||
|
||||
@@ -98,7 +98,9 @@ public class PartP2PIC2Power extends PartP2PTunnel<PartP2PIC2Power> implements i
|
||||
public boolean acceptsEnergyFrom( TileEntity emitter, ForgeDirection direction )
|
||||
{
|
||||
if( !this.output )
|
||||
{
|
||||
return direction == this.side;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -106,7 +108,9 @@ public class PartP2PIC2Power extends PartP2PTunnel<PartP2PIC2Power> implements i
|
||||
public boolean emitsEnergyTo( TileEntity receiver, ForgeDirection direction )
|
||||
{
|
||||
if( this.output )
|
||||
{
|
||||
return direction == this.side;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -114,7 +118,9 @@ public class PartP2PIC2Power extends PartP2PTunnel<PartP2PIC2Power> implements i
|
||||
public double getDemandedEnergy()
|
||||
{
|
||||
if( this.output )
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
@@ -154,30 +160,42 @@ public class PartP2PIC2Power extends PartP2PTunnel<PartP2PIC2Power> implements i
|
||||
}
|
||||
|
||||
if( outs.isEmpty() )
|
||||
{
|
||||
return amount;
|
||||
}
|
||||
|
||||
LinkedList<PartP2PIC2Power> Options = new LinkedList<PartP2PIC2Power>();
|
||||
for( PartP2PIC2Power o : outs )
|
||||
{
|
||||
if( o.OutputEnergyA <= 0.01 )
|
||||
{
|
||||
Options.add( o );
|
||||
}
|
||||
}
|
||||
|
||||
if( Options.isEmpty() )
|
||||
{
|
||||
for( PartP2PIC2Power o : outs )
|
||||
{
|
||||
if( o.OutputEnergyB <= 0.01 )
|
||||
{
|
||||
Options.add( o );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if( Options.isEmpty() )
|
||||
{
|
||||
for( PartP2PIC2Power o : outs )
|
||||
{
|
||||
Options.add( o );
|
||||
}
|
||||
}
|
||||
|
||||
if( Options.isEmpty() )
|
||||
{
|
||||
return amount;
|
||||
}
|
||||
|
||||
PartP2PIC2Power x = Platform.pickRandom( Options );
|
||||
|
||||
@@ -209,7 +227,9 @@ public class PartP2PIC2Power extends PartP2PTunnel<PartP2PIC2Power> implements i
|
||||
public double getOfferedEnergy()
|
||||
{
|
||||
if( this.output )
|
||||
{
|
||||
return this.OutputEnergyA;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -231,7 +251,9 @@ public class PartP2PIC2Power extends PartP2PTunnel<PartP2PIC2Power> implements i
|
||||
public int getSourceTier()
|
||||
{
|
||||
if( this.output )
|
||||
{
|
||||
return this.calculateTierFromVoltage( this.OutputVoltageA );
|
||||
}
|
||||
return 4;
|
||||
}
|
||||
|
||||
|
||||
@@ -81,7 +81,9 @@ public class PartP2PItems extends PartP2PTunnel<PartP2PItems> implements IPipeCo
|
||||
this.cachedInv = null;
|
||||
PartP2PItems input = this.getInput();
|
||||
if( input != null && this.output )
|
||||
{
|
||||
input.onTunnelNetworkChange();
|
||||
}
|
||||
}
|
||||
|
||||
IInventory getDestination()
|
||||
@@ -89,7 +91,9 @@ public class PartP2PItems extends PartP2PTunnel<PartP2PItems> implements IPipeCo
|
||||
this.requested = true;
|
||||
|
||||
if( this.cachedInv != null )
|
||||
{
|
||||
return this.cachedInv;
|
||||
}
|
||||
|
||||
List<IInventory> outs = new LinkedList<IInventory>();
|
||||
TunnelCollection<PartP2PItems> itemTunnels;
|
||||
@@ -109,9 +113,13 @@ public class PartP2PItems extends PartP2PTunnel<PartP2PItems> implements IPipeCo
|
||||
if( inv != null )
|
||||
{
|
||||
if( Platform.getRandomInt() % 2 == 0 )
|
||||
{
|
||||
outs.add( inv );
|
||||
}
|
||||
else
|
||||
{
|
||||
outs.add( 0, inv );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -127,7 +135,9 @@ public class PartP2PItems extends PartP2PTunnel<PartP2PItems> implements IPipeCo
|
||||
TileEntity te = this.tile.getWorldObj().getTileEntity( this.tile.xCoord + this.side.offsetX, this.tile.yCoord + this.side.offsetY, this.tile.zCoord + this.side.offsetZ );
|
||||
|
||||
if( this.which.contains( this ) )
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
this.which.add( this );
|
||||
|
||||
@@ -189,7 +199,9 @@ public class PartP2PItems extends PartP2PTunnel<PartP2PItems> implements IPipeCo
|
||||
boolean wasReq = this.requested;
|
||||
|
||||
if( this.requested && this.cachedInv != null )
|
||||
{
|
||||
( (WrapperChainedInventory) this.cachedInv ).cycleOrder();
|
||||
}
|
||||
|
||||
this.requested = false;
|
||||
return wasReq ? TickRateModulation.FASTER : TickRateModulation.SLOWER;
|
||||
@@ -264,7 +276,9 @@ public class PartP2PItems extends PartP2PTunnel<PartP2PItems> implements IPipeCo
|
||||
{
|
||||
PartP2PItems input = this.getInput();
|
||||
if( input != null )
|
||||
{
|
||||
input.getHost().notifyNeighbors();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -273,7 +287,9 @@ public class PartP2PItems extends PartP2PTunnel<PartP2PItems> implements IPipeCo
|
||||
{
|
||||
int[] slots = new int[this.getSizeInventory()];
|
||||
for( int x = 0; x < this.getSizeInventory(); x++ )
|
||||
{
|
||||
slots[x] = x;
|
||||
}
|
||||
return slots;
|
||||
}
|
||||
|
||||
|
||||
@@ -87,7 +87,9 @@ public class PartP2PLight extends PartP2PTunnel<PartP2PLight> implements IGridTi
|
||||
private boolean doWork()
|
||||
{
|
||||
if( this.output )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
TileEntity te = this.getTile();
|
||||
World w = te.getWorldObj();
|
||||
@@ -100,7 +102,9 @@ public class PartP2PLight extends PartP2PTunnel<PartP2PLight> implements IGridTi
|
||||
try
|
||||
{
|
||||
for( PartP2PLight out : this.getOutputs() )
|
||||
{
|
||||
out.setLightLevel( this.lastValue );
|
||||
}
|
||||
}
|
||||
catch( GridAccessException e )
|
||||
{
|
||||
@@ -119,14 +123,18 @@ public class PartP2PLight extends PartP2PTunnel<PartP2PLight> implements IGridTi
|
||||
this.doWork();
|
||||
|
||||
if( this.output )
|
||||
{
|
||||
this.getHost().markForUpdate();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getLightLevel()
|
||||
{
|
||||
if( this.output && this.isPowered() )
|
||||
{
|
||||
return this.blockLight( this.lastValue );
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -160,7 +168,9 @@ public class PartP2PLight extends PartP2PTunnel<PartP2PLight> implements IGridTi
|
||||
{
|
||||
super.readFromNBT( tag );
|
||||
if( tag.hasKey( "opacity" ) )
|
||||
{
|
||||
this.opacity = tag.getFloat( "opacity" );
|
||||
}
|
||||
this.lastValue = tag.getInteger( "lastValue" );
|
||||
}
|
||||
|
||||
@@ -185,12 +195,18 @@ public class PartP2PLight extends PartP2PTunnel<PartP2PLight> implements IGridTi
|
||||
{
|
||||
PartP2PLight src = this.getInput();
|
||||
if( src != null && src.proxy.isActive() )
|
||||
{
|
||||
this.setLightLevel( src.lastValue );
|
||||
}
|
||||
else
|
||||
{
|
||||
this.getHost().markForUpdate();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
this.doWork();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -80,7 +80,9 @@ public class PartP2PLiquids extends PartP2PTunnel<PartP2PLiquids> implements IFl
|
||||
{
|
||||
PartP2PLiquids in = this.getInput();
|
||||
if( in != null )
|
||||
{
|
||||
in.onTunnelNetworkChange();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -90,8 +92,12 @@ public class PartP2PLiquids extends PartP2PTunnel<PartP2PLiquids> implements IFl
|
||||
Stack<PartP2PLiquids> stack = this.getDepth();
|
||||
|
||||
for( PartP2PLiquids t : stack )
|
||||
{
|
||||
if( t == this )
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
stack.push( this );
|
||||
|
||||
@@ -104,20 +110,30 @@ public class PartP2PLiquids extends PartP2PTunnel<PartP2PLiquids> implements IFl
|
||||
PartP2PLiquids l = i.next();
|
||||
IFluidHandler tank = l.getTarget();
|
||||
if( tank != null )
|
||||
{
|
||||
l.tmpUsed = tank.fill( l.side.getOpposite(), resource.copy(), false );
|
||||
}
|
||||
else
|
||||
{
|
||||
l.tmpUsed = 0;
|
||||
}
|
||||
|
||||
if( l.tmpUsed <= 0 )
|
||||
{
|
||||
i.remove();
|
||||
}
|
||||
else
|
||||
{
|
||||
requestTotal += l.tmpUsed;
|
||||
}
|
||||
}
|
||||
|
||||
if( requestTotal <= 0 )
|
||||
{
|
||||
if( stack.pop() != this )
|
||||
{
|
||||
throw new IllegalStateException( "Invalid Recursion detected." );
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -125,7 +141,9 @@ public class PartP2PLiquids extends PartP2PTunnel<PartP2PLiquids> implements IFl
|
||||
if( !doFill )
|
||||
{
|
||||
if( stack.pop() != this )
|
||||
{
|
||||
throw new IllegalStateException( "Invalid Recursion detected." );
|
||||
}
|
||||
|
||||
return Math.min( resource.amount, requestTotal );
|
||||
}
|
||||
@@ -141,20 +159,28 @@ public class PartP2PLiquids extends PartP2PTunnel<PartP2PLiquids> implements IFl
|
||||
FluidStack insert = resource.copy();
|
||||
insert.amount = (int) Math.ceil( insert.amount * ( (double) l.tmpUsed / (double) requestTotal ) );
|
||||
if( insert.amount > available )
|
||||
{
|
||||
insert.amount = available;
|
||||
}
|
||||
|
||||
IFluidHandler tank = l.getTarget();
|
||||
if( tank != null )
|
||||
{
|
||||
l.tmpUsed = tank.fill( l.side.getOpposite(), insert.copy(), true );
|
||||
}
|
||||
else
|
||||
{
|
||||
l.tmpUsed = 0;
|
||||
}
|
||||
|
||||
available -= insert.amount;
|
||||
used += insert.amount;
|
||||
}
|
||||
|
||||
if( stack.pop() != this )
|
||||
{
|
||||
throw new IllegalStateException( "Invalid Recursion detected." );
|
||||
}
|
||||
|
||||
return used;
|
||||
}
|
||||
@@ -164,7 +190,9 @@ public class PartP2PLiquids extends PartP2PTunnel<PartP2PLiquids> implements IFl
|
||||
Stack<PartP2PLiquids> s = DEPTH.get();
|
||||
|
||||
if( s == null )
|
||||
{
|
||||
DEPTH.set( s = new Stack<PartP2PLiquids>() );
|
||||
}
|
||||
|
||||
return s;
|
||||
}
|
||||
@@ -181,7 +209,9 @@ public class PartP2PLiquids extends PartP2PTunnel<PartP2PLiquids> implements IFl
|
||||
if( handler != null )
|
||||
{
|
||||
if( handler.canFill( l.side.getOpposite(), input ) )
|
||||
{
|
||||
outs.add( l );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -196,14 +226,20 @@ public class PartP2PLiquids extends PartP2PTunnel<PartP2PLiquids> implements IFl
|
||||
IFluidHandler getTarget()
|
||||
{
|
||||
if( !this.proxy.isActive() )
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
if( this.cachedTank != null )
|
||||
{
|
||||
return this.cachedTank;
|
||||
}
|
||||
|
||||
TileEntity te = this.tile.getWorldObj().getTileEntity( this.tile.xCoord + this.side.offsetX, this.tile.yCoord + this.side.offsetY, this.tile.zCoord + this.side.offsetZ );
|
||||
if( te instanceof IFluidHandler )
|
||||
{
|
||||
return this.cachedTank = (IFluidHandler) te;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
@@ -236,7 +272,9 @@ public class PartP2PLiquids extends PartP2PTunnel<PartP2PLiquids> implements IFl
|
||||
public FluidTankInfo[] getTankInfo( ForgeDirection from )
|
||||
{
|
||||
if( from == this.side )
|
||||
{
|
||||
return this.getTank();
|
||||
}
|
||||
return new FluidTankInfo[0];
|
||||
}
|
||||
|
||||
@@ -246,14 +284,18 @@ public class PartP2PLiquids extends PartP2PTunnel<PartP2PLiquids> implements IFl
|
||||
{
|
||||
PartP2PLiquids tun = this.getInput();
|
||||
if( tun != null )
|
||||
{
|
||||
return ACTIVE_TANK;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
try
|
||||
{
|
||||
if( !this.getOutputs().isEmpty() )
|
||||
{
|
||||
return ACTIVE_TANK;
|
||||
}
|
||||
}
|
||||
catch( GridAccessException e )
|
||||
{
|
||||
|
||||
@@ -81,15 +81,21 @@ public final class PartP2PRFPower extends PartP2PTunnel<PartP2PRFPower> implemen
|
||||
public int receiveEnergy( ForgeDirection from, int maxReceive, boolean simulate )
|
||||
{
|
||||
if( this.output )
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
if( this.isActive() )
|
||||
{
|
||||
Stack<PartP2PRFPower> stack = this.getDepth();
|
||||
|
||||
for( PartP2PRFPower t : stack )
|
||||
{
|
||||
if( t == this )
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
stack.push( this );
|
||||
|
||||
@@ -106,7 +112,9 @@ public final class PartP2PRFPower extends PartP2PTunnel<PartP2PRFPower> implemen
|
||||
total += receiver;
|
||||
|
||||
if( maxReceive <= 0 )
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -119,7 +127,9 @@ public final class PartP2PRFPower extends PartP2PTunnel<PartP2PRFPower> implemen
|
||||
total += receiver;
|
||||
|
||||
if( maxReceive <= 0 )
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -130,7 +140,9 @@ public final class PartP2PRFPower extends PartP2PTunnel<PartP2PRFPower> implemen
|
||||
}
|
||||
|
||||
if( stack.pop() != this )
|
||||
{
|
||||
throw new IllegalStateException( "Invalid Recursion detected." );
|
||||
}
|
||||
|
||||
return total;
|
||||
}
|
||||
@@ -143,7 +155,9 @@ public final class PartP2PRFPower extends PartP2PTunnel<PartP2PRFPower> implemen
|
||||
Stack<PartP2PRFPower> s = THREAD_STACK.get();
|
||||
|
||||
if( s == null )
|
||||
{
|
||||
THREAD_STACK.set( s = new Stack<PartP2PRFPower>() );
|
||||
}
|
||||
|
||||
return s;
|
||||
}
|
||||
@@ -161,7 +175,9 @@ public final class PartP2PRFPower extends PartP2PTunnel<PartP2PRFPower> implemen
|
||||
}
|
||||
|
||||
if( this.outputTarget == null || !this.outputTarget.canConnectEnergy( this.side.getOpposite() ) )
|
||||
{
|
||||
return NULL_HANDLER;
|
||||
}
|
||||
|
||||
return this.outputTarget;
|
||||
}
|
||||
@@ -172,15 +188,21 @@ public final class PartP2PRFPower extends PartP2PTunnel<PartP2PRFPower> implemen
|
||||
public int getEnergyStored( ForgeDirection from )
|
||||
{
|
||||
if( this.output || !this.isActive() )
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int total = 0;
|
||||
|
||||
Stack<PartP2PRFPower> stack = this.getDepth();
|
||||
|
||||
for( PartP2PRFPower t : stack )
|
||||
{
|
||||
if( t == this )
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
stack.push( this );
|
||||
|
||||
@@ -197,7 +219,9 @@ public final class PartP2PRFPower extends PartP2PTunnel<PartP2PRFPower> implemen
|
||||
}
|
||||
|
||||
if( stack.pop() != this )
|
||||
{
|
||||
throw new IllegalStateException( "Invalid Recursion detected." );
|
||||
}
|
||||
|
||||
return total;
|
||||
}
|
||||
@@ -206,15 +230,21 @@ public final class PartP2PRFPower extends PartP2PTunnel<PartP2PRFPower> implemen
|
||||
public int getMaxEnergyStored( ForgeDirection from )
|
||||
{
|
||||
if( this.output || !this.isActive() )
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int total = 0;
|
||||
|
||||
Stack<PartP2PRFPower> stack = this.getDepth();
|
||||
|
||||
for( PartP2PRFPower t : stack )
|
||||
{
|
||||
if( t == this )
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
stack.push( this );
|
||||
|
||||
@@ -231,7 +261,9 @@ public final class PartP2PRFPower extends PartP2PTunnel<PartP2PRFPower> implemen
|
||||
}
|
||||
|
||||
if( stack.pop() != this )
|
||||
{
|
||||
throw new IllegalStateException( "Invalid Recursion detected." );
|
||||
}
|
||||
|
||||
return total;
|
||||
}
|
||||
|
||||
@@ -61,14 +61,18 @@ public class PartP2PRedstone extends PartP2PTunnel<PartP2PRedstone>
|
||||
{
|
||||
PartP2PRedstone in = this.getInput();
|
||||
if( in != null )
|
||||
{
|
||||
this.putInput( in.power );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected void putInput( Object o )
|
||||
{
|
||||
if( this.recursive )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
this.recursive = true;
|
||||
if( this.output && this.proxy.isActive() )
|
||||
@@ -160,13 +164,17 @@ public class PartP2PRedstone extends PartP2PTunnel<PartP2PRedstone>
|
||||
{
|
||||
int srcSide = this.side.ordinal();
|
||||
if( b instanceof BlockRedstoneWire )
|
||||
{
|
||||
srcSide = 1;
|
||||
}
|
||||
this.power = b.isProvidingStrongPower( this.tile.getWorldObj(), x, y, z, srcSide );
|
||||
this.power = Math.max( this.power, b.isProvidingWeakPower( this.tile.getWorldObj(), x, y, z, srcSide ) );
|
||||
this.sendToOutput( this.power );
|
||||
}
|
||||
else
|
||||
{
|
||||
this.sendToOutput( 0 );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -84,14 +84,18 @@ public abstract class PartP2PTunnel<T extends PartP2PTunnel> extends PartBasicSt
|
||||
public T getInput()
|
||||
{
|
||||
if( this.freq == 0 )
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
PartP2PTunnel tunnel;
|
||||
try
|
||||
{
|
||||
tunnel = this.proxy.getP2P().getInput( this.freq );
|
||||
if( this.getClass().isInstance( tunnel ) )
|
||||
{
|
||||
return (T) tunnel;
|
||||
}
|
||||
}
|
||||
catch( GridAccessException e )
|
||||
{
|
||||
@@ -103,7 +107,9 @@ public abstract class PartP2PTunnel<T extends PartP2PTunnel> extends PartBasicSt
|
||||
public TunnelCollection<T> getOutputs() throws GridAccessException
|
||||
{
|
||||
if( this.proxy.isActive() )
|
||||
{
|
||||
return (TunnelCollection<T>) this.proxy.getP2P().getOutputs( this.freq, this.getClass() );
|
||||
}
|
||||
return new TunnelCollection( new ArrayList(), this.getClass() );
|
||||
}
|
||||
|
||||
@@ -179,7 +185,9 @@ public abstract class PartP2PTunnel<T extends PartP2PTunnel> extends PartBasicSt
|
||||
public ItemStack getItemStack( PartItemStack type )
|
||||
{
|
||||
if( type == PartItemStack.World || type == PartItemStack.Network || type == PartItemStack.Wrench || type == PartItemStack.Pick )
|
||||
{
|
||||
return super.getItemStack( type );
|
||||
}
|
||||
|
||||
final Optional<ItemStack> maybeMEStack = AEApi.instance().definitions().parts().p2PTunnelME().maybeStack( 1 );
|
||||
if( maybeMEStack.isPresent() )
|
||||
@@ -380,7 +388,9 @@ public abstract class PartP2PTunnel<T extends PartP2PTunnel> extends PartBasicSt
|
||||
this.output = false;
|
||||
|
||||
if( wasOutput || this.freq == 0 )
|
||||
{
|
||||
newFreq = System.currentTimeMillis();
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
|
||||
@@ -180,7 +180,9 @@ public class PartP2PTunnelME extends PartP2PTunnel<PartP2PTunnelME> implements I
|
||||
if( connections.destroy )
|
||||
{
|
||||
for( TunnelConnection cw : this.connection.connections.values() )
|
||||
{
|
||||
cw.c.destroy();
|
||||
}
|
||||
|
||||
this.connection.connections.clear();
|
||||
}
|
||||
|
||||
@@ -57,13 +57,19 @@ public class PartConversionMonitor extends PartStorageMonitor
|
||||
public boolean onPartShiftActivate( EntityPlayer player, Vec3 pos )
|
||||
{
|
||||
if( Platform.isClient() )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
if( !this.proxy.isActive() )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if( !Platform.hasPermissions( this.getLocation(), player ) )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
boolean ModeB = false;
|
||||
|
||||
@@ -79,7 +85,9 @@ public class PartConversionMonitor extends PartStorageMonitor
|
||||
try
|
||||
{
|
||||
if( !this.proxy.isActive() )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
IEnergySource energy = this.proxy.getEnergy();
|
||||
IMEMonitor<IAEItemStack> cell = this.proxy.getStorage().getItemInventory();
|
||||
@@ -122,7 +130,9 @@ public class PartConversionMonitor extends PartStorageMonitor
|
||||
try
|
||||
{
|
||||
if( !this.proxy.isActive() )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
IEnergySource energy = this.proxy.getEnergy();
|
||||
IMEMonitor<IAEItemStack> cell = this.proxy.getStorage().getItemInventory();
|
||||
@@ -144,7 +154,9 @@ public class PartConversionMonitor extends PartStorageMonitor
|
||||
}
|
||||
|
||||
if( player.openContainer != null )
|
||||
{
|
||||
player.openContainer.detectAndSendChanges();
|
||||
}
|
||||
}
|
||||
}
|
||||
catch( GridAccessException e )
|
||||
|
||||
@@ -54,8 +54,12 @@ public class PartCraftingTerminal extends PartTerminal
|
||||
super.getDrops( drops, wrenched );
|
||||
|
||||
for( ItemStack is : this.craftingGrid )
|
||||
{
|
||||
if( is != null )
|
||||
{
|
||||
drops.add( is );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -86,7 +90,9 @@ public class PartCraftingTerminal extends PartTerminal
|
||||
}
|
||||
|
||||
if( GuiBridge.GUI_CRAFTING_TERMINAL.hasPermissions( this.getHost().getTile(), x, y, z, this.side, p ) )
|
||||
{
|
||||
return GuiBridge.GUI_CRAFTING_TERMINAL;
|
||||
}
|
||||
return GuiBridge.GUI_ME;
|
||||
}
|
||||
|
||||
@@ -100,7 +106,9 @@ public class PartCraftingTerminal extends PartTerminal
|
||||
public IInventory getInventoryByName( String name )
|
||||
{
|
||||
if( name.equals( "crafting" ) )
|
||||
{
|
||||
return this.craftingGrid;
|
||||
}
|
||||
return super.getInventoryByName( name );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -47,7 +47,9 @@ public class PartInterfaceTerminal extends PartMonitor
|
||||
if( !player.isSneaking() )
|
||||
{
|
||||
if( Platform.isClient() )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
Platform.openGUI( player, this.getHost().getTile(), this.side, GuiBridge.GUI_INTERFACE_TERMINAL );
|
||||
|
||||
|
||||
@@ -80,14 +80,18 @@ public class PartMonitor extends AEBasePart implements IPartMonitor, IPowerChann
|
||||
this.proxy.setIdlePowerUsage( 1.0 / 2.0 );
|
||||
}
|
||||
else
|
||||
{
|
||||
this.proxy.setIdlePowerUsage( 1.0 / 16.0 ); // lights drain a little bit.
|
||||
}
|
||||
}
|
||||
|
||||
@MENetworkEventSubscribe
|
||||
public void bootingRender( MENetworkBootingStatusChange c )
|
||||
{
|
||||
if( this.notLightSource )
|
||||
{
|
||||
this.getHost().markForUpdate();
|
||||
}
|
||||
}
|
||||
|
||||
@MENetworkEventSubscribe
|
||||
@@ -210,9 +214,13 @@ public class PartMonitor extends AEBasePart implements IPartMonitor, IPowerChann
|
||||
try
|
||||
{
|
||||
if( Platform.isServer() )
|
||||
{
|
||||
return this.proxy.getEnergy().isNetworkPowered();
|
||||
}
|
||||
else
|
||||
{
|
||||
return ( ( this.clientFlags & this.POWERED_FLAG ) == this.POWERED_FLAG );
|
||||
}
|
||||
}
|
||||
catch( GridAccessException e )
|
||||
{
|
||||
@@ -232,7 +240,9 @@ public class PartMonitor extends AEBasePart implements IPartMonitor, IPowerChann
|
||||
{
|
||||
super.readFromNBT( data );
|
||||
if( data.hasKey( "opacity" ) )
|
||||
{
|
||||
this.opacity = data.getFloat( "opacity" );
|
||||
}
|
||||
this.spin = data.getByte( "spin" );
|
||||
}
|
||||
|
||||
@@ -253,13 +263,19 @@ public class PartMonitor extends AEBasePart implements IPartMonitor, IPowerChann
|
||||
try
|
||||
{
|
||||
if( this.proxy.getEnergy().isNetworkPowered() )
|
||||
{
|
||||
this.clientFlags |= this.POWERED_FLAG;
|
||||
}
|
||||
|
||||
if( this.proxy.getPath().isNetworkBooting() )
|
||||
{
|
||||
this.clientFlags |= this.BOOTING_FLAG;
|
||||
}
|
||||
|
||||
if( this.proxy.getNode().meetsChannelRequirements() )
|
||||
{
|
||||
this.clientFlags |= this.CHANNEL_FLAG;
|
||||
}
|
||||
}
|
||||
catch( GridAccessException e )
|
||||
{
|
||||
@@ -277,7 +293,9 @@ public class PartMonitor extends AEBasePart implements IPartMonitor, IPowerChann
|
||||
this.clientFlags = data.readByte();
|
||||
this.spin = (byte) ( this.clientFlags & 3 );
|
||||
if( this.clientFlags == oldFlags )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -297,7 +315,9 @@ public class PartMonitor extends AEBasePart implements IPartMonitor, IPowerChann
|
||||
if( Platform.isServer() )
|
||||
{
|
||||
if( this.spin > 3 )
|
||||
{
|
||||
this.spin = 0;
|
||||
}
|
||||
|
||||
switch( this.spin )
|
||||
{
|
||||
@@ -321,7 +341,9 @@ public class PartMonitor extends AEBasePart implements IPartMonitor, IPowerChann
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return super.onPartActivate( player, pos );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -331,17 +353,25 @@ public class PartMonitor extends AEBasePart implements IPartMonitor, IPowerChann
|
||||
|
||||
byte rotation = (byte) ( MathHelper.floor_double( ( player.rotationYaw * 4F ) / 360F + 2.5D ) & 3 );
|
||||
if( side == ForgeDirection.UP )
|
||||
{
|
||||
this.spin = rotation;
|
||||
}
|
||||
else if( side == ForgeDirection.DOWN )
|
||||
{
|
||||
this.spin = rotation;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isActive()
|
||||
{
|
||||
if( this.notLightSource )
|
||||
{
|
||||
return ( ( this.clientFlags & ( this.CHANNEL_FLAG | this.POWERED_FLAG ) ) == ( this.CHANNEL_FLAG | this.POWERED_FLAG ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
return this.isPowered();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -58,8 +58,12 @@ public class PartPatternTerminal extends PartTerminal
|
||||
public void getDrops( List<ItemStack> drops, boolean wrenched )
|
||||
{
|
||||
for( ItemStack is : this.pattern )
|
||||
{
|
||||
if( is != null )
|
||||
{
|
||||
drops.add( is );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -96,7 +100,9 @@ public class PartPatternTerminal extends PartTerminal
|
||||
}
|
||||
|
||||
if( GuiBridge.GUI_PATTERN_TERMINAL.hasPermissions( this.getHost().getTile(), x, y, z, this.side, p ) )
|
||||
{
|
||||
return GuiBridge.GUI_PATTERN_TERMINAL;
|
||||
}
|
||||
return GuiBridge.GUI_ME;
|
||||
}
|
||||
|
||||
@@ -144,7 +150,9 @@ public class PartPatternTerminal extends PartTerminal
|
||||
{
|
||||
ItemStack is = this.crafting.getStackInSlot( x );
|
||||
if( is != null )
|
||||
{
|
||||
is.stackSize = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -164,13 +172,19 @@ public class PartPatternTerminal extends PartTerminal
|
||||
public IInventory getInventoryByName( String name )
|
||||
{
|
||||
if( name.equals( "crafting" ) )
|
||||
{
|
||||
return this.crafting;
|
||||
}
|
||||
|
||||
if( name.equals( "output" ) )
|
||||
{
|
||||
return this.output;
|
||||
}
|
||||
|
||||
if( name.equals( "pattern" ) )
|
||||
{
|
||||
return this.pattern;
|
||||
}
|
||||
|
||||
return super.getInventoryByName( name );
|
||||
}
|
||||
|
||||
@@ -113,7 +113,9 @@ public class PartStorageMonitor extends PartMonitor implements IPartStorageMonit
|
||||
|
||||
NBTTagCompound myItem = new NBTTagCompound();
|
||||
if( this.configuredItem != null )
|
||||
{
|
||||
this.configuredItem.writeToNBT( myItem );
|
||||
}
|
||||
|
||||
data.setTag( "configuredItem", myItem );
|
||||
}
|
||||
@@ -127,7 +129,9 @@ public class PartStorageMonitor extends PartMonitor implements IPartStorageMonit
|
||||
data.writeBoolean( this.isLocked );
|
||||
data.writeBoolean( this.configuredItem != null );
|
||||
if( this.configuredItem != null )
|
||||
{
|
||||
this.configuredItem.writeToPacket( data );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -139,9 +143,13 @@ public class PartStorageMonitor extends PartMonitor implements IPartStorageMonit
|
||||
this.isLocked = data.readBoolean();
|
||||
boolean val = data.readBoolean();
|
||||
if( val )
|
||||
{
|
||||
this.configuredItem = AEItemStack.loadItemStackFromPacket( data );
|
||||
}
|
||||
else
|
||||
{
|
||||
this.configuredItem = null;
|
||||
}
|
||||
|
||||
this.updateList = true;
|
||||
|
||||
@@ -152,13 +160,19 @@ public class PartStorageMonitor extends PartMonitor implements IPartStorageMonit
|
||||
public boolean onPartActivate( EntityPlayer player, Vec3 pos )
|
||||
{
|
||||
if( Platform.isClient() )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
if( !this.proxy.isActive() )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if( !Platform.hasPermissions( this.getLocation(), player ) )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
TileEntity te = this.tile;
|
||||
ItemStack eq = player.getCurrentEquippedItem();
|
||||
@@ -175,7 +189,9 @@ public class PartStorageMonitor extends PartMonitor implements IPartStorageMonit
|
||||
this.getHost().markForUpdate();
|
||||
}
|
||||
else
|
||||
{
|
||||
this.extractItem( player );
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -184,14 +200,18 @@ public class PartStorageMonitor extends PartMonitor implements IPartStorageMonit
|
||||
public void configureWatchers()
|
||||
{
|
||||
if( this.myWatcher != null )
|
||||
{
|
||||
this.myWatcher.clear();
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
if( this.configuredItem != null )
|
||||
{
|
||||
if( this.myWatcher != null )
|
||||
{
|
||||
this.myWatcher.add( this.configuredItem );
|
||||
}
|
||||
|
||||
this.updateReportingValue( this.proxy.getStorage().getItemInventory() );
|
||||
}
|
||||
@@ -213,9 +233,13 @@ public class PartStorageMonitor extends PartMonitor implements IPartStorageMonit
|
||||
{
|
||||
IAEItemStack result = itemInventory.getStorageList().findPrecise( this.configuredItem );
|
||||
if( result == null )
|
||||
{
|
||||
this.configuredItem.setStackSize( 0 );
|
||||
}
|
||||
else
|
||||
{
|
||||
this.configuredItem.setStackSize( result.getStackSize() );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -225,7 +249,9 @@ public class PartStorageMonitor extends PartMonitor implements IPartStorageMonit
|
||||
{
|
||||
super.finalize();
|
||||
if( this.dspList != null )
|
||||
{
|
||||
GLAllocation.deleteDisplayLists( this.dspList );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -233,12 +259,16 @@ public class PartStorageMonitor extends PartMonitor implements IPartStorageMonit
|
||||
public void renderDynamic( double x, double y, double z, IPartRenderHelper rh, RenderBlocks renderer )
|
||||
{
|
||||
if( this.dspList == null )
|
||||
{
|
||||
this.dspList = GLAllocation.generateDisplayLists( 1 );
|
||||
}
|
||||
|
||||
Tessellator tess = Tessellator.instance;
|
||||
|
||||
if( ( this.clientFlags & ( this.POWERED_FLAG | this.CHANNEL_FLAG ) ) != ( this.POWERED_FLAG | this.CHANNEL_FLAG ) )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
IAEItemStack ais = (IAEItemStack) this.getDisplayed();
|
||||
if( ais != null )
|
||||
@@ -254,7 +284,9 @@ public class PartStorageMonitor extends PartMonitor implements IPartStorageMonit
|
||||
GL11.glEndList();
|
||||
}
|
||||
else
|
||||
{
|
||||
GL11.glCallList( this.dspList );
|
||||
}
|
||||
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
@@ -375,9 +407,13 @@ public class PartStorageMonitor extends PartMonitor implements IPartStorageMonit
|
||||
if( this.configuredItem != null )
|
||||
{
|
||||
if( fullStack == null )
|
||||
{
|
||||
this.configuredItem.setStackSize( 0 );
|
||||
}
|
||||
else
|
||||
{
|
||||
this.configuredItem.setStackSize( fullStack.getStackSize() );
|
||||
}
|
||||
|
||||
this.getHost().markForUpdate();
|
||||
}
|
||||
|
||||
@@ -72,8 +72,12 @@ public class PartTerminal extends PartMonitor implements ITerminalHost, IConfigM
|
||||
super.getDrops( drops, wrenched );
|
||||
|
||||
for( ItemStack is : this.viewCell )
|
||||
{
|
||||
if( is != null )
|
||||
{
|
||||
drops.add( is );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -106,7 +110,9 @@ public class PartTerminal extends PartMonitor implements ITerminalHost, IConfigM
|
||||
if( !player.isSneaking() )
|
||||
{
|
||||
if( Platform.isClient() )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
Platform.openGUI( player, this.getHost().getTile(), this.side, this.getGui( player ) );
|
||||
|
||||
|
||||
Reference in New Issue
Block a user