This commit is contained in:
AlgorithmX2
2014-04-09 20:12:49 -05:00
14 changed files with 61 additions and 21 deletions
+2 -2
View File
@@ -123,7 +123,7 @@ public class AEBaseItemBlock extends ItemBlock
if ( super.placeBlockAt( stack, player, w, x, y, z, side, hitX, hitY, hitZ, metadata ) ) if ( super.placeBlockAt( stack, player, w, x, y, z, side, hitX, hitY, hitZ, metadata ) )
{ {
if ( blockType.hasBlockTileEntity() && !blockType.hasCustomRotation() ) if ( blockType.hasBlockTileEntity() )
{ {
AEBaseTile tile = blockType.getTileEntity( w, x, y, z ); AEBaseTile tile = blockType.getTileEntity( w, x, y, z );
ori = tile; ori = tile;
@@ -131,7 +131,7 @@ public class AEBaseItemBlock extends ItemBlock
if ( tile == null ) if ( tile == null )
return true; return true;
if ( ori.canBeRotated() ) if ( ori.canBeRotated() && !blockType.hasCustomRotation() )
{ {
if ( ori.getForward() == null || ori.getUp() == null || // null if ( ori.getForward() == null || ori.getUp() == null || // null
tile.getForward() == ForgeDirection.UNKNOWN || ori.getUp() == ForgeDirection.UNKNOWN ) tile.getForward() == ForgeDirection.UNKNOWN || ori.getUp() == ForgeDirection.UNKNOWN )
+1 -1
View File
@@ -47,7 +47,7 @@ public class AELog
{ {
if ( AEConfig.instance.isFeatureEnabled( AEFeature.Logging ) ) if ( AEConfig.instance.isFeatureEnabled( AEFeature.Logging ) )
{ {
severe( "Error: " + e.getMessage() ); severe( "Error: " + e.getClass().getName() + " : " + e.getMessage() );
e.printStackTrace(); e.printStackTrace();
} }
} }
+26 -3
View File
@@ -201,7 +201,15 @@ public enum GuiBridge implements IGuiHandler
Constructor[] c = Container.getConstructors(); Constructor[] c = Container.getConstructors();
if ( c.length == 0 ) if ( c.length == 0 )
throw new AppEngException( "Invalid Gui Class" ); throw new AppEngException( "Invalid Gui Class" );
return findConstructor( c, inventory, tE ).newInstance( inventory, tE );
Constructor target = findConstructor( c, inventory, tE );
if ( target == null )
{
throw new RuntimeException( "Cannot find " + Container.getName() + "( " + typeName( inventory ) + ", " + typeName( tE ) + " )" );
}
return target.newInstance( inventory, tE );
} }
catch (Throwable t) catch (Throwable t)
{ {
@@ -217,7 +225,14 @@ public enum GuiBridge implements IGuiHandler
if ( c.length == 0 ) if ( c.length == 0 )
throw new AppEngException( "Invalid Gui Class" ); throw new AppEngException( "Invalid Gui Class" );
return findConstructor( c, inventory, tE ).newInstance( inventory, tE ); Constructor target = findConstructor( c, inventory, tE );
if ( target == null )
{
throw new RuntimeException( "Cannot find " + Container.getName() + "( " + typeName( inventory ) + ", " + typeName( tE ) + " )" );
}
return target.newInstance( inventory, tE );
} }
catch (Throwable t) catch (Throwable t)
{ {
@@ -225,6 +240,14 @@ public enum GuiBridge implements IGuiHandler
} }
} }
private String typeName(Object inventory)
{
if ( inventory == null )
return "NULL";
return inventory.getClass().getName();
}
private Constructor findConstructor(Constructor[] c, InventoryPlayer inventory, Object tE) private Constructor findConstructor(Constructor[] c, InventoryPlayer inventory, Object tE)
{ {
for (Constructor con : c) for (Constructor con : c)
@@ -232,7 +255,7 @@ public enum GuiBridge implements IGuiHandler
Class[] types = con.getParameterTypes(); Class[] types = con.getParameterTypes();
if ( types.length == 2 ) if ( types.length == 2 )
{ {
if ( types[0] == inventory.getClass() && types[1].isAssignableFrom( tE.getClass() ) ) if ( types[0].isAssignableFrom( inventory.getClass() ) && types[1].isAssignableFrom( tE.getClass() ) )
return con; return con;
} }
} }
+9 -3
View File
@@ -156,6 +156,12 @@ public class DualityInterface implements IGridTickable, ISegmentedInventory, ISt
private void updatePlan(int slot) private void updatePlan(int slot)
{ {
IAEItemStack req = config.getAEStackInSlot( slot ); IAEItemStack req = config.getAEStackInSlot( slot );
if ( req != null && req.getStackSize() <= 0 )
{
config.setInventorySlotContents(slot, null);
req = null;
}
ItemStack Stored = storage.getStackInSlot( slot ); ItemStack Stored = storage.getStackInSlot( slot );
if ( req == null && Stored != null ) if ( req == null && Stored != null )
@@ -242,7 +248,7 @@ public class DualityInterface implements IGridTickable, ISegmentedInventory, ISt
changed = true; changed = true;
ItemStack issue = adaptor.addItems( aquired.getItemStack() ); ItemStack issue = adaptor.addItems( aquired.getItemStack() );
if ( issue != null ) if ( issue != null )
throw new RuntimeException( "bad attempt at managining inventory. ( addItems )" ); throw new RuntimeException( "bad attempt at managing inventory. ( addItems )" );
} }
} }
else if ( itemStack.getStackSize() < 0 ) else if ( itemStack.getStackSize() < 0 )
@@ -263,9 +269,9 @@ public class DualityInterface implements IGridTickable, ISegmentedInventory, ISt
changed = true; changed = true;
ItemStack removed = adaptor.removeItems( (int) diff, null, null ); ItemStack removed = adaptor.removeItems( (int) diff, null, null );
if ( removed == null ) if ( removed == null )
throw new RuntimeException( "bad attempt at managining inventory. ( addItems )" ); throw new RuntimeException( "bad attempt at managing inventory. ( addItems )" );
else if ( removed.stackSize != diff ) else if ( removed.stackSize != diff )
throw new RuntimeException( "bad attempt at managining inventory. ( addItems )" ); throw new RuntimeException( "bad attempt at managing inventory. ( addItems )" );
} }
} }
// else wtf? // else wtf?
+1 -1
View File
@@ -80,7 +80,7 @@ public class GridStorageCache implements IStorageGrid
private void rmvCell(IGridNode node, ICellContainer cc) private void rmvCell(IGridNode node, ICellContainer cc)
{ {
if ( node.isActive() && activeCellContainers.contains( cc ) ) if ( activeCellContainers.contains( cc ) )
{ {
inactiveCellContainers.add( cc ); inactiveCellContainers.add( cc );
activeCellContainers.remove( cc ); activeCellContainers.remove( cc );
+9
View File
@@ -131,6 +131,15 @@ public class PartP2PIC2Power extends PartP2PTunnel<PartP2PIC2Power> implements i
Options.add( o ); Options.add( o );
} }
if ( Options.isEmpty() )
{
for (PartP2PIC2Power o : outs)
Options.add( o );
}
if ( Options.isEmpty() )
return amount;
PartP2PIC2Power x = (PartP2PIC2Power) Platform.pickRandom( Options ); PartP2PIC2Power x = (PartP2PIC2Power) Platform.pickRandom( Options );
if ( x != null && x.OutputPacket <= 0.001 ) if ( x != null && x.OutputPacket <= 0.001 )
{ {
+1 -1
View File
@@ -7,7 +7,7 @@ public class PartCraftingMonitor extends PartMonitor
{ {
public PartCraftingMonitor(ItemStack is) { public PartCraftingMonitor(ItemStack is) {
super( PartCraftingMonitor.class, is ); super( PartCraftingMonitor.class, is,true );
frontBright = CableBusTextures.PartCraftingMonitor_Bright; frontBright = CableBusTextures.PartCraftingMonitor_Bright;
frontColored = CableBusTextures.PartCraftingMonitor_Colored; frontColored = CableBusTextures.PartCraftingMonitor_Colored;
frontDark = CableBusTextures.PartCraftingMonitor_Dark; frontDark = CableBusTextures.PartCraftingMonitor_Dark;
+1 -1
View File
@@ -13,7 +13,7 @@ public class PartDarkMonitor extends PartMonitor
{ {
public PartDarkMonitor(ItemStack is) { public PartDarkMonitor(ItemStack is) {
super( PartDarkMonitor.class, is ); super( PartDarkMonitor.class, is,false );
notLightSource = false; notLightSource = false;
} }
+3 -2
View File
@@ -114,9 +114,10 @@ public class PartMonitor extends AEBasePart implements IPartMonitor, IPowerChann
super( PartMonitor.class, is ); super( PartMonitor.class, is );
} }
protected PartMonitor(Class c, ItemStack is) { protected PartMonitor(Class c, ItemStack is, boolean requireChannel ) {
super( c, is ); super( c, is );
if ( notLightSource )
if ( requireChannel )
proxy.setFlags( GridFlags.REQUIRE_CHANNEL ); proxy.setFlags( GridFlags.REQUIRE_CHANNEL );
else else
proxy.setIdlePowerUsage( 1.0 / 16.0 ); // lights drain a little bit. proxy.setIdlePowerUsage( 1.0 / 16.0 ); // lights drain a little bit.
+1 -1
View File
@@ -46,7 +46,7 @@ public class PartPatternTerminal extends PartTerminal implements IAEAppEngInvent
} }
public PartPatternTerminal(ItemStack is) { public PartPatternTerminal(ItemStack is) {
super( PartPatternTerminal.class, is ); super( PartPatternTerminal.class, is, true );
frontBright = CableBusTextures.PartPatternTerm_Bright; frontBright = CableBusTextures.PartPatternTerm_Bright;
frontColored = CableBusTextures.PartPatternTerm_Colored; frontColored = CableBusTextures.PartPatternTerm_Colored;
frontDark = CableBusTextures.PartPatternTerm_Dark; frontDark = CableBusTextures.PartPatternTerm_Dark;
+1 -2
View File
@@ -13,8 +13,7 @@ public class PartSemiDarkMonitor extends PartMonitor
{ {
public PartSemiDarkMonitor(ItemStack is) { public PartSemiDarkMonitor(ItemStack is) {
super( PartSemiDarkMonitor.class, is ); super( PartSemiDarkMonitor.class, is,false );
notLightSource = false; notLightSource = false;
} }
+2 -2
View File
@@ -150,11 +150,11 @@ public class PartStorageMonitor extends PartMonitor implements IPartStorageMonit
} }
protected PartStorageMonitor(Class myClass, ItemStack is) { protected PartStorageMonitor(Class myClass, ItemStack is) {
super( myClass, is ); super( myClass, is,true );
} }
public PartStorageMonitor(ItemStack is) { public PartStorageMonitor(ItemStack is) {
super( PartStorageMonitor.class, is ); super( PartStorageMonitor.class, is,true );
frontBright = CableBusTextures.PartStorageMonitor_Bright; frontBright = CableBusTextures.PartStorageMonitor_Bright;
frontColored = CableBusTextures.PartStorageMonitor_Colored; frontColored = CableBusTextures.PartStorageMonitor_Colored;
frontDark = CableBusTextures.PartStorageMonitor_Dark; frontDark = CableBusTextures.PartStorageMonitor_Dark;
+2 -2
View File
@@ -30,7 +30,7 @@ public class PartTerminal extends PartMonitor implements ITerminalHost, IConfigM
AppEngInternalInventory viewCell = new AppEngInternalInventory( this, 5 ); AppEngInternalInventory viewCell = new AppEngInternalInventory( this, 5 );
public PartTerminal(Class clz, ItemStack is) { public PartTerminal(Class clz, ItemStack is) {
super( clz, is ); super( clz, is,true );
cm.registerSetting( Settings.SORT_BY, SortOrder.NAME ); cm.registerSetting( Settings.SORT_BY, SortOrder.NAME );
cm.registerSetting( Settings.VIEW_MODE, ViewItems.ALL ); cm.registerSetting( Settings.VIEW_MODE, ViewItems.ALL );
@@ -54,7 +54,7 @@ public class PartTerminal extends PartMonitor implements ITerminalHost, IConfigM
} }
public PartTerminal(ItemStack is) { public PartTerminal(ItemStack is) {
super( PartTerminal.class, is ); super( PartTerminal.class, is,true );
frontBright = CableBusTextures.PartTerminal_Bright; frontBright = CableBusTextures.PartTerminal_Bright;
frontColored = CableBusTextures.PartTerminal_Colored; frontColored = CableBusTextures.PartTerminal_Colored;
frontDark = CableBusTextures.PartTerminal_Dark; frontDark = CableBusTextures.PartTerminal_Dark;
+2
View File
@@ -380,6 +380,8 @@ public class TileIOPort extends AENetworkInvTile implements IUpgradeableHost, IC
} }
itemsToMove -= possible; itemsToMove -= possible;
didStuff = true;
break;
} }
} }
} }