This commit is contained in:
AlgorithmX2 2014-04-09 20:12:49 -05:00
commit 01c76a6870
14 changed files with 61 additions and 21 deletions

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 ( 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 )

View file

@ -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();
}
}

View file

@ -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;
}
}

View file

@ -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?

View file

@ -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 );

View file

@ -131,6 +131,15 @@ public class PartP2PIC2Power extends PartP2PTunnel<PartP2PIC2Power> 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 )
{

View file

@ -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;

View file

@ -13,7 +13,7 @@ public class PartDarkMonitor extends PartMonitor
{
public PartDarkMonitor(ItemStack is) {
super( PartDarkMonitor.class, is );
super( PartDarkMonitor.class, is,false );
notLightSource = false;
}

View file

@ -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.

View file

@ -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;

View file

@ -13,8 +13,7 @@ public class PartSemiDarkMonitor extends PartMonitor
{
public PartSemiDarkMonitor(ItemStack is) {
super( PartSemiDarkMonitor.class, is );
super( PartSemiDarkMonitor.class, is,false );
notLightSource = false;
}

View file

@ -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;

View file

@ -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;

View file

@ -380,6 +380,8 @@ public class TileIOPort extends AENetworkInvTile implements IUpgradeableHost, IC
}
itemsToMove -= possible;
didStuff = true;
break;
}
}
}