diff --git a/block/AEBaseItemBlock.java b/block/AEBaseItemBlock.java index ec82e74e9..934437aaa 100644 --- a/block/AEBaseItemBlock.java +++ b/block/AEBaseItemBlock.java @@ -123,7 +123,7 @@ public class AEBaseItemBlock extends ItemBlock 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 ); ori = tile; @@ -131,7 +131,7 @@ public class AEBaseItemBlock extends ItemBlock if ( tile == null ) return true; - if ( ori.canBeRotated() ) + if ( ori.canBeRotated() && !blockType.hasCustomRotation() ) { if ( ori.getForward() == null || ori.getUp() == null || // null tile.getForward() == ForgeDirection.UNKNOWN || ori.getUp() == ForgeDirection.UNKNOWN ) diff --git a/core/AELog.java b/core/AELog.java index 283021213..3c7956c7c 100644 --- a/core/AELog.java +++ b/core/AELog.java @@ -47,7 +47,7 @@ public class AELog { if ( AEConfig.instance.isFeatureEnabled( AEFeature.Logging ) ) { - severe( "Error: " + e.getMessage() ); + severe( "Error: " + e.getClass().getName() + " : " + e.getMessage() ); e.printStackTrace(); } } diff --git a/core/sync/GuiBridge.java b/core/sync/GuiBridge.java index 081eb2dd0..ea4555452 100644 --- a/core/sync/GuiBridge.java +++ b/core/sync/GuiBridge.java @@ -201,7 +201,15 @@ public enum GuiBridge implements IGuiHandler Constructor[] c = Container.getConstructors(); if ( c.length == 0 ) 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) { @@ -217,7 +225,14 @@ public enum GuiBridge implements IGuiHandler if ( c.length == 0 ) 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) { @@ -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) { for (Constructor con : c) @@ -232,7 +255,7 @@ public enum GuiBridge implements IGuiHandler Class[] types = con.getParameterTypes(); 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; } } diff --git a/helpers/DualityInterface.java b/helpers/DualityInterface.java index c7d7d7911..45985e3e4 100644 --- a/helpers/DualityInterface.java +++ b/helpers/DualityInterface.java @@ -156,6 +156,12 @@ public class DualityInterface implements IGridTickable, ISegmentedInventory, ISt private void updatePlan(int slot) { IAEItemStack req = config.getAEStackInSlot( slot ); + if ( req != null && req.getStackSize() <= 0 ) + { + config.setInventorySlotContents(slot, null); + req = null; + } + ItemStack Stored = storage.getStackInSlot( slot ); if ( req == null && Stored != null ) @@ -242,7 +248,7 @@ public class DualityInterface implements IGridTickable, ISegmentedInventory, ISt changed = true; ItemStack issue = adaptor.addItems( aquired.getItemStack() ); 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 ) @@ -263,9 +269,9 @@ public class DualityInterface implements IGridTickable, ISegmentedInventory, ISt changed = true; ItemStack removed = adaptor.removeItems( (int) diff, null, 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 ) - throw new RuntimeException( "bad attempt at managining inventory. ( addItems )" ); + throw new RuntimeException( "bad attempt at managing inventory. ( addItems )" ); } } // else wtf? diff --git a/me/cache/GridStorageCache.java b/me/cache/GridStorageCache.java index 5802bb2cb..34c842ef3 100644 --- a/me/cache/GridStorageCache.java +++ b/me/cache/GridStorageCache.java @@ -80,7 +80,7 @@ public class GridStorageCache implements IStorageGrid private void rmvCell(IGridNode node, ICellContainer cc) { - if ( node.isActive() && activeCellContainers.contains( cc ) ) + if ( activeCellContainers.contains( cc ) ) { inactiveCellContainers.add( cc ); activeCellContainers.remove( cc ); diff --git a/parts/p2p/PartP2PIC2Power.java b/parts/p2p/PartP2PIC2Power.java index 170022500..578b7d8d3 100644 --- a/parts/p2p/PartP2PIC2Power.java +++ b/parts/p2p/PartP2PIC2Power.java @@ -131,6 +131,15 @@ public class PartP2PIC2Power extends PartP2PTunnel implements i Options.add( o ); } + if ( Options.isEmpty() ) + { + for (PartP2PIC2Power o : outs) + Options.add( o ); + } + + if ( Options.isEmpty() ) + return amount; + PartP2PIC2Power x = (PartP2PIC2Power) Platform.pickRandom( Options ); if ( x != null && x.OutputPacket <= 0.001 ) { diff --git a/parts/reporting/PartCraftingMonitor.java b/parts/reporting/PartCraftingMonitor.java index ef947769f..6158b8a81 100644 --- a/parts/reporting/PartCraftingMonitor.java +++ b/parts/reporting/PartCraftingMonitor.java @@ -7,7 +7,7 @@ public class PartCraftingMonitor extends PartMonitor { public PartCraftingMonitor(ItemStack is) { - super( PartCraftingMonitor.class, is ); + super( PartCraftingMonitor.class, is,true ); frontBright = CableBusTextures.PartCraftingMonitor_Bright; frontColored = CableBusTextures.PartCraftingMonitor_Colored; frontDark = CableBusTextures.PartCraftingMonitor_Dark; diff --git a/parts/reporting/PartDarkMonitor.java b/parts/reporting/PartDarkMonitor.java index 475aad3eb..dfbb7b30c 100644 --- a/parts/reporting/PartDarkMonitor.java +++ b/parts/reporting/PartDarkMonitor.java @@ -13,7 +13,7 @@ public class PartDarkMonitor extends PartMonitor { public PartDarkMonitor(ItemStack is) { - super( PartDarkMonitor.class, is ); + super( PartDarkMonitor.class, is,false ); notLightSource = false; } diff --git a/parts/reporting/PartMonitor.java b/parts/reporting/PartMonitor.java index 4e09269c4..abbeff5e3 100644 --- a/parts/reporting/PartMonitor.java +++ b/parts/reporting/PartMonitor.java @@ -114,9 +114,10 @@ public class PartMonitor extends AEBasePart implements IPartMonitor, IPowerChann super( PartMonitor.class, is ); } - protected PartMonitor(Class c, ItemStack is) { + protected PartMonitor(Class c, ItemStack is, boolean requireChannel ) { super( c, is ); - if ( notLightSource ) + + if ( requireChannel ) proxy.setFlags( GridFlags.REQUIRE_CHANNEL ); else proxy.setIdlePowerUsage( 1.0 / 16.0 ); // lights drain a little bit. diff --git a/parts/reporting/PartPatternTerminal.java b/parts/reporting/PartPatternTerminal.java index e019a9015..acbc14b66 100644 --- a/parts/reporting/PartPatternTerminal.java +++ b/parts/reporting/PartPatternTerminal.java @@ -46,7 +46,7 @@ public class PartPatternTerminal extends PartTerminal implements IAEAppEngInvent } public PartPatternTerminal(ItemStack is) { - super( PartPatternTerminal.class, is ); + super( PartPatternTerminal.class, is, true ); frontBright = CableBusTextures.PartPatternTerm_Bright; frontColored = CableBusTextures.PartPatternTerm_Colored; frontDark = CableBusTextures.PartPatternTerm_Dark; diff --git a/parts/reporting/PartSemiDarkMonitor.java b/parts/reporting/PartSemiDarkMonitor.java index 8fb2f1266..0e9c898f3 100644 --- a/parts/reporting/PartSemiDarkMonitor.java +++ b/parts/reporting/PartSemiDarkMonitor.java @@ -13,8 +13,7 @@ public class PartSemiDarkMonitor extends PartMonitor { public PartSemiDarkMonitor(ItemStack is) { - super( PartSemiDarkMonitor.class, is ); - + super( PartSemiDarkMonitor.class, is,false ); notLightSource = false; } diff --git a/parts/reporting/PartStorageMonitor.java b/parts/reporting/PartStorageMonitor.java index d502fd57e..7d8899dc1 100644 --- a/parts/reporting/PartStorageMonitor.java +++ b/parts/reporting/PartStorageMonitor.java @@ -150,11 +150,11 @@ public class PartStorageMonitor extends PartMonitor implements IPartStorageMonit } protected PartStorageMonitor(Class myClass, ItemStack is) { - super( myClass, is ); + super( myClass, is,true ); } public PartStorageMonitor(ItemStack is) { - super( PartStorageMonitor.class, is ); + super( PartStorageMonitor.class, is,true ); frontBright = CableBusTextures.PartStorageMonitor_Bright; frontColored = CableBusTextures.PartStorageMonitor_Colored; frontDark = CableBusTextures.PartStorageMonitor_Dark; diff --git a/parts/reporting/PartTerminal.java b/parts/reporting/PartTerminal.java index 5e0be23e3..11806c66a 100644 --- a/parts/reporting/PartTerminal.java +++ b/parts/reporting/PartTerminal.java @@ -30,7 +30,7 @@ public class PartTerminal extends PartMonitor implements ITerminalHost, IConfigM AppEngInternalInventory viewCell = new AppEngInternalInventory( this, 5 ); public PartTerminal(Class clz, ItemStack is) { - super( clz, is ); + super( clz, is,true ); cm.registerSetting( Settings.SORT_BY, SortOrder.NAME ); cm.registerSetting( Settings.VIEW_MODE, ViewItems.ALL ); @@ -54,7 +54,7 @@ public class PartTerminal extends PartMonitor implements ITerminalHost, IConfigM } public PartTerminal(ItemStack is) { - super( PartTerminal.class, is ); + super( PartTerminal.class, is,true ); frontBright = CableBusTextures.PartTerminal_Bright; frontColored = CableBusTextures.PartTerminal_Colored; frontDark = CableBusTextures.PartTerminal_Dark; diff --git a/tile/storage/TileIOPort.java b/tile/storage/TileIOPort.java index b82d334f2..832bdefe7 100644 --- a/tile/storage/TileIOPort.java +++ b/tile/storage/TileIOPort.java @@ -380,6 +380,8 @@ public class TileIOPort extends AENetworkInvTile implements IUpgradeableHost, IC } itemsToMove -= possible; + didStuff = true; + break; } } }