Skip to content

Commit

Permalink
Merge remote-tracking branch 'Cardinalstars/master' into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
Dream-Master committed Jan 10, 2024
2 parents 1d020ba + fa4830a commit fea6255
Show file tree
Hide file tree
Showing 5 changed files with 56 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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());
}
}
}
}
Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -401,6 +401,11 @@ public List<IAEFluidStack> getContents() {
return ret;
}

@Override
public IInventory getUpgradesInventory() {
return this.cellType.getUpgradesInventory(this.cellItem);
}

@Override
public StorageChannel getChannel() {
return StorageChannel.FLUIDS;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -39,6 +41,25 @@ protected FluidCellInventoryHandler(final IMEInventory<IAEFluidStack> 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);
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,4 +86,9 @@ public interface IFluidCellInventory extends IMEInventory<IAEFluidStack> {
long getTotalFluidTypes();

List<IAEFluidStack> getContents();

/**
* @return access installed upgrades.
*/
IInventory getUpgradesInventory();
}
19 changes: 19 additions & 0 deletions src/main/java/com/glodblock/github/proxy/CommonProxy.java
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit fea6255

Please sign in to comment.