always use fluid packet for partition (#310)

Co-authored-by: boubou19 <miisterunknown@gmail.com>
This commit is contained in:
lc-1337andboubou19 authored and GitHub committed 2025-06-19 08:45:08 +00:00
1 parent 88c5b6be72
commit dffd8e07e0
7 files changed
+44 -10

No files matched your search

@@ -20,6 +20,7 @@ import com.glodblock.github.common.storage.CellType;
import com.glodblock.github.common.storage.FluidCellInventory;
import com.glodblock.github.common.storage.FluidCellInventoryHandler;
import com.glodblock.github.common.storage.IStorageFluidCell;
import com.glodblock.github.inventory.FluidCellConfig;
import com.glodblock.github.loader.ItemAndBlockHolder;
import com.glodblock.github.util.NameConst;
import com.google.common.base.Optional;
@@ -36,7 +37,6 @@ import appeng.core.features.AEFeature;
import appeng.core.localization.GuiText;
import appeng.helpers.ICellRestriction;
import appeng.items.AEBaseItem;
import appeng.items.contents.CellConfig;
import appeng.items.contents.CellUpgrades;
import appeng.util.InventoryAdaptor;
import appeng.util.IterationCounter;
@@ -208,7 +208,7 @@ public abstract class FCBaseItemCell extends AEBaseItem implements IStorageFluid
@Override
public IInventory getConfigInventory(ItemStack is) {
return new CellConfig(is);
return new FluidCellConfig(is);
}
@Override
@@ -8,12 +8,12 @@ import net.minecraft.item.ItemStack;
import com.glodblock.github.FluidCraft;
import com.glodblock.github.common.storage.IStorageFluidCell;
import com.glodblock.github.common.tabs.FluidCraftingTabs;
import com.glodblock.github.inventory.FluidCellConfig;
import com.glodblock.github.loader.IRegister;
import com.glodblock.github.util.NameConst;
import appeng.api.config.FuzzyMode;
import appeng.core.features.AEFeature;
import appeng.items.contents.CellConfig;
import appeng.util.Platform;
import cpw.mods.fml.common.registry.GameRegistry;
@@ -30,7 +30,7 @@ public class ItemCreativeFluidStorageCell extends ItemBaseInfinityStorageCell
@Override
public IInventory getConfigInventory(ItemStack is) {
return new CellConfig(is);
return new FluidCellConfig(is);
}
@Override
@@ -14,6 +14,7 @@ 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.common.tabs.FluidCraftingTabs;
import com.glodblock.github.inventory.FluidCellConfig;
import com.glodblock.github.loader.IRegister;
import com.glodblock.github.util.NameConst;
@@ -25,7 +26,6 @@ import appeng.api.storage.data.IAEFluidStack;
import appeng.core.features.AEFeature;
import appeng.core.localization.GuiText;
import appeng.items.AEBaseItem;
import appeng.items.contents.CellConfig;
import appeng.items.contents.CellUpgrades;
import appeng.util.Platform;
import cpw.mods.fml.common.registry.GameRegistry;
@@ -116,7 +116,7 @@ public class ItemFluidVoidStorageCell extends AEBaseItem
@Override
public IInventory getConfigInventory(ItemStack is) {
return new CellConfig(is);
return new FluidCellConfig(is);
}
@Override
@@ -20,6 +20,7 @@ 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.common.tabs.FluidCraftingTabs;
import com.glodblock.github.inventory.FluidCellConfig;
import com.glodblock.github.inventory.InventoryHandler;
import com.glodblock.github.inventory.gui.GuiType;
import com.glodblock.github.inventory.item.IItemInventory;
@@ -37,7 +38,6 @@ import appeng.api.storage.StorageChannel;
import appeng.api.storage.data.IAEFluidStack;
import appeng.core.features.AEFeature;
import appeng.core.localization.GuiText;
import appeng.items.contents.CellConfig;
import appeng.items.contents.CellUpgrades;
import appeng.items.tools.powered.powersink.AEBasePoweredItem;
import appeng.util.Platform;
@@ -163,7 +163,7 @@ public class ItemPortableFluidCell extends AEBasePoweredItem
@Override
public IInventory getConfigInventory(final ItemStack is) {
return new CellConfig(is);
return new FluidCellConfig(is);
}
@Override
@@ -6,6 +6,7 @@ import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fluids.FluidStack;
import com.glodblock.github.common.item.ItemFluidPacket;
import com.glodblock.github.util.Ae2Reflect;
import com.glodblock.github.util.Util;
@@ -42,6 +43,12 @@ public class FluidCellInventoryHandler extends MEInventoryHandler<IAEFluidStack>
AEFluidStack stack = AEFluidStack.create(fluid);
stack.setStackSize(1);
priorityList.add(stack);
// convert partition on cells in network
if (!(is.getItem() instanceof ItemFluidPacket)) {
config.setInventorySlotContents(x, ItemFluidPacket.newDisplayStack(fluid));
config.markDirty();
}
}
}
if (!priorityList.isEmpty()) {
@@ -6,10 +6,10 @@ import net.minecraft.item.ItemStack;
import com.glodblock.github.api.FluidCraftAPI;
import com.glodblock.github.common.storage.IStorageFluidCell;
import com.glodblock.github.crossmod.extracells.ProxyItem;
import com.glodblock.github.inventory.FluidCellConfig;
import appeng.api.config.FuzzyMode;
import appeng.api.storage.data.IAEFluidStack;
import appeng.items.contents.CellConfig;
import appeng.items.contents.CellUpgrades;
import appeng.util.Platform;
@@ -88,7 +88,7 @@ public class ProxyFluidStorageCell extends ProxyItem implements IStorageFluidCel
@Override
public IInventory getConfigInventory(ItemStack is) {
return new CellConfig(is);
return new FluidCellConfig(is);
}
@Override
@@ -0,0 +1,27 @@
package com.glodblock.github.inventory;
import net.minecraft.item.ItemStack;
import com.glodblock.github.common.item.ItemFluidPacket;
import com.glodblock.github.util.Util;
import appeng.items.contents.CellConfig;
public class FluidCellConfig extends CellConfig {
public FluidCellConfig(ItemStack is) {
super(is);
}
@Override
public void setInventorySlotContents(int slot, ItemStack newItemStack) {
if (newItemStack != null && !(newItemStack.getItem() instanceof ItemFluidPacket)) {
ItemStack fluidPacket = ItemFluidPacket.newDisplayStack(Util.getFluidFromItem(newItemStack));
if (fluidPacket != null) {
super.setInventorySlotContents(slot, fluidPacket);
return;
}
}
super.setInventorySlotContents(slot, newItemStack);
}
}