Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import appeng.core.Api;
import co.neeve.nae2.common.registration.definitions.Materials;
import com.mekeng.github.common.ItemAndBlocks;
import com.mekeng.github.common.me.data.IAEGasStack;
import com.mekeng.github.common.me.storage.IGasStorageChannel;
import net.minecraft.item.ItemStack;
Expand All @@ -22,4 +23,11 @@ public IGasStorageChannel getChannel() {
public int getTotalTypes(@NotNull ItemStack cellItem) {
return 15;
}

/**
* Seperated out from the main Items registration class to prevent loading of MekEng classes
*/
public static ItemStack getBaseCell() {
return new ItemStack(ItemAndBlocks.GAS_CELL_1k);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
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;
Expand Down Expand Up @@ -86,10 +85,13 @@ public Items(Registry registry) {
.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());
if (Features.DENSE_GAS_CELLS.isEnabled())
this.gasStorageCellVoid = this.registerById(
registry.item("gas_storage_cell_void", VoidGasCell::new)
.features(Features.VOID_CELLS)
.build());
else
this.gasStorageCellVoid = new ItemDefinition("gas_storage_cell_void", null);

var voidCells = new Object2ObjectArrayMap<String, IItemDefinition>();
if (this.storageCellVoid.isEnabled()) voidCells.put("item", this.storageCellVoid);
Expand Down Expand Up @@ -168,29 +170,37 @@ public Items(Registry registry) {
.features(Features.DENSE_FLUID_CELLS)
.build());

this.storageCellGas256K = this.registerById(registry.item("storage_cell_gas_256k", () ->
new DenseGasCell(Materials.MaterialType.CELL_GAS_PART_256K,
(int) Math.pow(2, 8)))
.features(Features.DENSE_GAS_CELLS)
.build());

this.storageCellGas1024K = this.registerById(registry.item("storage_cell_gas_1024k", () ->
new DenseGasCell(Materials.MaterialType.CELL_GAS_PART_1024K,
(int) Math.pow(2, 10)))
.features(Features.DENSE_GAS_CELLS)
.build());

this.storageCellGas4096K = this.registerById(registry.item("storage_cell_gas_4096k", () ->
new DenseGasCell(Materials.MaterialType.CELL_GAS_PART_4096K,
(int) Math.pow(2, 12)))
.features(Features.DENSE_GAS_CELLS)
.build());
if (Features.DENSE_GAS_CELLS.isEnabled()) {
this.storageCellGas256K = this.registerById(registry.item("storage_cell_gas_256k", () ->
new DenseGasCell(Materials.MaterialType.CELL_GAS_PART_256K,
(int) Math.pow(2, 8)))
.features(Features.DENSE_GAS_CELLS)
.build());

this.storageCellGas1024K = this.registerById(registry.item("storage_cell_gas_1024k", () ->
new DenseGasCell(Materials.MaterialType.CELL_GAS_PART_1024K,
(int) Math.pow(2, 10)))
.features(Features.DENSE_GAS_CELLS)
.build());

this.storageCellGas4096K = this.registerById(registry.item("storage_cell_gas_4096k", () ->
new DenseGasCell(Materials.MaterialType.CELL_GAS_PART_4096K,
(int) Math.pow(2, 12)))
.features(Features.DENSE_GAS_CELLS)
.build());

this.storageCellGas16384K = this.registerById(registry.item("storage_cell_gas_16384k", () ->
new DenseGasCell(Materials.MaterialType.CELL_GAS_PART_16384K,
(int) Math.pow(2, 14)))
.features(Features.DENSE_GAS_CELLS)
.build());
} else {
this.storageCellGas256K = new ItemDefinition("storage_cell_gas_256k", null);
this.storageCellGas1024K = new ItemDefinition("storage_cell_gas_1024k", null);
this.storageCellGas4096K = new ItemDefinition("storage_cell_gas_4096k", null);
this.storageCellGas16384K = new ItemDefinition("storage_cell_gas_16384k", null);
}

this.storageCellGas16384K = this.registerById(registry.item("storage_cell_gas_16384k", () ->
new DenseGasCell(Materials.MaterialType.CELL_GAS_PART_16384K,
(int) Math.pow(2, 14)))
.features(Features.DENSE_GAS_CELLS)
.build());

registry.addBootstrapComponent((IPostInitComponent) r -> {
var items = AEApi.instance().definitions().items();
Expand All @@ -217,12 +227,12 @@ public Items(Registry registry) {
}

if (Features.DENSE_GAS_CELLS.isEnabled()) {
mirrorCellUpgrades(new ItemStack(ItemAndBlocks.GAS_CELL_1k), new IItemDefinition[]{
mirrorCellUpgrades(DenseGasCell.getBaseCell(), new IItemDefinition[]{
this.storageCellGas256K,
this.storageCellGas1024K,
this.storageCellGas4096K,
this.storageCellGas16384K,
this.storageCellVoid
this.gasStorageCellVoid
});
}
});
Expand Down