diff --git a/client/gui/AEBaseGui.java b/client/gui/AEBaseGui.java index 61faf8334..ee2fc94be 100644 --- a/client/gui/AEBaseGui.java +++ b/client/gui/AEBaseGui.java @@ -214,26 +214,29 @@ public abstract class AEBaseGui extends GuiContainer if ( Keyboard.isKeyDown( Keyboard.KEY_SPACE ) ) { - IAEItemStack stack = null; - if ( slot instanceof SlotME ) - stack = ((SlotME) slot).getAEStack(); - - try + if ( enableSpaceClicking() ) { - int slotNum = inventorySlots.inventorySlots.size(); + IAEItemStack stack = null; + if ( slot instanceof SlotME ) + stack = ((SlotME) slot).getAEStack(); - if ( !(slot instanceof SlotME) && slot != null ) - slotNum = slot.slotNumber; + try + { + int slotNum = inventorySlots.inventorySlots.size(); - ((AEBaseContainer) inventorySlots).setTargetStack( stack ); - PacketInventoryAction p = new PacketInventoryAction( InventoryAction.MOVE_REGION, slotNum, null ); - NetworkHandler.instance.sendToServer( p ); + if ( !(slot instanceof SlotME) && slot != null ) + slotNum = slot.slotNumber; + + ((AEBaseContainer) inventorySlots).setTargetStack( stack ); + PacketInventoryAction p = new PacketInventoryAction( InventoryAction.MOVE_REGION, slotNum, null ); + NetworkHandler.instance.sendToServer( p ); + } + catch (IOException e) + { + AELog.error( e ); + } + return; } - catch (IOException e) - { - AELog.error( e ); - } - return; } if ( slot instanceof SlotME ) @@ -297,6 +300,11 @@ public abstract class AEBaseGui extends GuiContainer super.handleMouseClick( slot, slotIdx, ctrlDown, key ); } + protected boolean enableSpaceClicking() + { + return true; + } + @Override protected boolean checkHotbarKeys(int p_146983_1_) { diff --git a/client/gui/implementations/GuiSkyChest.java b/client/gui/implementations/GuiSkyChest.java index 8e0e9836f..5e3c0cc25 100644 --- a/client/gui/implementations/GuiSkyChest.java +++ b/client/gui/implementations/GuiSkyChest.java @@ -3,6 +3,7 @@ package appeng.client.gui.implementations; import net.minecraft.entity.player.InventoryPlayer; import appeng.client.gui.AEBaseGui; import appeng.container.implementations.ContainerSkyChest; +import appeng.core.AppEng; import appeng.core.localization.GuiText; import appeng.tile.storage.TileSkyChest; @@ -28,4 +29,10 @@ public class GuiSkyChest extends AEBaseGui fontRendererObj.drawString( GuiText.inventory.getLocal(), 8, ySize - 96 + 2, 4210752 ); } + @Override + protected boolean enableSpaceClicking() + { + return !AppEng.instance.isIntegrationEnabled( "InvTweaks" ); + } + } diff --git a/helpers/MeteoritePlacer.java b/helpers/MeteoritePlacer.java index 3047b7d63..943600f9f 100644 --- a/helpers/MeteoritePlacer.java +++ b/helpers/MeteoritePlacer.java @@ -325,31 +325,52 @@ public class MeteoritePlacer InventoryAdaptor ap = InventoryAdaptor.getAdaptor( te, ForgeDirection.UP ); int primary = Math.max( 1, (int) (Math.random() * 4) ); + + if ( primary > 3 ) // in case math breaks... + primary = 3; + for (int zz = 0; zz < primary; zz++) { int r = 0; + boolean duplicate = false; - if ( Math.random() > 0.7 ) - r = WorldSettings.getInstance().getNextOrderedValue( "presses" ); - else - r = (int) (Math.random() * 1000); - - switch (r % 4) + do { - case 0: - ap.addItems( AEApi.instance().materials().materialCalcProcessorPress.stack( 1 ) ); - break; - case 1: - ap.addItems( AEApi.instance().materials().materialEngProcessorPress.stack( 1 ) ); - break; - case 2: - ap.addItems( AEApi.instance().materials().materialLogicProcessorPress.stack( 1 ) ); - break; - case 3: - ap.addItems( AEApi.instance().materials().materialSiliconPress.stack( 1 ) ); - break; - default: + duplicate = false; + + if ( Math.random() > 0.7 ) + r = WorldSettings.getInstance().getNextOrderedValue( "presses" ); + else + r = (int) (Math.random() * 1000); + + ItemStack toAdd = null; + + switch (r % 4) + { + case 0: + toAdd = AEApi.instance().materials().materialCalcProcessorPress.stack( 1 ); + break; + case 1: + toAdd = AEApi.instance().materials().materialEngProcessorPress.stack( 1 ); + break; + case 2: + toAdd = AEApi.instance().materials().materialLogicProcessorPress.stack( 1 ); + break; + case 3: + toAdd = AEApi.instance().materials().materialSiliconPress.stack( 1 ); + break; + default: + } + + if ( toAdd != null ) + { + if ( ap.simulateRemove( 1, toAdd, null ) == null ) + ap.addItems( toAdd ); + else + duplicate = true; + } } + while (duplicate); } int secondary = Math.max( 1, (int) (Math.random() * 3) ); diff --git a/integration/modules/InvTweaks.java b/integration/modules/InvTweaks.java index dc506b6ed..b82161271 100644 --- a/integration/modules/InvTweaks.java +++ b/integration/modules/InvTweaks.java @@ -4,20 +4,19 @@ import invtweaks.api.InvTweaksAPI; import net.minecraft.item.ItemStack; import appeng.integration.BaseModule; import appeng.integration.abstraction.IInvTweaks; -import cpw.mods.fml.common.Mod.Instance; +import cpw.mods.fml.common.Loader; public class InvTweaks extends BaseModule implements IInvTweaks { public static InvTweaks instance; - @Instance("inventorytweaks") static InvTweaksAPI api; @Override public void Init() { - + api = (InvTweaksAPI) Loader.instance().getIndexedModList().get( "inventorytweaks" ).getMod(); } @Override diff --git a/me/cache/EnergyGridCache.java b/me/cache/EnergyGridCache.java index a2a9e739d..addb8ea0f 100644 --- a/me/cache/EnergyGridCache.java +++ b/me/cache/EnergyGridCache.java @@ -162,7 +162,7 @@ public class EnergyGridCache implements IEnergyGrid @Override public double getEnergyDemand(double maxRequired) { - double required = 0; + double required = buffer() - extra; Iterator it = requesters.iterator(); while (required < maxRequired && it.hasNext()) { diff --git a/me/cluster/implementations/QuantumCluster.java b/me/cluster/implementations/QuantumCluster.java index 1300dac5f..e9b9831a6 100644 --- a/me/cluster/implementations/QuantumCluster.java +++ b/me/cluster/implementations/QuantumCluster.java @@ -29,6 +29,7 @@ public class QuantumCluster implements ILocatable, IAECluster public WorldCoord min; public WorldCoord max; public boolean isDestroyed = false; + private boolean updateStatus = true; boolean registered = false; private long thisSide; @@ -85,6 +86,7 @@ public class QuantumCluster implements ILocatable, IAECluster { if ( center.getWorldObj() == e.world ) { + updateStatus = false; destroy(); } } @@ -209,11 +211,14 @@ public class QuantumCluster implements ILocatable, IAECluster MinecraftForge.EVENT_BUS.post( new LocatableEventAnnounce( this, LocatableEvent.Unregister ) ); } - center.updateStatus( null, (byte) -1 ); - - for (TileQuantumBridge r : Ring) + if ( updateStatus ) { - r.updateStatus( null, (byte) -1 ); + center.updateStatus( null, (byte) -1 ); + + for (TileQuantumBridge r : Ring) + { + r.updateStatus( null, (byte) -1 ); + } } center = null; diff --git a/transformer/asm/ASMIntegration.java b/transformer/asm/ASMIntegration.java index 58725878c..64215be45 100644 --- a/transformer/asm/ASMIntegration.java +++ b/transformer/asm/ASMIntegration.java @@ -41,7 +41,6 @@ public class ASMIntegration implements IClassTransformer // integrationModules.add( IntegrationSide.BOTH, "Greg Tech", "gregtech_addon", "GT" ); // integrationModules.add( IntegrationSide.BOTH, "Universal Electricity", null, "UE" ); // integrationModules.add( IntegrationSide.BOTH, "Logistics Pipes", "LogisticsPipes|Main", "LP" ); - integrationModules.add( IntegrationSide.CLIENT, "Inventory Tweaks", "", "InvTweaks" ); integrationModules.add( IntegrationSide.BOTH, "Mine Factory Reloaded", "MineFactoryReloaded", "MFR" ); integrationModules.add( IntegrationSide.BOTH, "Deep Storage Unit", null, "DSU" ); // integrationModules.add( IntegrationSide.BOTH, "Better Storage", "betterstorage" );