From f2d28bb05056f9d0ef7401b881796862615109df Mon Sep 17 00:00:00 2001 From: NotMyWing Date: Fri, 14 Jun 2024 15:10:48 +1100 Subject: [PATCH] add cheese void cells & generalize void cells --- .../subfeatures/VoidCellFeatures.java | 11 ++- .../items/cells/handlers/VoidCellHandler.java | 11 +-- .../nae2/common/items/cells/vc/VoidCell.java | 8 +- .../items/cells/vc/VoidCellInventory.java | 21 +---- .../common/items/cells/vc/VoidFluidCell.java | 21 +++++ .../common/items/cells/vc/VoidGasCell.java | 34 ++++++++ .../common/items/cells/vc/VoidItemCell.java | 13 +++ .../recipes/handlers/DisassembleRecipe.java | 38 ++++---- .../handlers/VoidConversionRecipe.java | 60 +++++++++++++ .../registration/definitions/Items.java | 86 ++++++++++++++----- .../resources/assets/nae2/lang/en_us.lang | 1 + .../recipes/item/cell/storage_cell_void.json | 35 ++++++++ 12 files changed, 274 insertions(+), 65 deletions(-) create mode 100644 src/main/java/co/neeve/nae2/common/items/cells/vc/VoidGasCell.java create mode 100644 src/main/java/co/neeve/nae2/common/recipes/handlers/VoidConversionRecipe.java create mode 100644 src/main/resources/assets/nae2/recipes/item/cell/storage_cell_void.json diff --git a/src/main/java/co/neeve/nae2/common/features/subfeatures/VoidCellFeatures.java b/src/main/java/co/neeve/nae2/common/features/subfeatures/VoidCellFeatures.java index 0a58217..5161563 100644 --- a/src/main/java/co/neeve/nae2/common/features/subfeatures/VoidCellFeatures.java +++ b/src/main/java/co/neeve/nae2/common/features/subfeatures/VoidCellFeatures.java @@ -3,7 +3,12 @@ import org.jetbrains.annotations.Nullable; public enum VoidCellFeatures implements ISubFeature { - CONDENSER_POWER("Enable Matter Condenser power", "void.condenser"); + CONDENSER_POWER("Enable Matter Condenser power", "void.condenser"), + CONVERSION_RECIPES( + """ + Enable conversion recipes. Useful if you want to add custom recipes. + HOWEVER, disassembling the Cells will still pop out a Void Component and a Housing! + You might want to disable disassembling as a feature in the AE2 config, which Void Cells respect."""); private final String description; private final String mixins; @@ -14,6 +19,10 @@ public enum VoidCellFeatures implements ISubFeature { this.mixins = mixins; } + VoidCellFeatures(String description) { + this(description, null); + } + public String getDescription() { return this.description; } diff --git a/src/main/java/co/neeve/nae2/common/items/cells/handlers/VoidCellHandler.java b/src/main/java/co/neeve/nae2/common/items/cells/handlers/VoidCellHandler.java index a74095d..6791b96 100644 --- a/src/main/java/co/neeve/nae2/common/items/cells/handlers/VoidCellHandler.java +++ b/src/main/java/co/neeve/nae2/common/items/cells/handlers/VoidCellHandler.java @@ -3,14 +3,10 @@ import appeng.api.storage.ICellInventoryHandler; import appeng.api.storage.ISaveProvider; import appeng.api.storage.IStorageChannel; -import appeng.api.storage.channels.IFluidStorageChannel; -import appeng.api.storage.channels.IItemStorageChannel; import appeng.api.storage.data.IAEStack; import co.neeve.nae2.common.interfaces.IVoidingCellHandler; import co.neeve.nae2.common.items.cells.vc.VoidCell; import co.neeve.nae2.common.items.cells.vc.VoidCellInventory; -import co.neeve.nae2.common.items.cells.vc.VoidFluidCell; -import co.neeve.nae2.common.items.cells.vc.VoidItemCell; import net.minecraft.item.ItemStack; public final class VoidCellHandler implements IVoidingCellHandler { @@ -26,11 +22,8 @@ public boolean isCell(ItemStack is) { public > ICellInventoryHandler getCellInventory(ItemStack itemStack, ISaveProvider iSaveProvider, IStorageChannel iStorageChannel) { - return !itemStack.isEmpty() - && ( - (itemStack.getItem() instanceof VoidItemCell && iStorageChannel instanceof IItemStorageChannel) - || (itemStack.getItem() instanceof VoidFluidCell && iStorageChannel instanceof IFluidStorageChannel) - ) ? new VoidCellInventory<>(itemStack, iSaveProvider) : null; + return this.isCell(itemStack) && ((VoidCell) itemStack.getItem()).getStorageChannel() == iStorageChannel + ? new VoidCellInventory<>(itemStack, iSaveProvider) : null; } @Override diff --git a/src/main/java/co/neeve/nae2/common/items/cells/vc/VoidCell.java b/src/main/java/co/neeve/nae2/common/items/cells/vc/VoidCell.java index 7cdfa43..5428d9c 100644 --- a/src/main/java/co/neeve/nae2/common/items/cells/vc/VoidCell.java +++ b/src/main/java/co/neeve/nae2/common/items/cells/vc/VoidCell.java @@ -30,6 +30,7 @@ import net.minecraftforge.fml.relauncher.SideOnly; import net.minecraftforge.items.IItemHandler; import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; import java.text.NumberFormat; import java.util.List; @@ -53,7 +54,7 @@ public CellUpgrades getUpgradesInventory(ItemStack is) { @Override public IItemHandler getConfigInventory(ItemStack is) { - return this.getCellInventory(is).getCellConfig(); + return this.getCellConfig(is); } public VoidCellInventory getCellInventory(ItemStack stack) { @@ -208,4 +209,9 @@ protected IncludeExclude getIncludeExcludeMode(ItemStack itemStack) { protected boolean isFuzzy(ItemStack itemStack) { return this.getCellInventory(itemStack).isFuzzy(); } + + public abstract CellConfig getCellConfig(ItemStack o); + + @Nullable + public abstract T handleConfigStack(ItemStack stack); } diff --git a/src/main/java/co/neeve/nae2/common/items/cells/vc/VoidCellInventory.java b/src/main/java/co/neeve/nae2/common/items/cells/vc/VoidCellInventory.java index 33d97af..2546e19 100644 --- a/src/main/java/co/neeve/nae2/common/items/cells/vc/VoidCellInventory.java +++ b/src/main/java/co/neeve/nae2/common/items/cells/vc/VoidCellInventory.java @@ -9,12 +9,8 @@ import appeng.api.storage.IStorageChannel; import appeng.api.storage.data.IAEStack; import appeng.api.storage.data.IItemList; -import appeng.fluids.helper.FluidCellConfig; -import appeng.fluids.items.FluidDummyItem; -import appeng.fluids.util.AEFluidStack; import appeng.items.contents.CellConfig; import appeng.util.Platform; -import appeng.util.item.AEItemStack; import co.neeve.nae2.common.features.subfeatures.VoidCellFeatures; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; @@ -40,13 +36,12 @@ public VoidCellInventory(ItemStack o, ISaveProvider iSaveProvider) { this.itemListCache = this.getChannel().createList(); this.saveProvider = iSaveProvider; - this.cellConfig = this.isFluid() ? new FluidCellConfig(o) : new CellConfig(o); + this.cellConfig = this.item.getCellConfig(o); for (final var is : this.cellConfig) { if (!is.isEmpty()) { - if (this.isFluid() && is.getItem() instanceof FluidDummyItem fdi) { - this.itemListCache.add((T) AEFluidStack.fromFluidStack(fdi.getFluidStack(is))); - } else if (!this.isFluid()) { - this.itemListCache.add((T) AEItemStack.fromItemStack(is)); + var aeStack = this.item.handleConfigStack(is); + if (aeStack != null) { + this.itemListCache.add(aeStack); } } } @@ -70,10 +65,6 @@ public VoidCellInventory(ItemStack o, ISaveProvider iSaveProvider) { } } - public CellConfig getCellConfig() { - return this.cellConfig; - } - @Override public T injectItems(T input, Actionable mode, IActionSource src) { if (!this.isValidInput(input)) return input; @@ -112,10 +103,6 @@ public IStorageChannel getChannel() { return this.channel; } - private boolean isFluid() { - return this.itemStack.getItem() instanceof VoidFluidCell; - } - @Override public AccessRestriction getAccess() { return AccessRestriction.WRITE; diff --git a/src/main/java/co/neeve/nae2/common/items/cells/vc/VoidFluidCell.java b/src/main/java/co/neeve/nae2/common/items/cells/vc/VoidFluidCell.java index 57c66c5..342a704 100644 --- a/src/main/java/co/neeve/nae2/common/items/cells/vc/VoidFluidCell.java +++ b/src/main/java/co/neeve/nae2/common/items/cells/vc/VoidFluidCell.java @@ -4,10 +4,31 @@ import appeng.api.storage.IStorageChannel; import appeng.api.storage.channels.IFluidStorageChannel; import appeng.api.storage.data.IAEFluidStack; +import appeng.fluids.helper.FluidCellConfig; +import appeng.fluids.items.FluidDummyItem; +import appeng.fluids.util.AEFluidStack; +import appeng.items.contents.CellConfig; +import net.minecraft.item.ItemStack; +import org.jetbrains.annotations.Nullable; public class VoidFluidCell extends VoidCell { @Override public IStorageChannel getStorageChannel() { return AEApi.instance().storage().getStorageChannel(IFluidStorageChannel.class); } + + @Override + public CellConfig getCellConfig(ItemStack o) { + return new FluidCellConfig(o); + } + + @Override + @Nullable + public IAEFluidStack handleConfigStack(ItemStack stack) { + if (stack.getItem() instanceof FluidDummyItem fdi) { + return AEFluidStack.fromFluidStack(fdi.getFluidStack(stack)); + } + + return null; + } } diff --git a/src/main/java/co/neeve/nae2/common/items/cells/vc/VoidGasCell.java b/src/main/java/co/neeve/nae2/common/items/cells/vc/VoidGasCell.java new file mode 100644 index 0000000..c3a192a --- /dev/null +++ b/src/main/java/co/neeve/nae2/common/items/cells/vc/VoidGasCell.java @@ -0,0 +1,34 @@ +package co.neeve.nae2.common.items.cells.vc; + +import appeng.api.AEApi; +import appeng.api.storage.IStorageChannel; +import appeng.items.contents.CellConfig; +import com.mekeng.github.common.item.ItemDummyGas; +import com.mekeng.github.common.me.data.IAEGasStack; +import com.mekeng.github.common.me.data.impl.AEGasStack; +import com.mekeng.github.common.me.storage.IGasStorageChannel; +import com.mekeng.github.util.helpers.GasCellConfig; +import net.minecraft.item.ItemStack; + +import javax.annotation.Nullable; + +public class VoidGasCell extends VoidCell { + @Override + public IStorageChannel getStorageChannel() { + return AEApi.instance().storage().getStorageChannel(IGasStorageChannel.class); + } + + @Override + public CellConfig getCellConfig(ItemStack o) { + return new GasCellConfig(o); + } + + @Override + @Nullable + public IAEGasStack handleConfigStack(ItemStack stack) { + if (stack.getItem() instanceof ItemDummyGas gasItem) { + return AEGasStack.of(gasItem.getGasStack(stack)); + } + return null; + } +} diff --git a/src/main/java/co/neeve/nae2/common/items/cells/vc/VoidItemCell.java b/src/main/java/co/neeve/nae2/common/items/cells/vc/VoidItemCell.java index dd4cc4e..ae0fb3f 100644 --- a/src/main/java/co/neeve/nae2/common/items/cells/vc/VoidItemCell.java +++ b/src/main/java/co/neeve/nae2/common/items/cells/vc/VoidItemCell.java @@ -4,10 +4,23 @@ import appeng.api.storage.IStorageChannel; import appeng.api.storage.channels.IItemStorageChannel; import appeng.api.storage.data.IAEItemStack; +import appeng.items.contents.CellConfig; +import appeng.util.item.AEItemStack; +import net.minecraft.item.ItemStack; public class VoidItemCell extends VoidCell { @Override public IStorageChannel getStorageChannel() { return AEApi.instance().storage().getStorageChannel(IItemStorageChannel.class); } + + @Override + public CellConfig getCellConfig(ItemStack o) { + return new CellConfig(o); + } + + @Override + public IAEItemStack handleConfigStack(ItemStack stack) { + return AEItemStack.fromItemStack(stack); + } } diff --git a/src/main/java/co/neeve/nae2/common/recipes/handlers/DisassembleRecipe.java b/src/main/java/co/neeve/nae2/common/recipes/handlers/DisassembleRecipe.java index 8fb801d..0581203 100644 --- a/src/main/java/co/neeve/nae2/common/recipes/handlers/DisassembleRecipe.java +++ b/src/main/java/co/neeve/nae2/common/recipes/handlers/DisassembleRecipe.java @@ -2,10 +2,10 @@ import appeng.api.AEApi; import appeng.api.definitions.IItemDefinition; -import appeng.api.storage.IMEInventory; -import appeng.api.storage.channels.IItemStorageChannel; -import appeng.api.storage.data.IAEItemStack; +import appeng.api.storage.data.IAEStack; +import appeng.api.storage.data.IItemList; import co.neeve.nae2.NAE2; +import co.neeve.nae2.common.items.cells.vc.VoidCell; import net.minecraft.inventory.IInventory; import net.minecraft.inventory.InventoryCrafting; import net.minecraft.item.ItemStack; @@ -33,8 +33,6 @@ public DisassembleRecipe() { this.cellMappings = new HashMap<>(6); this.nonCellMappings = new HashMap<>(4); - this.cellMappings.put(items.storageCellVoid(), mats.cellPartVoid()); - this.cellMappings.put(items.fluidStorageCellVoid(), mats.cellPartVoid()); this.cellMappings.put(items.storageCell256K(), mats.cellPart256K()); this.cellMappings.put(items.storageCell1024K(), mats.cellPart1024K()); this.cellMappings.put(items.storageCell4096K(), mats.cellPart4096K()); @@ -49,6 +47,21 @@ public DisassembleRecipe() { this.nonCellMappings.put(blocks.storageCrafting4096K(), mats.cellPart4096K()); this.nonCellMappings.put(blocks.storageCrafting16384K(), mats.cellPart16384K()); } + + @SuppressWarnings("unchecked") + private static > IItemList getStorageList(final ItemStack stack) { + var item = (VoidCell) stack.getItem(); + var channel = item.getStorageChannel(); + + // make sure the storage cell is empty... + var cellInv = AEApi.instance() + .registries() + .cell() + .getCellInventory(stack, null, channel); + + assert cellInv != null; + return cellInv.getAvailableItems(channel.createList()); + } @Override public boolean matches(final @NotNull InventoryCrafting inv, final @NotNull World w) { @@ -73,18 +86,9 @@ private ItemStack getOutput(final IInventory inventory) { var maybeCellOutput = this.getCellOutput(stackInSlot); if (maybeCellOutput.isPresent()) { var storageCellStack = maybeCellOutput.get(); - // make sure the storage cell stackInSlot empty... - final IMEInventory cellInv = AEApi.instance() - .registries() - .cell() - .getCellInventory(stackInSlot, null, - AEApi.instance().storage().getStorageChannel(IItemStorageChannel.class)); - if (cellInv != null) { - final var list = cellInv - .getAvailableItems(AEApi.instance().storage().getStorageChannel(IItemStorageChannel.class).createList()); - if (!list.isEmpty()) { - return ItemStack.EMPTY; - } + var storageList = getStorageList(storageCellStack); + if (storageList.isEmpty()) { + return MISMATCHED_STACK; } output = storageCellStack; diff --git a/src/main/java/co/neeve/nae2/common/recipes/handlers/VoidConversionRecipe.java b/src/main/java/co/neeve/nae2/common/recipes/handlers/VoidConversionRecipe.java new file mode 100644 index 0000000..93f1faa --- /dev/null +++ b/src/main/java/co/neeve/nae2/common/recipes/handlers/VoidConversionRecipe.java @@ -0,0 +1,60 @@ +package co.neeve.nae2.common.recipes.handlers; + +import co.neeve.nae2.common.items.cells.vc.VoidCell; +import net.minecraft.inventory.InventoryCrafting; +import net.minecraft.item.ItemStack; +import net.minecraft.item.crafting.Ingredient; +import net.minecraft.item.crafting.ShapelessRecipes; +import net.minecraft.util.NonNullList; +import net.minecraft.world.World; +import org.jetbrains.annotations.NotNull; + +public class VoidConversionRecipe extends ShapelessRecipes { + private final ItemStack from; + private final ItemStack to; + + public VoidConversionRecipe(ItemStack from, ItemStack to) { + super("", to, NonNullList.create()); + this.getIngredients().add(Ingredient.fromStacks(from)); + this.from = from; + this.to = to; + } + + @Override + public boolean matches(@NotNull InventoryCrafting inv, @NotNull World worldIn) { + return !this.getOutput(inv).isEmpty(); + } + + @Override + public @NotNull ItemStack getCraftingResult(@NotNull InventoryCrafting inv) { + return this.getOutput(inv); + } + + public ItemStack getOutput(InventoryCrafting inv) { + var output = ItemStack.EMPTY; + for (var i = 0; i < inv.getSizeInventory(); i++) { + var stack = inv.getStackInSlot(i); + if (stack.isEmpty()) { + continue; + } + + if (stack.isItemEqual(this.from)) { + output = this.to.copy(); + // Copy power over. + ((VoidCell) output.getItem()) + .setCondenserPower(output, ((VoidCell) stack.getItem()).getCondenserPower(stack)); + continue; + } + + if (!output.isEmpty()) { + return ItemStack.EMPTY; + } + } + return output; + } + + @Override + public @NotNull NonNullList getRemainingItems(@NotNull InventoryCrafting inv) { + return NonNullList.withSize(inv.getSizeInventory(), ItemStack.EMPTY); + } +} diff --git a/src/main/java/co/neeve/nae2/common/registration/definitions/Items.java b/src/main/java/co/neeve/nae2/common/registration/definitions/Items.java index 32d25ec..1b46900 100644 --- a/src/main/java/co/neeve/nae2/common/registration/definitions/Items.java +++ b/src/main/java/co/neeve/nae2/common/registration/definitions/Items.java @@ -6,21 +6,25 @@ import appeng.bootstrap.components.IPostInitComponent; import appeng.bootstrap.components.IRecipeRegistrationComponent; import appeng.core.features.ItemDefinition; -import co.neeve.nae2.NAE2; +import co.neeve.nae2.Tags; import co.neeve.nae2.client.gui.PatternMultiToolButtonHandler; import co.neeve.nae2.common.features.Features; +import co.neeve.nae2.common.features.subfeatures.VoidCellFeatures; import co.neeve.nae2.common.items.VirtualPattern; import co.neeve.nae2.common.items.cells.DenseFluidCell; import co.neeve.nae2.common.items.cells.DenseGasCell; import co.neeve.nae2.common.items.cells.DenseItemCell; import co.neeve.nae2.common.items.cells.handlers.VoidCellHandler; import co.neeve.nae2.common.items.cells.vc.VoidFluidCell; +import co.neeve.nae2.common.items.cells.vc.VoidGasCell; import co.neeve.nae2.common.items.cells.vc.VoidItemCell; import co.neeve.nae2.common.items.patternmultitool.ToolPatternMultiTool; -import co.neeve.nae2.common.recipes.handlers.VoidCellRecipe; +import co.neeve.nae2.common.recipes.handlers.VoidConversionRecipe; import co.neeve.nae2.common.registration.registry.Registry; import co.neeve.nae2.common.registration.registry.interfaces.Definitions; import co.neeve.nae2.common.registration.registry.rendering.NoItemRendering; +import com.mekeng.github.common.ItemAndBlocks; +import it.unimi.dsi.fastutil.objects.Object2ObjectArrayMap; import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; import net.minecraft.item.ItemStack; import net.minecraftforge.common.MinecraftForge; @@ -28,6 +32,8 @@ import java.util.Arrays; import java.util.Map; import java.util.Optional; +import java.util.function.Function; +import java.util.stream.Collectors; @SuppressWarnings("unused") public class Items implements Definitions { @@ -37,6 +43,7 @@ public class Items implements Definitions { private final IItemDefinition storageCellVoid; private final IItemDefinition fluidStorageCellVoid; + private final IItemDefinition gasStorageCellVoid; private final IItemDefinition storageCell256K; private final IItemDefinition storageCell1024K; private final IItemDefinition storageCell4096K; @@ -65,36 +72,53 @@ public Items(Registry registry) { if (r.isClient()) { MinecraftForge.EVENT_BUS.register(new PatternMultiToolButtonHandler()); } - - // Void Cells. - }) .build()); - this.storageCellVoid = this.registerById(registry.item("storage_cell_void", VoidItemCell::new) - .features(Features.VOID_CELLS) - .build()); + // Void Cells. + this.storageCellVoid = this.registerById( + registry.item("storage_cell_void", VoidItemCell::new) + .features(Features.VOID_CELLS) + .build()); this.fluidStorageCellVoid = this.registerById( registry.item("fluid_storage_cell_void", VoidFluidCell::new) .features(Features.VOID_CELLS) .build()); + this.gasStorageCellVoid = this.registerById( + registry.item("gas_storage_cell_void", VoidGasCell::new) + .features(Features.VOID_CELLS, Features.DENSE_GAS_CELLS) + .build()); + + var voidCells = new Object2ObjectArrayMap(); + if (this.storageCellVoid.isEnabled()) voidCells.put("item", this.storageCellVoid); + if (this.fluidStorageCellVoid.isEnabled()) voidCells.put("fluid", this.fluidStorageCellVoid); + if (this.gasStorageCellVoid.isEnabled()) voidCells.put("gas", this.gasStorageCellVoid); + registry.addBootstrapComponent((IPostInitComponent) r -> { - if (this.storageCellVoid.isEnabled() || this.fluidStorageCellVoid.isEnabled()) { + if (!voidCells.isEmpty()) { AEApi.instance().registries().cell().addCellHandler(new VoidCellHandler()); } }); - registry.addBootstrapComponent((IRecipeRegistrationComponent) (side, r) -> NAE2.definitions().materials().cellPartVoid().maybeStack( - 1).ifPresent(voidComponent -> - AEApi.instance().definitions().materials().emptyStorageCell().maybeStack(1).ifPresent(stack -> { - this.storageCellVoid.maybeStack(1).ifPresent((itemStack -> r.register(new VoidCellRecipe( - stack, voidComponent, itemStack).setRegistryName("storage_cell_void")))); - - this.fluidStorageCellVoid.maybeStack(1).ifPresent((itemStack -> r.register(new VoidCellRecipe( - voidComponent, stack, itemStack).setRegistryName("fluid_storage_cell_void")))); - }))); + registry.addBootstrapComponent((IRecipeRegistrationComponent) (side, r) -> { + if (!VoidCellFeatures.CONVERSION_RECIPES.isEnabled()) return; + + // Register circular conversion. + if (voidCells.size() > 1) { + var entrySet = voidCells.entrySet().stream().collect(Collectors.toList()); + for (var i = 0; i < entrySet.size(); i++) { + var from = entrySet.get(i); + var to = entrySet.get((i + 1) % voidCells.size()); + from.getValue().maybeStack(1).ifPresent(fromStack -> + to.getValue().maybeStack(1).ifPresent(toStack -> + r.register(new VoidConversionRecipe(fromStack, toStack) + .setRegistryName(Tags.MODID, "void_conversion_" + + from.getKey() + "_to_" + to.getKey())))); + } + } + }); this.storageCell256K = this.registerById(registry.item("storage_cell_256k", () -> new DenseItemCell(Materials.MaterialType.CELL_PART_256K, @@ -191,15 +215,25 @@ public Items(Registry registry) { this.fluidStorageCellVoid }); } + + if (Features.DENSE_GAS_CELLS.isEnabled()) { + mirrorCellUpgrades(new ItemStack(ItemAndBlocks.GAS_CELL_1k), new IItemDefinition[]{ + this.storageCellGas256K, + this.storageCellGas1024K, + this.storageCellGas4096K, + this.storageCellGas16384K, + this.storageCellVoid + }); + } }); } - private static void mirrorCellUpgrades(IItemDefinition cellDef, IItemDefinition[] cells) { + private static void mirrorCellUpgrades(Function predicate, IItemDefinition[] cells) { var supported = new java.util.HashMap(); Arrays.stream(Upgrades.values()) .forEach(upgrade -> upgrade.getSupported().entrySet().stream() - .filter(x -> cellDef.isSameAs(x.getKey())) + .filter(x -> predicate.apply(x.getKey())) .map(Map.Entry::getValue) .findFirst() .ifPresent(value -> supported.put(upgrade, value))); @@ -209,6 +243,14 @@ private static void mirrorCellUpgrades(IItemDefinition cellDef, IItemDefinition[ key.registerItem(iItemDefinition, value))); } + private static void mirrorCellUpgrades(IItemDefinition cellDef, IItemDefinition[] cells) { + mirrorCellUpgrades(cellDef::isSameAs, cells); + } + + private static void mirrorCellUpgrades(ItemStack itemStack, IItemDefinition[] cells) { + mirrorCellUpgrades(itemStack::isItemEqual, cells); + } + private IItemDefinition registerById(ItemDefinition item) { this.byId.put(item.identifier(), item); return item; @@ -231,6 +273,10 @@ public IItemDefinition fluidStorageCellVoid() { return this.fluidStorageCellVoid; } + public IItemDefinition gasStorageCellVoid() { + return this.gasStorageCellVoid; + } + public IItemDefinition virtualPattern() { return this.virtualPattern; } diff --git a/src/main/resources/assets/nae2/lang/en_us.lang b/src/main/resources/assets/nae2/lang/en_us.lang index b014dce..9be0ae2 100644 --- a/src/main/resources/assets/nae2/lang/en_us.lang +++ b/src/main/resources/assets/nae2/lang/en_us.lang @@ -10,6 +10,7 @@ item.nae2.pattern_multiplier.name=Pattern Multi-Tool # Cells item.nae2.storage_cell_void.name=ME Void Storage Cell item.nae2.fluid_storage_cell_void.name=ME Fluid Void Storage Cell +item.nae2.gas_storage_cell_void.name=ME Fluid Void Storage Cell item.nae2.storage_cell_256k.name=§c256k§r ME Storage Cell item.nae2.storage_cell_1024k.name=§61024k§r ME Storage Cell item.nae2.storage_cell_4096k.name=§e4096k§r ME Storage Cell diff --git a/src/main/resources/assets/nae2/recipes/item/cell/storage_cell_void.json b/src/main/resources/assets/nae2/recipes/item/cell/storage_cell_void.json new file mode 100644 index 0000000..48d854f --- /dev/null +++ b/src/main/resources/assets/nae2/recipes/item/cell/storage_cell_void.json @@ -0,0 +1,35 @@ +{ + "conditions": [ + { + "type": "forge:and", + "values": [ + { + "type": "minecraft:item_exists", + "item": "nae2:storage_cell_256k" + }, + { + "type": "appliedenergistics2:material_exists", + "material": "material.empty_storage_cell" + }, + { + "type": "nae2:material_exists", + "name": "cell_part_void" + } + ] + } + ], + "result": { + "item": "nae2:storage_cell_void" + }, + "type": "forge:ore_shapeless", + "ingredients": [ + { + "type": "appliedenergistics2:part", + "part": "material.empty_storage_cell" + }, + { + "type": "nae2:material", + "name": "cell_part_void" + } + ] +}