Add mappings for most important Extra Cells items (#115)

* EC2 deprecation: Part 1 - Items

Laying the groundwork for absorbing EC2 mappings.

* EC2 deprecation: Part 2 - Blocks

* EC2 Deprecation: Part 3 - Parts

Parts are deprecated.

* set config "replaceEC2" to default true

* API changes to make room for Extra Cells fluid placeholder

* Finish basic item replacement code

- parts work
- items are remapped properly, and converted when they enter the player inventory

* Fixed some storage cell conversion issues

The placeholders did not transfer NBT data properly

* Add handlers for deprecated item cells

Now the placeholder should work automatically in a drive.

The void cell is still a WIP.

* Add more tooltip help and cell handler for void cell

* apply spotless

too lazy to rebase
This commit is contained in:
firenoo authored and GitHub committed 2023-05-01 19:42:52 +02:00
1 parent 6090f198e6
commit dab5a0dbf3
28 files changed
+1457 -18

No files matched your search

@@ -19,6 +19,7 @@ public class Config {
public static double portableCellBattery;
public static int packetSize;
public static int packetRate;
public static boolean replaceEC2;
public static void run() {
loadCategory();
@@ -60,6 +61,11 @@ public class Config {
.get("Fluid Craft for AE2", "packetRate", 50, "Period at which packets are dispatched, in ms.")
.getInt();
if (packetRate <= 0) packetRate = 50;
replaceEC2 = Config.getBoolean(
"Fluid Craft for AE2",
"replaceEC2",
true,
"Set true to handle missing item mappings from EC2. Note to work properly, you must have all relevant parts.");
if (Config.hasChanged()) Config.save();
}
@@ -175,7 +175,7 @@ public abstract class FCBaseItemCell extends AEBaseItem implements IStorageFluid
}
@Override
public double getIdleDrain() {
public double getIdleDrain(ItemStack is) {
return this.idleDrain;
}
@@ -71,7 +71,7 @@ public class ItemCreativeFluidStorageCell extends AEBaseItem
}
@Override
public double getIdleDrain() {
public double getIdleDrain(ItemStack is) {
return 0;
}
@@ -150,7 +150,7 @@ public class ItemPortableFluidCell extends AEBasePoweredItem
}
@Override
public double getIdleDrain() {
public double getIdleDrain(ItemStack is) {
return 0.5;
}
@@ -69,6 +69,6 @@ public class FluidCellHandler implements ICellHandler {
@Override
public double cellIdleDrain(final ItemStack is, final IMEInventory handler) {
final IFluidCellInventory inv = ((IFluidCellInventoryHandler) handler).getCellInv();
return inv.getIdleDrain();
return inv.getIdleDrain(is);
}
}
@@ -23,23 +23,25 @@ import appeng.util.Platform;
import appeng.util.item.AEFluidStack;
import com.glodblock.github.common.item.ItemCreativeFluidStorageCell;
import com.glodblock.github.crossmod.extracells.storage.ProxyFluidCellInventory;
import com.glodblock.github.crossmod.extracells.storage.ProxyFluidStorageCell;
public class FluidCellInventory implements IFluidCellInventory {
private static final String FLUID_TYPE_TAG = "ft";
private static final String FLUID_COUNT_TAG = "fc";
private static final String FLUID_SLOT = "#";
private static final String FLUID_SLOT_COUNT = "@";
protected static final String FLUID_TYPE_TAG = "ft";
protected static final String FLUID_COUNT_TAG = "fc";
protected static final String FLUID_SLOT = "#";
protected static final String FLUID_SLOT_COUNT = "@";
protected IStorageFluidCell cellType;
private static String[] fluidSlots;
private static String[] fluidSlotCount;
protected static String[] fluidSlots;
protected static String[] fluidSlotCount;
protected final ItemStack cellItem;
private final ISaveProvider container;
private final int MAX_TYPE = 63;
private long storedFluidCount;
private short storedFluids;
protected long storedFluidCount;
protected short storedFluids;
protected IItemList<IAEFluidStack> cellFluids;
private final NBTTagCompound tagCompound;
protected final NBTTagCompound tagCompound;
public static final int singleByteAmount = 256 * 8;
public FluidCellInventory(final ItemStack o, final ISaveProvider container) throws AppEngException {
@@ -80,6 +82,8 @@ public class FluidCellInventory implements IFluidCellInventory {
try {
if (o.getItem() instanceof ItemCreativeFluidStorageCell) {
return new FluidCellInventoryHandler(new CreativeFluidCellInventory(o, container2));
} else if (o.getItem() instanceof ProxyFluidStorageCell) {
return new FluidCellInventoryHandler(new ProxyFluidCellInventory(o, container2));
} else {
return new FluidCellInventoryHandler(new FluidCellInventory(o, container2));
}
@@ -105,8 +109,8 @@ public class FluidCellInventory implements IFluidCellInventory {
}
@Override
public double getIdleDrain() {
return this.cellType.getIdleDrain();
public double getIdleDrain(ItemStack is) {
return this.cellType.getIdleDrain(is);
}
@Override
@@ -19,7 +19,7 @@ import com.glodblock.github.util.Util;
public class FluidCellInventoryHandler extends MEInventoryHandler<IAEFluidStack> implements IFluidCellInventoryHandler {
FluidCellInventoryHandler(final IMEInventory<IAEFluidStack> c) {
protected FluidCellInventoryHandler(final IMEInventory<IAEFluidStack> c) {
super(c, StorageChannel.FLUIDS);
final IFluidCellInventory ci = this.getCellInv();
@@ -18,7 +18,7 @@ public interface IFluidCellInventory extends IMEInventory<IAEFluidStack> {
/**
* @return idle cost for this Storage Cell
*/
double getIdleDrain();
double getIdleDrain(ItemStack is);
/**
* @return access configured list
@@ -17,7 +17,7 @@ public interface IStorageFluidCell extends ICellWorkbenchItem {
boolean isStorageCell(ItemStack i);
double getIdleDrain();
double getIdleDrain(ItemStack is);
int getTotalTypes(ItemStack cellItem);
}