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 d84738739..e63c78f57 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 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 void addCheckedInformation(final ItemStack stack, final EntityPlayer play 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 void addCheckedInformation(final ItemStack stack, final EntityPlayer play } else { lines.add(StatCollector.translateToLocal(NameConst.TT_SHIFT_FOR_MORE)); } + if (handler.getSticky()) { + lines.add(GuiText.Sticky.getLocal()); + } } } } @@ -187,7 +190,7 @@ public boolean isEditable(ItemStack is) { @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 758661710..bf6396af0 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 List getContents() { 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 fd8b903ae..c82356deb 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 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 @@ protected FluidCellInventoryHandler(final IMEInventory c) { 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 f19ea2f7e..486591792 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 d264fa523..3fe85f13c 100644 --- a/src/main/java/com/glodblock/github/proxy/CommonProxy.java +++ b/src/main/java/com/glodblock/github/proxy/CommonProxy.java @@ -149,6 +149,25 @@ public void postInit(FMLPostInitializationEvent event) { 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);