diff --git a/dependencies.gradle b/dependencies.gradle index a755bcbf..af44108c 100644 --- a/dependencies.gradle +++ b/dependencies.gradle @@ -35,7 +35,7 @@ */ dependencies { api('com.github.GTNewHorizons:NotEnoughItems:2.4.13-GTNH:dev') - api('com.github.GTNewHorizons:Applied-Energistics-2-Unofficial:rv3-beta-303-GTNH:dev') + api('com.github.GTNewHorizons:Applied-Energistics-2-Unofficial:rv3-beta-304-GTNH:dev') api('curse.maven:cofh-core-69162:2388751') api('com.github.GTNewHorizons:waila:1.6.5:dev') @@ -45,7 +45,7 @@ dependencies { compileOnly('com.github.GTNewHorizons:ExtraCells2:2.5.34:dev') { transitive = false } compileOnly('com.github.GTNewHorizons:ForestryMC:4.7.0:dev') compileOnly('com.github.GTNewHorizons:EnderIO:2.5.8:dev') - compileOnly('com.github.GTNewHorizons:GT5-Unofficial:5.09.45.02:dev') { + compileOnly('com.github.GTNewHorizons:GT5-Unofficial:5.09.44.108:dev') { exclude group: 'com.github.GTNewHorizons', module: 'AE2FluidCraft-Rework' } compileOnly('thaumcraft:Thaumcraft:1.7.10-4.2.3.5:dev') diff --git a/src/main/java/com/glodblock/github/client/gui/GuiDualInterface.java b/src/main/java/com/glodblock/github/client/gui/GuiDualInterface.java index 5174f7e1..e8fcf374 100644 --- a/src/main/java/com/glodblock/github/client/gui/GuiDualInterface.java +++ b/src/main/java/com/glodblock/github/client/gui/GuiDualInterface.java @@ -17,6 +17,7 @@ import com.glodblock.github.util.NameConst; import appeng.api.config.AdvancedBlockingMode; import appeng.api.config.InsertionMode; +import appeng.api.config.LockCraftingMode; import appeng.api.config.Settings; import appeng.api.config.SidelessMode; import appeng.api.config.Upgrades; @@ -40,6 +41,7 @@ public class GuiDualInterface extends GuiUpgradeable { private GuiImgButton insertionMode; private GuiImgButton sidelessMode; private GuiImgButton advancedBlockingMode; + private GuiImgButton lockCraftingMode; private final IInterfaceHost host; public GuiDualInterface(InventoryPlayer inventoryPlayer, IInterfaceHost te) { @@ -103,6 +105,14 @@ public class GuiDualInterface extends GuiUpgradeable { SidelessMode.SIDELESS); this.buttonList.add(this.sidelessMode); } + + this.lockCraftingMode = new GuiImgButton( + this.guiLeft - 18, + this.guiTop + 98, + Settings.LOCK_CRAFTING_MODE, + LockCraftingMode.NONE); + this.lockCraftingMode.visible = this.bc.getInstalledUpgrades(Upgrades.LOCK_CRAFTING) > 0; + this.buttonList.add(lockCraftingMode); } @Override @@ -123,6 +133,9 @@ public class GuiDualInterface extends GuiUpgradeable { if (this.advancedBlockingMode != null) { this.advancedBlockingMode.set(((ContainerDualInterface) this.cvb).getAdvancedBlockingMode()); } + if (this.lockCraftingMode != null) { + this.lockCraftingMode.set(((ContainerInterface) this.cvb).getLockCraftingMode()); + } this.fontRendererObj.drawString( getGuiDisplayName(StatCollector.translateToLocal(NameConst.GUI_FLUID_INTERFACE)), 8, @@ -161,6 +174,8 @@ public class GuiDualInterface extends GuiUpgradeable { } else if (btn == this.advancedBlockingMode) { NetworkHandler.instance .sendToServer(new PacketConfigButton(this.advancedBlockingMode.getSetting(), backwards)); + } else if (btn == this.lockCraftingMode) { + NetworkHandler.instance.sendToServer(new PacketConfigButton(this.lockCraftingMode.getSetting(), backwards)); } } @@ -178,5 +193,8 @@ public class GuiDualInterface extends GuiUpgradeable { if (this.advancedBlockingMode != null) { this.advancedBlockingMode.setVisibility(this.bc.getInstalledUpgrades(Upgrades.ADVANCED_BLOCKING) > 0); } + if (this.lockCraftingMode != null) { + this.lockCraftingMode.setVisibility(this.bc.getInstalledUpgrades(Upgrades.LOCK_CRAFTING) > 0); + } } } diff --git a/src/main/java/com/glodblock/github/common/block/BlockFluidInterface.java b/src/main/java/com/glodblock/github/common/block/BlockFluidInterface.java index 70be3d5f..33007194 100644 --- a/src/main/java/com/glodblock/github/common/block/BlockFluidInterface.java +++ b/src/main/java/com/glodblock/github/common/block/BlockFluidInterface.java @@ -2,6 +2,7 @@ package com.glodblock.github.common.block; import java.util.EnumSet; +import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.world.World; @@ -61,6 +62,14 @@ public class BlockFluidInterface extends FCBaseBlock { return false; } + @Override + public void onNeighborBlockChange(World worldIn, int x, int y, int z, Block neighbor) { + TileFluidInterface tile = this.getTileEntity(worldIn, x, y, z); + if (tile != null) { + tile.getInterfaceDuality().updateRedstoneState(); + } + } + @Override protected boolean hasCustomRotation() { return true; diff --git a/src/main/java/com/glodblock/github/common/parts/PartFluidInterface.java b/src/main/java/com/glodblock/github/common/parts/PartFluidInterface.java index 8041fc44..3905ac0b 100644 --- a/src/main/java/com/glodblock/github/common/parts/PartFluidInterface.java +++ b/src/main/java/com/glodblock/github/common/parts/PartFluidInterface.java @@ -24,27 +24,19 @@ import com.glodblock.github.util.BlockPos; import com.glodblock.github.util.DualityFluidInterface; import com.glodblock.github.util.Util; -import appeng.api.config.Actionable; import appeng.api.config.Upgrades; import appeng.api.networking.IGridNode; -import appeng.api.networking.energy.IEnergyGrid; import appeng.api.networking.events.MENetworkChannelsChanged; import appeng.api.networking.events.MENetworkEventSubscribe; import appeng.api.networking.events.MENetworkPowerStatusChange; -import appeng.api.networking.security.BaseActionSource; -import appeng.api.networking.security.MachineSource; -import appeng.api.networking.storage.IStorageGrid; import appeng.api.networking.ticking.TickRateModulation; import appeng.api.networking.ticking.TickingRequest; import appeng.api.parts.IPartRenderHelper; -import appeng.api.storage.IMEMonitor; import appeng.api.storage.data.IAEFluidStack; import appeng.client.texture.CableBusTextures; -import appeng.me.GridAccessException; import appeng.parts.misc.PartInterface; import appeng.tile.inventory.AppEngInternalAEInventory; import appeng.util.Platform; -import appeng.util.item.AEFluidStack; import cpw.mods.fml.common.network.ByteBufUtils; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; @@ -52,7 +44,6 @@ import io.netty.buffer.ByteBuf; public class PartFluidInterface extends PartInterface implements IDualHost { - private final BaseActionSource ownActionSource = new MachineSource(this); private final AppEngInternalAEInventory config = new AppEngInternalAEInventory(this, 6); private final DualityFluidInterface fluidDuality = new DualityFluidInterface(this.getProxy(), this); @@ -201,35 +192,9 @@ public class PartFluidInterface extends PartInterface implements IDualHost { return getInterfaceDuality().getInstalledUpgrades(u); } - private IMEMonitor getFluidGrid() { - try { - return getProxy().getGrid().getCache(IStorageGrid.class).getFluidInventory(); - } catch (GridAccessException e) { - return null; - } - } - - private IEnergyGrid getEnergyGrid() { - try { - return getProxy().getGrid().getCache(IEnergyGrid.class); - } catch (GridAccessException e) { - return null; - } - } - @Override public int fill(ForgeDirection from, FluidStack resource, boolean doFill) { - IMEMonitor fluidGrid = getFluidGrid(); - IEnergyGrid energyGrid = getEnergyGrid(); - if (energyGrid == null || fluidGrid == null || resource == null) return 0; - int ori = resource.amount; - IAEFluidStack remove; - if (doFill) { - remove = fluidGrid.injectItems(AEFluidStack.create(resource), Actionable.MODULATE, ownActionSource); - } else { - remove = fluidGrid.injectItems(AEFluidStack.create(resource), Actionable.SIMULATE, ownActionSource); - } - return remove == null ? ori : (int) (ori - remove.getStackSize()); + return fluidDuality.fill(from, resource, doFill); } @Override @@ -244,12 +209,12 @@ public class PartFluidInterface extends PartInterface implements IDualHost { @Override public boolean canFill(ForgeDirection from, Fluid fluid) { - return true; + return fluidDuality.canFill(from, fluid); } @Override public boolean canDrain(ForgeDirection from, Fluid fluid) { - return true; + return fluidDuality.canDrain(from, fluid); } @Override diff --git a/src/main/java/com/glodblock/github/common/parts/PartFluidP2PInterface.java b/src/main/java/com/glodblock/github/common/parts/PartFluidP2PInterface.java index 08a82f08..a0d22124 100644 --- a/src/main/java/com/glodblock/github/common/parts/PartFluidP2PInterface.java +++ b/src/main/java/com/glodblock/github/common/parts/PartFluidP2PInterface.java @@ -38,14 +38,11 @@ import appeng.api.networking.IGridNode; import appeng.api.networking.crafting.ICraftingLink; import appeng.api.networking.crafting.ICraftingPatternDetails; import appeng.api.networking.crafting.ICraftingProviderHelper; -import appeng.api.networking.energy.IEnergyGrid; import appeng.api.networking.events.MENetworkChannelsChanged; import appeng.api.networking.events.MENetworkCraftingPatternChange; import appeng.api.networking.events.MENetworkEventSubscribe; import appeng.api.networking.events.MENetworkPowerStatusChange; import appeng.api.networking.security.BaseActionSource; -import appeng.api.networking.security.MachineSource; -import appeng.api.networking.storage.IStorageGrid; import appeng.api.networking.ticking.IGridTickable; import appeng.api.networking.ticking.TickRateModulation; import appeng.api.networking.ticking.TickingRequest; @@ -68,7 +65,6 @@ import appeng.tile.inventory.IAEAppEngInventory; import appeng.tile.inventory.InvOperation; import appeng.util.Platform; import appeng.util.inv.IInventoryDestination; -import appeng.util.item.AEFluidStack; public class PartFluidP2PInterface extends PartP2PTunnelStatic implements IGridTickable, IStorageMonitorable, IInventoryDestination, IDualHost, ISidedInventory, @@ -108,7 +104,6 @@ public class PartFluidP2PInterface extends PartP2PTunnelStatic getFluidGrid() { - try { - return getProxy().getGrid().getCache(IStorageGrid.class).getFluidInventory(); - } catch (GridAccessException e) { - return null; - } - } - - private IEnergyGrid getEnergyGrid() { - try { - return getProxy().getGrid().getCache(IEnergyGrid.class); - } catch (GridAccessException e) { - return null; - } - } - @Override public int fill(ForgeDirection from, FluidStack resource, boolean doFill) { - IMEMonitor fluidGrid = getFluidGrid(); - IEnergyGrid energyGrid = getEnergyGrid(); - if (energyGrid == null || fluidGrid == null || resource == null) return 0; - int ori = resource.amount; - IAEFluidStack remove; - if (doFill) { - remove = fluidGrid.injectItems(AEFluidStack.create(resource), Actionable.MODULATE, ownActionSource); - } else { - remove = fluidGrid.injectItems(AEFluidStack.create(resource), Actionable.SIMULATE, ownActionSource); - } - return remove == null ? ori : (int) (ori - remove.getStackSize()); + return dualityFluid.fill(from, resource, doFill); } @Override @@ -393,12 +367,12 @@ public class PartFluidP2PInterface extends PartP2PTunnelStatic