From b3e480a6cb7d669d18ca9470b872c80001219627 Mon Sep 17 00:00:00 2001 From: Ryan Nasers <42074409+Cardinalstars@users.noreply.github.com> Date: Fri, 12 Jan 2024 15:18:05 -0600 Subject: [PATCH 1/2] Adding fluids to sticky card (#190) * Adding sticky support for AE2-FC * Spotless whoopsies --- .../github/common/item/FCBaseItemCell.java | 9 +++++--- .../common/storage/FluidCellInventory.java | 5 +++++ .../storage/FluidCellInventoryHandler.java | 21 +++++++++++++++++++ .../common/storage/IFluidCellInventory.java | 5 +++++ .../glodblock/github/proxy/CommonProxy.java | 19 +++++++++++++++++ 5 files changed, 56 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/glodblock/github/common/item/FCBaseItemCell.java b/src/main/java/com/glodblock/github/common/item/FCBaseItemCell.java index d8473873..e63c78f5 100644 --- a/src/main/java/com/glodblock/github/common/item/FCBaseItemCell.java +++ b/src/main/java/com/glodblock/github/common/item/FCBaseItemCell.java @@ -16,8 +16,8 @@ import net.minecraftforge.common.util.ForgeDirection; import com.glodblock.github.api.FluidCraftAPI; import com.glodblock.github.common.storage.CellType; +import com.glodblock.github.common.storage.FluidCellInventoryHandler; import com.glodblock.github.common.storage.IFluidCellInventory; -import com.glodblock.github.common.storage.IFluidCellInventoryHandler; import com.glodblock.github.common.storage.IStorageFluidCell; import com.glodblock.github.loader.ItemAndBlockHolder; import com.glodblock.github.util.NameConst; @@ -96,7 +96,7 @@ public abstract class FCBaseItemCell extends AEBaseItem implements IStorageFluid final IMEInventoryHandler inventory = AEApi.instance().registries().cell() .getCellInventory(stack, null, StorageChannel.FLUIDS); - if (inventory instanceof final IFluidCellInventoryHandler handler) { + if (inventory instanceof final FluidCellInventoryHandler handler) { final IFluidCellInventory cellInventory = handler.getCellInv(); if (cellInventory != null) { @@ -155,6 +155,9 @@ public abstract class FCBaseItemCell extends AEBaseItem implements IStorageFluid } else { lines.add(StatCollector.translateToLocal(NameConst.TT_SHIFT_FOR_MORE)); } + if (handler.getSticky()) { + lines.add(GuiText.Sticky.getLocal()); + } } } } @@ -187,7 +190,7 @@ public abstract class FCBaseItemCell extends AEBaseItem implements IStorageFluid @Override public IInventory getUpgradesInventory(ItemStack is) { - return new CellUpgrades(is, 0); + return new CellUpgrades(is, 2); } @Override diff --git a/src/main/java/com/glodblock/github/common/storage/FluidCellInventory.java b/src/main/java/com/glodblock/github/common/storage/FluidCellInventory.java index 4bd476c5..100a753a 100644 --- a/src/main/java/com/glodblock/github/common/storage/FluidCellInventory.java +++ b/src/main/java/com/glodblock/github/common/storage/FluidCellInventory.java @@ -401,6 +401,11 @@ public class FluidCellInventory implements IFluidCellInventory { return ret; } + @Override + public IInventory getUpgradesInventory() { + return this.cellType.getUpgradesInventory(this.cellItem); + } + @Override public StorageChannel getChannel() { return StorageChannel.FLUIDS; diff --git a/src/main/java/com/glodblock/github/common/storage/FluidCellInventoryHandler.java b/src/main/java/com/glodblock/github/common/storage/FluidCellInventoryHandler.java index fd8b903a..c82356de 100644 --- a/src/main/java/com/glodblock/github/common/storage/FluidCellInventoryHandler.java +++ b/src/main/java/com/glodblock/github/common/storage/FluidCellInventoryHandler.java @@ -8,6 +8,8 @@ import com.glodblock.github.util.Util; import appeng.api.AEApi; import appeng.api.config.IncludeExclude; +import appeng.api.config.Upgrades; +import appeng.api.implementations.items.IUpgradeModule; import appeng.api.storage.ICellCacheRegistry; import appeng.api.storage.IMEInventory; import appeng.api.storage.StorageChannel; @@ -39,6 +41,25 @@ public class FluidCellInventoryHandler extends MEInventoryHandler if (!priorityList.isEmpty()) { this.setPartitionList(new PrecisePriorityList<>(priorityList)); } + + final IInventory upgrades = ci.getUpgradesInventory(); + boolean hasSticky = false; + + for (int x = 0; x < upgrades.getSizeInventory(); x++) { + final ItemStack is = upgrades.getStackInSlot(x); + if (is != null && is.getItem() instanceof IUpgradeModule) { + final Upgrades u = ((IUpgradeModule) is.getItem()).getType(is); + if (u != null) { + if (u == Upgrades.STICKY) { + hasSticky = true; + } + } + } + } + + if (hasSticky) { + setSticky(true); + } } } diff --git a/src/main/java/com/glodblock/github/common/storage/IFluidCellInventory.java b/src/main/java/com/glodblock/github/common/storage/IFluidCellInventory.java index f19ea2f7..48659179 100644 --- a/src/main/java/com/glodblock/github/common/storage/IFluidCellInventory.java +++ b/src/main/java/com/glodblock/github/common/storage/IFluidCellInventory.java @@ -86,4 +86,9 @@ public interface IFluidCellInventory extends IMEInventory { long getTotalFluidTypes(); List getContents(); + + /** + * @return access installed upgrades. + */ + IInventory getUpgradesInventory(); } diff --git a/src/main/java/com/glodblock/github/proxy/CommonProxy.java b/src/main/java/com/glodblock/github/proxy/CommonProxy.java index aa936425..792304b1 100644 --- a/src/main/java/com/glodblock/github/proxy/CommonProxy.java +++ b/src/main/java/com/glodblock/github/proxy/CommonProxy.java @@ -61,6 +61,25 @@ public class CommonProxy { Upgrades.LOCK_CRAFTING.registerItem(new ItemStack(ItemAndBlockHolder.FLUID_INTERFACE_P2P), 1); Upgrades.CAPACITY.registerItem(new ItemStack(ItemAndBlockHolder.FLUID_STORAGE_BUS), 5); Upgrades.INVERTER.registerItem(new ItemStack(ItemAndBlockHolder.FLUID_STORAGE_BUS), 1); + + Upgrades.STICKY.registerItem(new ItemStack(ItemAndBlockHolder.CELL1K), 1); + Upgrades.STICKY.registerItem(new ItemStack(ItemAndBlockHolder.CELL4K), 1); + Upgrades.STICKY.registerItem(new ItemStack(ItemAndBlockHolder.CELL16K), 1); + Upgrades.STICKY.registerItem(new ItemStack(ItemAndBlockHolder.CELL64K), 1); + Upgrades.STICKY.registerItem(new ItemStack(ItemAndBlockHolder.CELL256K), 1); + Upgrades.STICKY.registerItem(new ItemStack(ItemAndBlockHolder.CELL1024K), 1); + Upgrades.STICKY.registerItem(new ItemStack(ItemAndBlockHolder.CELL4096K), 1); + Upgrades.STICKY.registerItem(new ItemStack(ItemAndBlockHolder.CELL16384K), 1); + + Upgrades.STICKY.registerItem(new ItemStack(ItemAndBlockHolder.CELL1KM), 1); + Upgrades.STICKY.registerItem(new ItemStack(ItemAndBlockHolder.CELL4KM), 1); + Upgrades.STICKY.registerItem(new ItemStack(ItemAndBlockHolder.CELL16KM), 1); + Upgrades.STICKY.registerItem(new ItemStack(ItemAndBlockHolder.CELL64KM), 1); + Upgrades.STICKY.registerItem(new ItemStack(ItemAndBlockHolder.CELL256KM), 1); + Upgrades.STICKY.registerItem(new ItemStack(ItemAndBlockHolder.CELL1024KM), 1); + Upgrades.STICKY.registerItem(new ItemStack(ItemAndBlockHolder.CELL4096KM), 1); + Upgrades.STICKY.registerItem(new ItemStack(ItemAndBlockHolder.CELL16384KM), 1); + if (Config.fluidIOBus) { Upgrades.CAPACITY.registerItem(new ItemStack(ItemAndBlockHolder.FLUID_EXPORT_BUS), 2); Upgrades.CAPACITY.registerItem(new ItemStack(ItemAndBlockHolder.FLUID_IMPORT_BUS), 2); From e3cc9352b1b4aee4ca341b6ba09df4cf1b75fd5a Mon Sep 17 00:00:00 2001 From: Martin Robertz Date: Fri, 12 Jan 2024 23:19:17 +0100 Subject: [PATCH 2/2] update deps --- dependencies.gradle | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/dependencies.gradle b/dependencies.gradle index 16751ab7..1827ccba 100644 --- a/dependencies.gradle +++ b/dependencies.gradle @@ -37,11 +37,11 @@ dependencies { api('com.github.GTNewHorizons:NotEnoughItems:2.5.4-GTNH:dev') api('com.github.GTNewHorizons:Applied-Energistics-2-Unofficial:rv3-beta-310-GTNH:dev') api('curse.maven:cofh-core-69162:2388751') - api('com.github.GTNewHorizons:waila:1.6.5:dev') + api('com.github.GTNewHorizons:waila:1.7.0:dev') implementation("com.github.GTNewHorizons:WirelessCraftingTerminal:1.11.0:dev") - compileOnly('com.github.GTNewHorizons:Baubles:1.0.3:dev') + compileOnly('com.github.GTNewHorizons:Baubles:1.0.4:dev') compileOnly('com.github.GTNewHorizons:ExtraCells2:2.5.34:dev') { transitive = false } compileOnly('com.github.GTNewHorizons:ForestryMC:4.8.2:dev') compileOnly('com.github.GTNewHorizons:EnderIO:2.6.3:dev') @@ -51,7 +51,7 @@ dependencies { compileOnly('thaumcraft:Thaumcraft:1.7.10-4.2.3.5:dev') compileOnly('com.gregoriust.gregtech:gregtech_1.7.10:6.14.23:dev') { transitive = false } compileOnly('com.github.GTNewHorizons:OpenComputers:1.10.6-GTNH:dev') { transitive = false } - compileOnly('com.github.GTNewHorizons:ThaumicEnergistics:1.6.1-GTNH:dev') { transitive = false } + compileOnly('com.github.GTNewHorizons:ThaumicEnergistics:1.6.2-GTNH:dev') { transitive = false } compileOnly("com.github.GTNewHorizons:Hodgepodge:2.4.8:dev") { transitive = false } runtimeOnlyNonPublishable("com.github.GTNewHorizons:DuraDisplay:1.2.0:dev")