From 82a8e2d045e075fd4623260ff942f544bf4a22b5 Mon Sep 17 00:00:00 2001 From: AlgorithmX2 Date: Sat, 24 May 2014 11:02:24 -0500 Subject: [PATCH 1/7] Fixed http://openeye.openmods.info/crashes/df3cca6850f2c037b6adb8d8d641b22f Improved Exception for http://openeye.openmods.info/crashes/d2df850ad1915a015a80f9f7cef56ac3 Improved Exception for http://openeye.openmods.info/crashes/c8a3f70288f017726c5acd09ea91a2b0 --- parts/CableBusContainer.java | 35 +++++++++++++++++++---------------- 1 file changed, 19 insertions(+), 16 deletions(-) diff --git a/parts/CableBusContainer.java b/parts/CableBusContainer.java index 83241f364..d7b2e43a7 100644 --- a/parts/CableBusContainer.java +++ b/parts/CableBusContainer.java @@ -170,25 +170,28 @@ public class CableBusContainer implements AEMultiTile, ICableBusContainer is.stackSize = 1; IPart bp = bi.createPartFromItemStack( is ); - if ( bp instanceof IPartCable ) + if ( bp != null ) { - boolean canPlace = true; - for (ForgeDirection d : ForgeDirection.VALID_DIRECTIONS) - if ( getPart( d ) != null && !getPart( d ).canBePlacedOn( ((IPartCable) bp).supportsBuses() ) ) - canPlace = false; + if ( bp instanceof IPartCable ) + { + boolean canPlace = true; + for (ForgeDirection d : ForgeDirection.VALID_DIRECTIONS) + if ( getPart( d ) != null && !getPart( d ).canBePlacedOn( ((IPartCable) bp).supportsBuses() ) ) + canPlace = false; - if ( !canPlace ) - return false; + if ( !canPlace ) + return false; - return getPart( ForgeDirection.UNKNOWN ) == null; - } - else if ( !(bp instanceof IPartCable) && side != ForgeDirection.UNKNOWN ) - { - IPart cable = getPart( ForgeDirection.UNKNOWN ); - if ( cable != null && !bp.canBePlacedOn( ((IPartCable) cable).supportsBuses() ) ) - return false; + return getPart( ForgeDirection.UNKNOWN ) == null; + } + else if ( !(bp instanceof IPartCable) && side != ForgeDirection.UNKNOWN ) + { + IPart cable = getPart( ForgeDirection.UNKNOWN ); + if ( cable != null && !bp.canBePlacedOn( ((IPartCable) cable).supportsBuses() ) ) + return false; - return getPart( side ) == null; + return getPart( side ) == null; + } } } return false; @@ -701,7 +704,7 @@ public class CableBusContainer implements AEMultiTile, ICableBusContainer p.readFromNBT( extra ); } else - throw new RuntimeException( "Invalid NBT For CableBus Container." ); + throw new RuntimeException( "Invalid NBT For CableBus Container: " + iss.getItem().getClass().getName() + " is not a valid part." ); } } else From d5cfa12f76ededfb87a3d9276069480fd66ba2b1 Mon Sep 17 00:00:00 2001 From: AlgorithmX2 Date: Sat, 24 May 2014 18:22:50 -0500 Subject: [PATCH 2/7] Added Energy Cells Charge levels to Waila --- client/gui/AEBaseGui.java | 36 ---------------- .../gui/implementations/GuiNetworkStatus.java | 12 +++--- .../gui/implementations/GuiSpatialIOPort.java | 7 +-- integration/modules/Waila.java | 15 +++++++ util/Platform.java | 43 +++++++++++++++++++ 5 files changed, 68 insertions(+), 45 deletions(-) diff --git a/client/gui/AEBaseGui.java b/client/gui/AEBaseGui.java index 3b4975273..f12fe7399 100644 --- a/client/gui/AEBaseGui.java +++ b/client/gui/AEBaseGui.java @@ -1,7 +1,6 @@ package appeng.client.gui; import java.io.IOException; -import java.text.DecimalFormat; import java.util.Collection; import java.util.Iterator; import java.util.LinkedList; @@ -24,7 +23,6 @@ import org.lwjgl.input.Mouse; import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.GL12; -import appeng.api.config.PowerUnits; import appeng.api.storage.data.IAEItemStack; import appeng.client.gui.widgets.GuiScrollbar; import appeng.client.gui.widgets.ITooltip; @@ -42,7 +40,6 @@ import appeng.container.slot.SlotFake; import appeng.container.slot.SlotInaccessable; import appeng.container.slot.SlotOutput; import appeng.container.slot.SlotRestrictedInput; -import appeng.core.AEConfig; import appeng.core.AELog; import appeng.core.AppEng; import appeng.core.sync.network.NetworkHandler; @@ -59,39 +56,6 @@ public abstract class AEBaseGui extends GuiContainer protected List meSlots = new LinkedList(); protected GuiScrollbar myScrollBar = null; - protected String formatPowerLong(long n, boolean isRate) - { - double p = ((double) n) / 100; - - PowerUnits displayUnits = AEConfig.instance.selectedPowerUnit(); - p = PowerUnits.AE.convertTo( displayUnits, p ); - - int offset = 0; - String Lvl = ""; - String preFixes[] = new String[] { "k", "M", "G", "T", "P", "T", "P", "E", "Z", "Y" }; - String unitName = displayUnits.name(); - - if ( displayUnits == PowerUnits.WA ) - unitName = "J"; - - if ( displayUnits == PowerUnits.KJ ) - { - Lvl = preFixes[offset]; - unitName = "J"; - offset++; - } - - while (p > 1000 && offset < preFixes.length) - { - p /= 1000; - Lvl = preFixes[offset]; - offset++; - } - - DecimalFormat df = new DecimalFormat( "#.##" ); - return df.format( p ) + " " + Lvl + unitName + (isRate ? "/t" : ""); - } - public AEBaseGui(Container container) { super( container ); } diff --git a/client/gui/implementations/GuiNetworkStatus.java b/client/gui/implementations/GuiNetworkStatus.java index c20a7202c..c1319d04a 100644 --- a/client/gui/implementations/GuiNetworkStatus.java +++ b/client/gui/implementations/GuiNetworkStatus.java @@ -138,11 +138,11 @@ public class GuiNetworkStatus extends AEBaseGui implements ISortSource fontRendererObj.drawString( GuiText.NetworkDetails.getLocal(), 8, 6, 4210752 ); - fontRendererObj.drawString( GuiText.StoredPower.getLocal() + ": " + formatPowerLong( ns.currentPower, false ), 13, 16, 4210752 ); - fontRendererObj.drawString( GuiText.MaxPower.getLocal() + ": " + formatPowerLong( ns.maxPower, false ), 13, 26, 4210752 ); + fontRendererObj.drawString( GuiText.StoredPower.getLocal() + ": " + Platform.formatPowerLong( ns.currentPower, false ), 13, 16, 4210752 ); + fontRendererObj.drawString( GuiText.MaxPower.getLocal() + ": " + Platform.formatPowerLong( ns.maxPower, false ), 13, 26, 4210752 ); - fontRendererObj.drawString( GuiText.PowerInputRate.getLocal() + ": " + formatPowerLong( ns.avgAddition, true ), 13, 143 - 10, 4210752 ); - fontRendererObj.drawString( GuiText.PowerUsageRate.getLocal() + ": " + formatPowerLong( ns.powerUsage, true ), 13, 143 - 20, 4210752 ); + fontRendererObj.drawString( GuiText.PowerInputRate.getLocal() + ": " + Platform.formatPowerLong( ns.avgAddition, true ), 13, 143 - 10, 4210752 ); + fontRendererObj.drawString( GuiText.PowerUsageRate.getLocal() + ": " + Platform.formatPowerLong( ns.powerUsage, true ), 13, 143 - 20, 4210752 ); int sectionLength = 30; @@ -183,7 +183,7 @@ public class GuiNetworkStatus extends AEBaseGui implements ISortSource ToolTip = ToolTip + ("\n" + GuiText.Installed.getLocal() + ": " + (refStack.getStackSize())); if ( refStack.getCountRequestable() > 0 ) - ToolTip = ToolTip + ("\n" + GuiText.EnergyDrain.getLocal() + ": " + formatPowerLong( refStack.getCountRequestable(), true )); + ToolTip = ToolTip + ("\n" + GuiText.EnergyDrain.getLocal() + ": " + Platform.formatPowerLong( refStack.getCountRequestable(), true )); toolPosX = x * sectionLength + xo + sectionLength - 8; toolPosY = y * 18 + yo; @@ -266,7 +266,7 @@ public class GuiNetworkStatus extends AEBaseGui implements ISortSource currenttip.remove( 1 ); currenttip.add( GuiText.Installed.getLocal() + ": " + (myStack.getStackSize()) ); - currenttip.add( GuiText.EnergyDrain.getLocal() + ": " + formatPowerLong( myStack.getCountRequestable(), true ) ); + currenttip.add( GuiText.EnergyDrain.getLocal() + ": " + Platform.formatPowerLong( myStack.getCountRequestable(), true ) ); drawTooltip( x, y, 0, join( currenttip, "\n" ) ); } diff --git a/client/gui/implementations/GuiSpatialIOPort.java b/client/gui/implementations/GuiSpatialIOPort.java index f66deb75e..7905624db 100644 --- a/client/gui/implementations/GuiSpatialIOPort.java +++ b/client/gui/implementations/GuiSpatialIOPort.java @@ -12,6 +12,7 @@ import appeng.container.implementations.ContainerSpatialIOPort; import appeng.core.AEConfig; import appeng.core.localization.GuiText; import appeng.tile.spatial.TileSpatialIOPort; +import appeng.util.Platform; public class GuiSpatialIOPort extends AEBaseGui { @@ -58,9 +59,9 @@ public class GuiSpatialIOPort extends AEBaseGui @Override public void drawFG(int offsetX, int offsetY, int mouseX, int mouseY) { - fontRendererObj.drawString( GuiText.StoredPower.getLocal() + ": " + formatPowerLong( csiop.currentPower, false ), 13, 21, 4210752 ); - fontRendererObj.drawString( GuiText.MaxPower.getLocal() + ": " + formatPowerLong( csiop.maxPower, false ), 13, 31, 4210752 ); - fontRendererObj.drawString( GuiText.RequiredPower.getLocal() + ": " + formatPowerLong( csiop.reqPower, false ), 13, 78, 4210752 ); + fontRendererObj.drawString( GuiText.StoredPower.getLocal() + ": " + Platform.formatPowerLong( csiop.currentPower, false ), 13, 21, 4210752 ); + fontRendererObj.drawString( GuiText.MaxPower.getLocal() + ": " + Platform.formatPowerLong( csiop.maxPower, false ), 13, 31, 4210752 ); + fontRendererObj.drawString( GuiText.RequiredPower.getLocal() + ": " + Platform.formatPowerLong( csiop.reqPower, false ), 13, 78, 4210752 ); fontRendererObj.drawString( GuiText.Efficiency.getLocal() + ": " + (((float) csiop.eff) / 100) + "%", 13, 88, 4210752 ); fontRendererObj.drawString( getGuiDisplayName( GuiText.SpatialIOPort.getLocal() ), 8, 6, 4210752 ); diff --git a/integration/modules/Waila.java b/integration/modules/Waila.java index 18fc485c6..07d5da1e0 100644 --- a/integration/modules/Waila.java +++ b/integration/modules/Waila.java @@ -8,6 +8,7 @@ import mcp.mobius.waila.api.IWailaDataProvider; import mcp.mobius.waila.api.IWailaRegistrar; import net.minecraft.inventory.IInventory; import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.MovingObjectPosition; import net.minecraft.util.Vec3; @@ -25,6 +26,8 @@ import appeng.core.AppEng; import appeng.core.localization.WailaText; import appeng.integration.BaseModule; import appeng.tile.misc.TileCharger; +import appeng.tile.networking.TileEnergyCell; +import appeng.util.Platform; import cpw.mods.fml.common.event.FMLInterModComms; public class Waila extends BaseModule implements IWailaDataProvider @@ -90,6 +93,18 @@ public class Waila extends BaseModule implements IWailaDataProvider } } + if ( ThingOfInterest instanceof TileEnergyCell ) + { + NBTTagCompound c = accessor.getNBTData(); + if ( c != null ) + { + TileEnergyCell tec = (TileEnergyCell) ThingOfInterest; + long power = (long) (100 * c.getDouble( "internalCurrentPower" )); + currenttip.add( WailaText.Contains + ": " + Platform.formatPowerLong( power, false ) + " / " + + Platform.formatPowerLong( (long) (100 * tec.getAEMaxPower()), false ) ); + } + } + if ( ThingOfInterest instanceof IPartStorageMonitor ) { IPartStorageMonitor psm = (IPartStorageMonitor) ThingOfInterest; diff --git a/util/Platform.java b/util/Platform.java index 5e29ab5b2..063774935 100644 --- a/util/Platform.java +++ b/util/Platform.java @@ -1,6 +1,7 @@ package appeng.util; import java.lang.reflect.Field; +import java.text.DecimalFormat; import java.util.ArrayList; import java.util.Collection; import java.util.EnumSet; @@ -52,6 +53,7 @@ import appeng.api.config.AccessRestriction; import appeng.api.config.Actionable; import appeng.api.config.FuzzyMode; import appeng.api.config.PowerMultiplier; +import appeng.api.config.PowerUnits; import appeng.api.config.SearchBoxMode; import appeng.api.config.SecurityPermissions; import appeng.api.config.SortOrder; @@ -78,6 +80,7 @@ import appeng.api.storage.data.IAEStack; import appeng.api.storage.data.IAETagCompound; import appeng.api.storage.data.IItemList; import appeng.api.util.AEItemDefinition; +import appeng.core.AEConfig; import appeng.core.AELog; import appeng.core.AppEng; import appeng.core.sync.GuiBridge; @@ -127,6 +130,46 @@ public class Platform return rdnSrc.nextFloat(); } + /** + * This displays the value for encoded longs ( double *100 ) + * + * @param n + * @param isRate + * @return + */ + public static String formatPowerLong(long n, boolean isRate) + { + double p = ((double) n) / 100; + + PowerUnits displayUnits = AEConfig.instance.selectedPowerUnit(); + p = PowerUnits.AE.convertTo( displayUnits, p ); + + int offset = 0; + String Lvl = ""; + String preFixes[] = new String[] { "k", "M", "G", "T", "P", "T", "P", "E", "Z", "Y" }; + String unitName = displayUnits.name(); + + if ( displayUnits == PowerUnits.WA ) + unitName = "J"; + + if ( displayUnits == PowerUnits.KJ ) + { + Lvl = preFixes[offset]; + unitName = "J"; + offset++; + } + + while (p > 1000 && offset < preFixes.length) + { + p /= 1000; + Lvl = preFixes[offset]; + offset++; + } + + DecimalFormat df = new DecimalFormat( "#.##" ); + return df.format( p ) + " " + Lvl + unitName + (isRate ? "/t" : ""); + } + public static ForgeDirection crossProduct(ForgeDirection forward, ForgeDirection up) { int west_x = forward.offsetY * up.offsetZ - forward.offsetZ * up.offsetY; From 1b207a17e9fba7dade75ea9f3905ef8462a18127 Mon Sep 17 00:00:00 2001 From: AlgorithmX2 Date: Sat, 24 May 2014 18:23:23 -0500 Subject: [PATCH 3/7] API Update. --- core/features/registries/ExternalStorageRegistry.java | 7 ++++--- core/features/registries/entries/ExternalIInv.java | 2 +- integration/modules/BCHelpers/BCPipeHandler.java | 2 +- integration/modules/helpers/FactorizationHandler.java | 2 +- integration/modules/helpers/MFRDSUHandler.java | 2 +- me/storage/AEExternalHandler.java | 4 ++-- parts/misc/PartStorageBus.java | 2 +- 7 files changed, 11 insertions(+), 10 deletions(-) diff --git a/core/features/registries/ExternalStorageRegistry.java b/core/features/registries/ExternalStorageRegistry.java index b1fcc0f27..c7efc2583 100644 --- a/core/features/registries/ExternalStorageRegistry.java +++ b/core/features/registries/ExternalStorageRegistry.java @@ -5,6 +5,7 @@ import java.util.List; import net.minecraft.tileentity.TileEntity; import net.minecraftforge.common.util.ForgeDirection; +import appeng.api.networking.security.BaseActionSource; import appeng.api.storage.IExternalStorageHandler; import appeng.api.storage.IExternalStorageRegistry; import appeng.api.storage.StorageChannel; @@ -21,15 +22,15 @@ public class ExternalStorageRegistry implements IExternalStorageRegistry } @Override - public IExternalStorageHandler getHandler(TileEntity te, ForgeDirection d, StorageChannel chan) + public IExternalStorageHandler getHandler(TileEntity te, ForgeDirection d, StorageChannel chan, BaseActionSource mySrc) { for (IExternalStorageHandler x : Handlers) { - if ( x.canHandle( te, d, chan ) ) + if ( x.canHandle( te, d, chan, mySrc ) ) return x; } - if ( lastHandler.canHandle( te, d, chan ) ) + if ( lastHandler.canHandle( te, d, chan, mySrc ) ) return lastHandler; return null; diff --git a/core/features/registries/entries/ExternalIInv.java b/core/features/registries/entries/ExternalIInv.java index 166d93094..2efe69955 100644 --- a/core/features/registries/entries/ExternalIInv.java +++ b/core/features/registries/entries/ExternalIInv.java @@ -14,7 +14,7 @@ public class ExternalIInv implements IExternalStorageHandler { @Override - public boolean canHandle(TileEntity te, ForgeDirection d, StorageChannel channel) + public boolean canHandle(TileEntity te, ForgeDirection d, StorageChannel channel, BaseActionSource mySrc) { return channel == StorageChannel.ITEMS && te instanceof IInventory; } diff --git a/integration/modules/BCHelpers/BCPipeHandler.java b/integration/modules/BCHelpers/BCPipeHandler.java index 4d4a76e22..13c0edd9e 100644 --- a/integration/modules/BCHelpers/BCPipeHandler.java +++ b/integration/modules/BCHelpers/BCPipeHandler.java @@ -12,7 +12,7 @@ public class BCPipeHandler implements IExternalStorageHandler { @Override - public boolean canHandle(TileEntity te, ForgeDirection d, StorageChannel chan) + public boolean canHandle(TileEntity te, ForgeDirection d, StorageChannel chan, BaseActionSource mySrc) { return chan == StorageChannel.ITEMS && BC.instance.isPipe( te, d ); } diff --git a/integration/modules/helpers/FactorizationHandler.java b/integration/modules/helpers/FactorizationHandler.java index 903a6e0c2..7eaea5102 100644 --- a/integration/modules/helpers/FactorizationHandler.java +++ b/integration/modules/helpers/FactorizationHandler.java @@ -14,7 +14,7 @@ public class FactorizationHandler implements IExternalStorageHandler { @Override - public boolean canHandle(TileEntity te, ForgeDirection d, StorageChannel chan) + public boolean canHandle(TileEntity te, ForgeDirection d, StorageChannel chan, BaseActionSource mySrc) { return chan == StorageChannel.ITEMS && FZ.instance.isBarrel( te ); } diff --git a/integration/modules/helpers/MFRDSUHandler.java b/integration/modules/helpers/MFRDSUHandler.java index 11aa7bb0c..a8c297b4a 100644 --- a/integration/modules/helpers/MFRDSUHandler.java +++ b/integration/modules/helpers/MFRDSUHandler.java @@ -14,7 +14,7 @@ public class MFRDSUHandler implements IExternalStorageHandler { @Override - public boolean canHandle(TileEntity te, ForgeDirection d, StorageChannel chan) + public boolean canHandle(TileEntity te, ForgeDirection d, StorageChannel chan, BaseActionSource mySrc) { return chan == StorageChannel.ITEMS && DSU.instance.isDSU( te ); } diff --git a/me/storage/AEExternalHandler.java b/me/storage/AEExternalHandler.java index de03ba4f6..4edd5fcdb 100644 --- a/me/storage/AEExternalHandler.java +++ b/me/storage/AEExternalHandler.java @@ -16,10 +16,10 @@ public class AEExternalHandler implements IExternalStorageHandler { @Override - public boolean canHandle(TileEntity te, ForgeDirection d, StorageChannel channel) + public boolean canHandle(TileEntity te, ForgeDirection d, StorageChannel channel, BaseActionSource mySrc) { if ( channel == StorageChannel.ITEMS && te instanceof ITileStorageMonitorable ) - return true; + return ((ITileStorageMonitorable) te).getMonitorable( d, mySrc ) != null; return te instanceof TileCondenser; } diff --git a/parts/misc/PartStorageBus.java b/parts/misc/PartStorageBus.java index e2ef5c16b..8c0d2371e 100644 --- a/parts/misc/PartStorageBus.java +++ b/parts/misc/PartStorageBus.java @@ -241,7 +241,7 @@ public class PartStorageBus extends PartUpgradeable implements IGridTickable, IC monitor = null; if ( target != null ) { - IExternalStorageHandler esh = AEApi.instance().registries().externalStorage().getHandler( target, side.getOpposite(), StorageChannel.ITEMS ); + IExternalStorageHandler esh = AEApi.instance().registries().externalStorage().getHandler( target, side.getOpposite(), StorageChannel.ITEMS, mySrc ); if ( esh != null ) { IMEInventory inv = esh.getInventory( target, side.getOpposite(), StorageChannel.ITEMS, mySrc ); From aa6d05af2e9d8ef5fbe1247cd6236ebaa8b07abb Mon Sep 17 00:00:00 2001 From: AlgorithmX2 Date: Sat, 24 May 2014 18:23:40 -0500 Subject: [PATCH 4/7] Fixed a potential crash when picking up items. --- container/AEBaseContainer.java | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/container/AEBaseContainer.java b/container/AEBaseContainer.java index ec595a52e..59c65e8d8 100644 --- a/container/AEBaseContainer.java +++ b/container/AEBaseContainer.java @@ -809,9 +809,14 @@ public abstract class AEBaseContainer extends Container long maxSize = ais.getItemStack().getMaxStackSize(); ais.setStackSize( maxSize ); ais = cellInv.extractItems( ais, Actionable.SIMULATE, mySrc ); - long stackSize = Math.min( maxSize, ais.getStackSize() ); - ais.setStackSize( (stackSize + 1) >> 1 ); - ais = Platform.poweredExtraction( powerSrc, cellInv, ais, mySrc ); + + if ( ais != null ) + { + long stackSize = Math.min( maxSize, ais.getStackSize() ); + ais.setStackSize( (stackSize + 1) >> 1 ); + ais = Platform.poweredExtraction( powerSrc, cellInv, ais, mySrc ); + } + if ( ais != null ) player.inventory.setItemStack( ais.getItemStack() ); else From a861f09b01a5bf50f786745929d0754ac546ea14 Mon Sep 17 00:00:00 2001 From: AlgorithmX2 Date: Sat, 24 May 2014 18:25:22 -0500 Subject: [PATCH 5/7] ME Chest insertion behavior fixed. ME Chest drive slot now properly accessible from front drive face. ME Chests can now function as tanks. ( fluid cells from extra cells ) ME Chests now return an empty slot list when they have no storage cells ( thus disconnecting from pipes. ) Fixed https://github.com/M3gaFr3ak/ExtraCells2/issues/18 --- tile/storage/TileChest.java | 43 ++++++++++++++++++++++++++++--------- 1 file changed, 33 insertions(+), 10 deletions(-) diff --git a/tile/storage/TileChest.java b/tile/storage/TileChest.java index bc22dc251..2acb5cc92 100644 --- a/tile/storage/TileChest.java +++ b/tile/storage/TileChest.java @@ -78,6 +78,7 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, IFluidHan static final int sides[] = new int[] { 0 }; static final int front[] = new int[] { 1 }; + static final int noslots[] = new int[] {}; AppEngInternalInventory inv = new AppEngInternalInventory( this, 2 ); BaseActionSource mySrc = new MachineSource( this ); @@ -479,25 +480,47 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, IFluidHan @Override public boolean canInsertItem(int i, ItemStack itemstack, int j) { - try + if ( i == 1 ) { - IMEInventory cell = getHandler( StorageChannel.ITEMS ); - IAEItemStack returns = cell.injectItems( AEApi.instance().storage().createItemStack( inv.getStackInSlot( 0 ) ), Actionable.SIMULATE, mySrc ); - return returns == null || returns.getStackSize() != itemstack.stackSize; + if ( AEApi.instance().registries().cell().getCellInventory( itemstack, StorageChannel.ITEMS ) != null ) + return true; + if ( AEApi.instance().registries().cell().getCellInventory( itemstack, StorageChannel.FLUIDS ) != null ) + return true; } - catch (ChestNoHandler t) + else { + try + { + IMEInventory cell = getHandler( StorageChannel.ITEMS ); + IAEItemStack returns = cell.injectItems( AEApi.instance().storage().createItemStack( inv.getStackInSlot( 0 ) ), Actionable.SIMULATE, mySrc ); + return returns == null || returns.getStackSize() != itemstack.stackSize; + } + catch (ChestNoHandler t) + { + } } - return false; } @Override public int[] getAccessibleSlotsBySide(ForgeDirection side) { - if ( side == getForward() ) + if ( ForgeDirection.SOUTH == side ) return front; - return sides; + + if ( gridProxy.isActive() ) + { + try + { + if ( getHandler( StorageChannel.ITEMS ) != null ) + return sides; + } + catch (ChestNoHandler e) + { + // nope! + } + } + return noslots; } @Override @@ -652,7 +675,7 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, IFluidHan { IMEInventoryHandler h = getHandler( StorageChannel.FLUIDS ); if ( h.getChannel() == StorageChannel.FLUIDS ) - return new FluidTankInfo[] { new FluidTankInfo( null ) }; // eh? + return new FluidTankInfo[] { new FluidTankInfo( null, 1 ) }; // eh? } catch (ChestNoHandler e) { @@ -708,7 +731,7 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, IFluidHan @Override public IStorageMonitorable getMonitorable(ForgeDirection side, BaseActionSource src) { - if ( Platform.canAccess( gridProxy, src ) ) + if ( Platform.canAccess( gridProxy, src ) && side != getForward() ) return this; return null; } From baefedc4b885de45d2c9805be5c1d75ea9ac030b Mon Sep 17 00:00:00 2001 From: AlgorithmX2 Date: Sat, 24 May 2014 23:49:24 -0500 Subject: [PATCH 6/7] ME Chest can have its drive removed via automation via the front slot. --- tile/storage/TileChest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tile/storage/TileChest.java b/tile/storage/TileChest.java index 2acb5cc92..d24394a6d 100644 --- a/tile/storage/TileChest.java +++ b/tile/storage/TileChest.java @@ -474,7 +474,7 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, IFluidHan @Override public boolean canExtractItem(int i, ItemStack itemstack, int j) { - return false; + return i == 1; } @Override From 8f474b8baf09c7d02449c796c31bc53b0cae7fd1 Mon Sep 17 00:00:00 2001 From: AlgorithmX2 Date: Sat, 24 May 2014 23:55:13 -0500 Subject: [PATCH 7/7] Fixed http://openeye.openmods.info/crashes/e9ee0132c58b39e5d6b41983e239b77f Fixed http://openeye.openmods.info/crashes/90d72b392a1e968ef7dab98f5a65d1d8 --- block/networking/BlockCableBus.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/block/networking/BlockCableBus.java b/block/networking/BlockCableBus.java index a135bba6c..886e2d183 100644 --- a/block/networking/BlockCableBus.java +++ b/block/networking/BlockCableBus.java @@ -277,13 +277,15 @@ public class BlockCableBus extends AEBaseBlock private ICableBusContainer cb(IBlockAccess w, int x, int y, int z) { TileEntity te = w.getTileEntity( x, y, z ); + ICableBusContainer out = null; + if ( te instanceof TileCableBus ) - return ((TileCableBus) te).cb; + out = ((TileCableBus) te).cb; - if ( AppEng.instance.isIntegrationEnabled( "FMP" ) ) - return ((IFMP) AppEng.instance.getIntegration( "FMP" )).getCableContainer( te ); + else if ( AppEng.instance.isIntegrationEnabled( "FMP" ) ) + out = ((IFMP) AppEng.instance.getIntegration( "FMP" )).getCableContainer( te ); - return nullCB; + return out == null ? nullCB : out; } /**