From f1e999d685906cf7e37a88246c4bfe99cca6dfff Mon Sep 17 00:00:00 2001 From: 90 Date: Tue, 5 Nov 2024 01:22:25 +0000 Subject: [PATCH] Various assorted refactors (easier add-on integration, fixed drive cell models etc.) --- .../megacells/datagen/MEGAModelProvider.java | 29 +-- .../cc4b70e39bb0fb6efac7e3196e5bd714468e6114 | 42 ++--- .../block/drive/cells/16m_chemical_cell.json | 44 ----- .../block/drive/cells/16m_fluid_cell.json | 44 ----- .../block/drive/cells/16m_item_cell.json | 44 ----- .../block/drive/cells/16m_source_cell.json | 44 ----- .../block/drive/cells/1m_chemical_cell.json | 44 ----- .../block/drive/cells/1m_fluid_cell.json | 44 ----- .../block/drive/cells/1m_item_cell.json | 44 ----- .../block/drive/cells/1m_source_cell.json | 44 ----- .../block/drive/cells/256m_chemical_cell.json | 44 ----- .../block/drive/cells/256m_fluid_cell.json | 44 ----- .../block/drive/cells/256m_item_cell.json | 44 ----- .../block/drive/cells/256m_source_cell.json | 44 ----- .../block/drive/cells/4m_chemical_cell.json | 44 ----- .../block/drive/cells/4m_fluid_cell.json | 44 ----- .../block/drive/cells/4m_item_cell.json | 44 ----- .../block/drive/cells/4m_source_cell.json | 44 ----- .../block/drive/cells/64m_chemical_cell.json | 44 ----- .../block/drive/cells/64m_fluid_cell.json | 44 ----- .../block/drive/cells/64m_item_cell.json | 44 ----- .../block/drive/cells/64m_source_cell.json | 44 ----- .../java/gripe/_90/megacells/MEGACells.java | 89 ++++----- .../_90/megacells/client/MEGACellsClient.java | 28 ++- .../_90/megacells/definition/MEGAItems.java | 171 ++++++------------ .../_90/megacells/integration/Addons.java | 28 ++- .../integration/IntegrationHelper.java | 15 ++ .../integration/ae2wt/AE2WTIntegration.java | 23 ++- .../integration/appmek/AppMekIntegration.java | 33 ++-- .../appmek/RadioactiveCellInventory.java | 2 +- .../integration/arseng/ArsEngIntegration.java | 35 ++-- .../client/BuiltInModelHooksAccessor.java | 2 +- 32 files changed, 233 insertions(+), 1144 deletions(-) create mode 100644 src/main/java/gripe/_90/megacells/integration/IntegrationHelper.java diff --git a/src/data/java/gripe/_90/megacells/datagen/MEGAModelProvider.java b/src/data/java/gripe/_90/megacells/datagen/MEGAModelProvider.java index 3ae3fda6..37cfbba9 100644 --- a/src/data/java/gripe/_90/megacells/datagen/MEGAModelProvider.java +++ b/src/data/java/gripe/_90/megacells/datagen/MEGAModelProvider.java @@ -58,19 +58,18 @@ protected void registerStatesAndModels() { basicItem(MEGAItems.GREATER_ENERGY_CARD); basicItem(MEGAItems.COMPRESSION_CARD); - MEGAItems.getItemCells().forEach(this::cell); - MEGAItems.getFluidCells().forEach(this::cell); - MEGAItems.getChemicalCells().forEach(this::cell); - MEGAItems.getSourceCells().forEach(this::cell); + for (var cell : MEGAItems.getTieredCells()) { + if (cell.portable()) { + portable(cell.item(), cell.keyType()); + } else { + cell(cell.item()); + } + } + cell(MEGAItems.BULK_ITEM_CELL); cell(MEGAItems.RADIOACTIVE_CHEMICAL_CELL); - MEGAItems.getItemPortables().forEach(cell -> portable(cell, "item")); - MEGAItems.getFluidPortables().forEach(cell -> portable(cell, "fluid")); - MEGAItems.getChemicalPortables().forEach(cell -> portable(cell, "chemical")); - MEGAItems.getSourcePortables().forEach(cell -> portable(cell, "source")); - - MEGAItems.getAllCells().forEach(this::driveCell); + MEGAItems.getTieredCells().forEach(this::driveCell); driveCell(MEGAItems.BULK_ITEM_CELL, 0); driveCell(MEGAItems.RADIOACTIVE_CHEMICAL_CELL, 2); @@ -216,10 +215,12 @@ private void portable(ItemDefinition portable, String housingType) { } private void driveCell(MEGAItems.CellDefinition cell) { - driveCell( - cell.tier().namePrefix() + "_" + cell.keyType() + "_cell", - "mega_" + cell.keyType() + "_cell", - (cell.tier().index() - 6) * 2); + if (!cell.portable()) { + driveCell( + cell.tier().namePrefix() + "_" + cell.keyType() + "_cell", + "mega_" + cell.keyType() + "_cell", + (cell.tier().index() - 6) * 2); + } } private void driveCell(ItemDefinition cell, int offset) { diff --git a/src/generated/resources/.cache/cc4b70e39bb0fb6efac7e3196e5bd714468e6114 b/src/generated/resources/.cache/cc4b70e39bb0fb6efac7e3196e5bd714468e6114 index 3a1b82e2..67672406 100644 --- a/src/generated/resources/.cache/cc4b70e39bb0fb6efac7e3196e5bd714468e6114 +++ b/src/generated/resources/.cache/cc4b70e39bb0fb6efac7e3196e5bd714468e6114 @@ -1,4 +1,4 @@ -// 1.21.1 2024-10-20T15:17:33.818816604 Block States / Models +// 1.21.1 2024-11-04T23:24:20.773958326 Block States / Models 8d69a3c391bcb75b5aac370510d15fa9c367b200 assets/megacells/blockstates/16m_crafting_storage.json 6b8ebbdecbd556e59c1c0d9abb4222d5de046e9a assets/megacells/blockstates/1m_crafting_storage.json c716f5bd44bda4274f6e5f2c2f2b09f6223a8de7 assets/megacells/blockstates/256m_crafting_storage.json @@ -29,26 +29,26 @@ bb279ec5c0a166e1b7f0d11ab67408f29e7b37d8 assets/megacells/models/block/crafting/ bf21a9e8fbc5a3846fb05b4fa0859e0917b2202f assets/megacells/models/block/crafting/monitor_formed.json 75fdc6d6aad6a4d9403b71994b38f1ec774ce7d1 assets/megacells/models/block/crafting/unit.json bf21a9e8fbc5a3846fb05b4fa0859e0917b2202f assets/megacells/models/block/crafting/unit_formed.json -b5aed244ba024e0cf6e01d55c7337d3a78bdc343 assets/megacells/models/block/drive/cells/16m_chemical_cell.json -ac19152e615ec413b01f03ea64b9c97202c69b93 assets/megacells/models/block/drive/cells/16m_fluid_cell.json -c162baa8189635e58888371831e5be75effe7f15 assets/megacells/models/block/drive/cells/16m_item_cell.json -14e7780f287bf480ff3a9caf2c879be6bbf8da4f assets/megacells/models/block/drive/cells/16m_source_cell.json -5a321e8155aabd5f762a1388459dbbdd25760caf assets/megacells/models/block/drive/cells/1m_chemical_cell.json -4e95d9b0ba21cfe132def34adb29b7a6bea6dc31 assets/megacells/models/block/drive/cells/1m_fluid_cell.json -f760556eae133ae2dbea5045f640357a46e846f4 assets/megacells/models/block/drive/cells/1m_item_cell.json -75010741839fc22e84ff4e60834757f87ef01875 assets/megacells/models/block/drive/cells/1m_source_cell.json -194b46a5585d4876d49d04c03a939848258d2ff4 assets/megacells/models/block/drive/cells/256m_chemical_cell.json -46f51bb7d95664321c22cc3285af668fbae2568f assets/megacells/models/block/drive/cells/256m_fluid_cell.json -edea8ebddb6bdb2463fdebd36e60b8df5d451316 assets/megacells/models/block/drive/cells/256m_item_cell.json -6582a7db52b90af087fd7a6331d94e6098b222a4 assets/megacells/models/block/drive/cells/256m_source_cell.json -88032aac24f37379725c45870b0dcc01c67af508 assets/megacells/models/block/drive/cells/4m_chemical_cell.json -e1930c2351da19d57397450fb8d485184e58e349 assets/megacells/models/block/drive/cells/4m_fluid_cell.json -721100216b33d4ee9476a16e0afd6193e28c7424 assets/megacells/models/block/drive/cells/4m_item_cell.json -c03477c6fad692f52e0c09a35ab4f8bf0cbfcaf5 assets/megacells/models/block/drive/cells/4m_source_cell.json -1856d503102c60f0796c8273149f74095285b437 assets/megacells/models/block/drive/cells/64m_chemical_cell.json -1f0566b718fcf79a27c65f53848249f803224c49 assets/megacells/models/block/drive/cells/64m_fluid_cell.json -7d68f252b72cf9bfce7fbd0d19c87338baca97d5 assets/megacells/models/block/drive/cells/64m_item_cell.json -de75e0aaa0ca780926bcb7bdd78e02562a8158ed assets/megacells/models/block/drive/cells/64m_source_cell.json +26317a4644e39aa2969c0cb96f22aeabfa71dc0a assets/megacells/models/block/drive/cells/16m_chemical_cell.json +94fdbfb6fbc077e6f2bab148c0610262d25d572f assets/megacells/models/block/drive/cells/16m_fluid_cell.json +9078b6d2e74a5bd70a9fa1103872dcb80a784fa7 assets/megacells/models/block/drive/cells/16m_item_cell.json +6ab6d197ba96ae79c2f95447f8a18f85528ed5e2 assets/megacells/models/block/drive/cells/16m_source_cell.json +482e5ad8e0a58973889ddd9fafde6192d1802d46 assets/megacells/models/block/drive/cells/1m_chemical_cell.json +6175e319046dc30dbc35b8a4f42b970f1ae6c9a8 assets/megacells/models/block/drive/cells/1m_fluid_cell.json +708afd20ab2e26b1c5562d5a91e78a9935037b11 assets/megacells/models/block/drive/cells/1m_item_cell.json +ad12a43236b72410a95ec24025dae5b953782ac6 assets/megacells/models/block/drive/cells/1m_source_cell.json +98a69f5c0231d12190988b5472416937548a32b0 assets/megacells/models/block/drive/cells/256m_chemical_cell.json +038a71241b32272946b009ef64cd95ae62f89f45 assets/megacells/models/block/drive/cells/256m_fluid_cell.json +317cb3d8a4d3a62d82314f67a778f7016e626201 assets/megacells/models/block/drive/cells/256m_item_cell.json +4712cbd93e5c84d375f8519894f685064d684f8c assets/megacells/models/block/drive/cells/256m_source_cell.json +2d74a4ad8d13573667fca88dcb2feeb4b88187db assets/megacells/models/block/drive/cells/4m_chemical_cell.json +5802ae26a5f84d3b467d1e0fe7743788983158c2 assets/megacells/models/block/drive/cells/4m_fluid_cell.json +a2e1c94fec6eeb6cc033c1efe88315d1e846ce88 assets/megacells/models/block/drive/cells/4m_item_cell.json +1338ae5a2e832dfb7162d435de4dc67866af517c assets/megacells/models/block/drive/cells/4m_source_cell.json +ebc4df02c9e6ca3d37c0d1afb5950a8138cbdb8d assets/megacells/models/block/drive/cells/64m_chemical_cell.json +e7ea3d2617b666f955a0fa0623101139d8d5ce7e assets/megacells/models/block/drive/cells/64m_fluid_cell.json +cca14905b3a7cefbda9022e2bd3dd3fa2d4cb0eb assets/megacells/models/block/drive/cells/64m_item_cell.json +10629fb2f5f657e85847374913e771df235c4153 assets/megacells/models/block/drive/cells/64m_source_cell.json 9923abfaabaf29512ab6ffc57e6631201612cd02 assets/megacells/models/block/drive/cells/bulk_item_cell.json 44c1cec7b57b70d8eee95fb5ca8c94a6270d7f62 assets/megacells/models/block/drive/cells/radioactive_chemical_cell.json 5e974aa730bec68d50d47c26f432bddefb0eea5a assets/megacells/models/block/mega_energy_cell_0.json diff --git a/src/generated/resources/assets/megacells/models/block/drive/cells/16m_chemical_cell.json b/src/generated/resources/assets/megacells/models/block/drive/cells/16m_chemical_cell.json index 6196fffe..84e0341a 100644 --- a/src/generated/resources/assets/megacells/models/block/drive/cells/16m_chemical_cell.json +++ b/src/generated/resources/assets/megacells/models/block/drive/cells/16m_chemical_cell.json @@ -1,50 +1,6 @@ { "ambientocclusion": false, "elements": [ - { - "faces": { - "down": { - "cullface": "north", - "texture": "#cell", - "uv": [ - 6.0, - 4.0, - 0.0, - 6.0 - ] - }, - "north": { - "cullface": "north", - "texture": "#cell", - "uv": [ - 0.0, - 4.0, - 6.0, - 6.0 - ] - }, - "up": { - "cullface": "north", - "texture": "#cell", - "uv": [ - 6.0, - 4.0, - 0.0, - 6.0 - ] - } - }, - "from": [ - 0, - 0, - 0 - ], - "to": [ - 6, - 2, - 2 - ] - }, { "faces": { "down": { diff --git a/src/generated/resources/assets/megacells/models/block/drive/cells/16m_fluid_cell.json b/src/generated/resources/assets/megacells/models/block/drive/cells/16m_fluid_cell.json index 6557c06e..34061abb 100644 --- a/src/generated/resources/assets/megacells/models/block/drive/cells/16m_fluid_cell.json +++ b/src/generated/resources/assets/megacells/models/block/drive/cells/16m_fluid_cell.json @@ -1,50 +1,6 @@ { "ambientocclusion": false, "elements": [ - { - "faces": { - "down": { - "cullface": "north", - "texture": "#cell", - "uv": [ - 6.0, - 4.0, - 0.0, - 6.0 - ] - }, - "north": { - "cullface": "north", - "texture": "#cell", - "uv": [ - 0.0, - 4.0, - 6.0, - 6.0 - ] - }, - "up": { - "cullface": "north", - "texture": "#cell", - "uv": [ - 6.0, - 4.0, - 0.0, - 6.0 - ] - } - }, - "from": [ - 0, - 0, - 0 - ], - "to": [ - 6, - 2, - 2 - ] - }, { "faces": { "down": { diff --git a/src/generated/resources/assets/megacells/models/block/drive/cells/16m_item_cell.json b/src/generated/resources/assets/megacells/models/block/drive/cells/16m_item_cell.json index 79e67819..faf5cd42 100644 --- a/src/generated/resources/assets/megacells/models/block/drive/cells/16m_item_cell.json +++ b/src/generated/resources/assets/megacells/models/block/drive/cells/16m_item_cell.json @@ -1,50 +1,6 @@ { "ambientocclusion": false, "elements": [ - { - "faces": { - "down": { - "cullface": "north", - "texture": "#cell", - "uv": [ - 6.0, - 4.0, - 0.0, - 6.0 - ] - }, - "north": { - "cullface": "north", - "texture": "#cell", - "uv": [ - 0.0, - 4.0, - 6.0, - 6.0 - ] - }, - "up": { - "cullface": "north", - "texture": "#cell", - "uv": [ - 6.0, - 4.0, - 0.0, - 6.0 - ] - } - }, - "from": [ - 0, - 0, - 0 - ], - "to": [ - 6, - 2, - 2 - ] - }, { "faces": { "down": { diff --git a/src/generated/resources/assets/megacells/models/block/drive/cells/16m_source_cell.json b/src/generated/resources/assets/megacells/models/block/drive/cells/16m_source_cell.json index b7ec81ce..21c53032 100644 --- a/src/generated/resources/assets/megacells/models/block/drive/cells/16m_source_cell.json +++ b/src/generated/resources/assets/megacells/models/block/drive/cells/16m_source_cell.json @@ -1,50 +1,6 @@ { "ambientocclusion": false, "elements": [ - { - "faces": { - "down": { - "cullface": "north", - "texture": "#cell", - "uv": [ - 6.0, - 4.0, - 0.0, - 6.0 - ] - }, - "north": { - "cullface": "north", - "texture": "#cell", - "uv": [ - 0.0, - 4.0, - 6.0, - 6.0 - ] - }, - "up": { - "cullface": "north", - "texture": "#cell", - "uv": [ - 6.0, - 4.0, - 0.0, - 6.0 - ] - } - }, - "from": [ - 0, - 0, - 0 - ], - "to": [ - 6, - 2, - 2 - ] - }, { "faces": { "down": { diff --git a/src/generated/resources/assets/megacells/models/block/drive/cells/1m_chemical_cell.json b/src/generated/resources/assets/megacells/models/block/drive/cells/1m_chemical_cell.json index c4c1e6ff..1aff78f6 100644 --- a/src/generated/resources/assets/megacells/models/block/drive/cells/1m_chemical_cell.json +++ b/src/generated/resources/assets/megacells/models/block/drive/cells/1m_chemical_cell.json @@ -1,50 +1,6 @@ { "ambientocclusion": false, "elements": [ - { - "faces": { - "down": { - "cullface": "north", - "texture": "#cell", - "uv": [ - 6.0, - 0.0, - 0.0, - 2.0 - ] - }, - "north": { - "cullface": "north", - "texture": "#cell", - "uv": [ - 0.0, - 0.0, - 6.0, - 2.0 - ] - }, - "up": { - "cullface": "north", - "texture": "#cell", - "uv": [ - 6.0, - 0.0, - 0.0, - 2.0 - ] - } - }, - "from": [ - 0, - 0, - 0 - ], - "to": [ - 6, - 2, - 2 - ] - }, { "faces": { "down": { diff --git a/src/generated/resources/assets/megacells/models/block/drive/cells/1m_fluid_cell.json b/src/generated/resources/assets/megacells/models/block/drive/cells/1m_fluid_cell.json index c76e294a..3b05d7b4 100644 --- a/src/generated/resources/assets/megacells/models/block/drive/cells/1m_fluid_cell.json +++ b/src/generated/resources/assets/megacells/models/block/drive/cells/1m_fluid_cell.json @@ -1,50 +1,6 @@ { "ambientocclusion": false, "elements": [ - { - "faces": { - "down": { - "cullface": "north", - "texture": "#cell", - "uv": [ - 6.0, - 0.0, - 0.0, - 2.0 - ] - }, - "north": { - "cullface": "north", - "texture": "#cell", - "uv": [ - 0.0, - 0.0, - 6.0, - 2.0 - ] - }, - "up": { - "cullface": "north", - "texture": "#cell", - "uv": [ - 6.0, - 0.0, - 0.0, - 2.0 - ] - } - }, - "from": [ - 0, - 0, - 0 - ], - "to": [ - 6, - 2, - 2 - ] - }, { "faces": { "down": { diff --git a/src/generated/resources/assets/megacells/models/block/drive/cells/1m_item_cell.json b/src/generated/resources/assets/megacells/models/block/drive/cells/1m_item_cell.json index 93127805..b8edc844 100644 --- a/src/generated/resources/assets/megacells/models/block/drive/cells/1m_item_cell.json +++ b/src/generated/resources/assets/megacells/models/block/drive/cells/1m_item_cell.json @@ -1,50 +1,6 @@ { "ambientocclusion": false, "elements": [ - { - "faces": { - "down": { - "cullface": "north", - "texture": "#cell", - "uv": [ - 6.0, - 0.0, - 0.0, - 2.0 - ] - }, - "north": { - "cullface": "north", - "texture": "#cell", - "uv": [ - 0.0, - 0.0, - 6.0, - 2.0 - ] - }, - "up": { - "cullface": "north", - "texture": "#cell", - "uv": [ - 6.0, - 0.0, - 0.0, - 2.0 - ] - } - }, - "from": [ - 0, - 0, - 0 - ], - "to": [ - 6, - 2, - 2 - ] - }, { "faces": { "down": { diff --git a/src/generated/resources/assets/megacells/models/block/drive/cells/1m_source_cell.json b/src/generated/resources/assets/megacells/models/block/drive/cells/1m_source_cell.json index bad1770a..ec571c56 100644 --- a/src/generated/resources/assets/megacells/models/block/drive/cells/1m_source_cell.json +++ b/src/generated/resources/assets/megacells/models/block/drive/cells/1m_source_cell.json @@ -1,50 +1,6 @@ { "ambientocclusion": false, "elements": [ - { - "faces": { - "down": { - "cullface": "north", - "texture": "#cell", - "uv": [ - 6.0, - 0.0, - 0.0, - 2.0 - ] - }, - "north": { - "cullface": "north", - "texture": "#cell", - "uv": [ - 0.0, - 0.0, - 6.0, - 2.0 - ] - }, - "up": { - "cullface": "north", - "texture": "#cell", - "uv": [ - 6.0, - 0.0, - 0.0, - 2.0 - ] - } - }, - "from": [ - 0, - 0, - 0 - ], - "to": [ - 6, - 2, - 2 - ] - }, { "faces": { "down": { diff --git a/src/generated/resources/assets/megacells/models/block/drive/cells/256m_chemical_cell.json b/src/generated/resources/assets/megacells/models/block/drive/cells/256m_chemical_cell.json index 8541b012..576ce23a 100644 --- a/src/generated/resources/assets/megacells/models/block/drive/cells/256m_chemical_cell.json +++ b/src/generated/resources/assets/megacells/models/block/drive/cells/256m_chemical_cell.json @@ -1,50 +1,6 @@ { "ambientocclusion": false, "elements": [ - { - "faces": { - "down": { - "cullface": "north", - "texture": "#cell", - "uv": [ - 6.0, - 8.0, - 0.0, - 10.0 - ] - }, - "north": { - "cullface": "north", - "texture": "#cell", - "uv": [ - 0.0, - 8.0, - 6.0, - 10.0 - ] - }, - "up": { - "cullface": "north", - "texture": "#cell", - "uv": [ - 6.0, - 8.0, - 0.0, - 10.0 - ] - } - }, - "from": [ - 0, - 0, - 0 - ], - "to": [ - 6, - 2, - 2 - ] - }, { "faces": { "down": { diff --git a/src/generated/resources/assets/megacells/models/block/drive/cells/256m_fluid_cell.json b/src/generated/resources/assets/megacells/models/block/drive/cells/256m_fluid_cell.json index 10f909e9..67488943 100644 --- a/src/generated/resources/assets/megacells/models/block/drive/cells/256m_fluid_cell.json +++ b/src/generated/resources/assets/megacells/models/block/drive/cells/256m_fluid_cell.json @@ -1,50 +1,6 @@ { "ambientocclusion": false, "elements": [ - { - "faces": { - "down": { - "cullface": "north", - "texture": "#cell", - "uv": [ - 6.0, - 8.0, - 0.0, - 10.0 - ] - }, - "north": { - "cullface": "north", - "texture": "#cell", - "uv": [ - 0.0, - 8.0, - 6.0, - 10.0 - ] - }, - "up": { - "cullface": "north", - "texture": "#cell", - "uv": [ - 6.0, - 8.0, - 0.0, - 10.0 - ] - } - }, - "from": [ - 0, - 0, - 0 - ], - "to": [ - 6, - 2, - 2 - ] - }, { "faces": { "down": { diff --git a/src/generated/resources/assets/megacells/models/block/drive/cells/256m_item_cell.json b/src/generated/resources/assets/megacells/models/block/drive/cells/256m_item_cell.json index cfd85e33..538122a0 100644 --- a/src/generated/resources/assets/megacells/models/block/drive/cells/256m_item_cell.json +++ b/src/generated/resources/assets/megacells/models/block/drive/cells/256m_item_cell.json @@ -1,50 +1,6 @@ { "ambientocclusion": false, "elements": [ - { - "faces": { - "down": { - "cullface": "north", - "texture": "#cell", - "uv": [ - 6.0, - 8.0, - 0.0, - 10.0 - ] - }, - "north": { - "cullface": "north", - "texture": "#cell", - "uv": [ - 0.0, - 8.0, - 6.0, - 10.0 - ] - }, - "up": { - "cullface": "north", - "texture": "#cell", - "uv": [ - 6.0, - 8.0, - 0.0, - 10.0 - ] - } - }, - "from": [ - 0, - 0, - 0 - ], - "to": [ - 6, - 2, - 2 - ] - }, { "faces": { "down": { diff --git a/src/generated/resources/assets/megacells/models/block/drive/cells/256m_source_cell.json b/src/generated/resources/assets/megacells/models/block/drive/cells/256m_source_cell.json index 41629fe2..db091aae 100644 --- a/src/generated/resources/assets/megacells/models/block/drive/cells/256m_source_cell.json +++ b/src/generated/resources/assets/megacells/models/block/drive/cells/256m_source_cell.json @@ -1,50 +1,6 @@ { "ambientocclusion": false, "elements": [ - { - "faces": { - "down": { - "cullface": "north", - "texture": "#cell", - "uv": [ - 6.0, - 8.0, - 0.0, - 10.0 - ] - }, - "north": { - "cullface": "north", - "texture": "#cell", - "uv": [ - 0.0, - 8.0, - 6.0, - 10.0 - ] - }, - "up": { - "cullface": "north", - "texture": "#cell", - "uv": [ - 6.0, - 8.0, - 0.0, - 10.0 - ] - } - }, - "from": [ - 0, - 0, - 0 - ], - "to": [ - 6, - 2, - 2 - ] - }, { "faces": { "down": { diff --git a/src/generated/resources/assets/megacells/models/block/drive/cells/4m_chemical_cell.json b/src/generated/resources/assets/megacells/models/block/drive/cells/4m_chemical_cell.json index 89ea8087..5be77adb 100644 --- a/src/generated/resources/assets/megacells/models/block/drive/cells/4m_chemical_cell.json +++ b/src/generated/resources/assets/megacells/models/block/drive/cells/4m_chemical_cell.json @@ -1,50 +1,6 @@ { "ambientocclusion": false, "elements": [ - { - "faces": { - "down": { - "cullface": "north", - "texture": "#cell", - "uv": [ - 6.0, - 2.0, - 0.0, - 4.0 - ] - }, - "north": { - "cullface": "north", - "texture": "#cell", - "uv": [ - 0.0, - 2.0, - 6.0, - 4.0 - ] - }, - "up": { - "cullface": "north", - "texture": "#cell", - "uv": [ - 6.0, - 2.0, - 0.0, - 4.0 - ] - } - }, - "from": [ - 0, - 0, - 0 - ], - "to": [ - 6, - 2, - 2 - ] - }, { "faces": { "down": { diff --git a/src/generated/resources/assets/megacells/models/block/drive/cells/4m_fluid_cell.json b/src/generated/resources/assets/megacells/models/block/drive/cells/4m_fluid_cell.json index 8bdd08b5..72fe2669 100644 --- a/src/generated/resources/assets/megacells/models/block/drive/cells/4m_fluid_cell.json +++ b/src/generated/resources/assets/megacells/models/block/drive/cells/4m_fluid_cell.json @@ -1,50 +1,6 @@ { "ambientocclusion": false, "elements": [ - { - "faces": { - "down": { - "cullface": "north", - "texture": "#cell", - "uv": [ - 6.0, - 2.0, - 0.0, - 4.0 - ] - }, - "north": { - "cullface": "north", - "texture": "#cell", - "uv": [ - 0.0, - 2.0, - 6.0, - 4.0 - ] - }, - "up": { - "cullface": "north", - "texture": "#cell", - "uv": [ - 6.0, - 2.0, - 0.0, - 4.0 - ] - } - }, - "from": [ - 0, - 0, - 0 - ], - "to": [ - 6, - 2, - 2 - ] - }, { "faces": { "down": { diff --git a/src/generated/resources/assets/megacells/models/block/drive/cells/4m_item_cell.json b/src/generated/resources/assets/megacells/models/block/drive/cells/4m_item_cell.json index cb8612b9..1fa1e7f1 100644 --- a/src/generated/resources/assets/megacells/models/block/drive/cells/4m_item_cell.json +++ b/src/generated/resources/assets/megacells/models/block/drive/cells/4m_item_cell.json @@ -1,50 +1,6 @@ { "ambientocclusion": false, "elements": [ - { - "faces": { - "down": { - "cullface": "north", - "texture": "#cell", - "uv": [ - 6.0, - 2.0, - 0.0, - 4.0 - ] - }, - "north": { - "cullface": "north", - "texture": "#cell", - "uv": [ - 0.0, - 2.0, - 6.0, - 4.0 - ] - }, - "up": { - "cullface": "north", - "texture": "#cell", - "uv": [ - 6.0, - 2.0, - 0.0, - 4.0 - ] - } - }, - "from": [ - 0, - 0, - 0 - ], - "to": [ - 6, - 2, - 2 - ] - }, { "faces": { "down": { diff --git a/src/generated/resources/assets/megacells/models/block/drive/cells/4m_source_cell.json b/src/generated/resources/assets/megacells/models/block/drive/cells/4m_source_cell.json index 06f180cc..2e462fc9 100644 --- a/src/generated/resources/assets/megacells/models/block/drive/cells/4m_source_cell.json +++ b/src/generated/resources/assets/megacells/models/block/drive/cells/4m_source_cell.json @@ -1,50 +1,6 @@ { "ambientocclusion": false, "elements": [ - { - "faces": { - "down": { - "cullface": "north", - "texture": "#cell", - "uv": [ - 6.0, - 2.0, - 0.0, - 4.0 - ] - }, - "north": { - "cullface": "north", - "texture": "#cell", - "uv": [ - 0.0, - 2.0, - 6.0, - 4.0 - ] - }, - "up": { - "cullface": "north", - "texture": "#cell", - "uv": [ - 6.0, - 2.0, - 0.0, - 4.0 - ] - } - }, - "from": [ - 0, - 0, - 0 - ], - "to": [ - 6, - 2, - 2 - ] - }, { "faces": { "down": { diff --git a/src/generated/resources/assets/megacells/models/block/drive/cells/64m_chemical_cell.json b/src/generated/resources/assets/megacells/models/block/drive/cells/64m_chemical_cell.json index 368b753c..09f9fd4d 100644 --- a/src/generated/resources/assets/megacells/models/block/drive/cells/64m_chemical_cell.json +++ b/src/generated/resources/assets/megacells/models/block/drive/cells/64m_chemical_cell.json @@ -1,50 +1,6 @@ { "ambientocclusion": false, "elements": [ - { - "faces": { - "down": { - "cullface": "north", - "texture": "#cell", - "uv": [ - 6.0, - 6.0, - 0.0, - 8.0 - ] - }, - "north": { - "cullface": "north", - "texture": "#cell", - "uv": [ - 0.0, - 6.0, - 6.0, - 8.0 - ] - }, - "up": { - "cullface": "north", - "texture": "#cell", - "uv": [ - 6.0, - 6.0, - 0.0, - 8.0 - ] - } - }, - "from": [ - 0, - 0, - 0 - ], - "to": [ - 6, - 2, - 2 - ] - }, { "faces": { "down": { diff --git a/src/generated/resources/assets/megacells/models/block/drive/cells/64m_fluid_cell.json b/src/generated/resources/assets/megacells/models/block/drive/cells/64m_fluid_cell.json index df5e3707..be495e5f 100644 --- a/src/generated/resources/assets/megacells/models/block/drive/cells/64m_fluid_cell.json +++ b/src/generated/resources/assets/megacells/models/block/drive/cells/64m_fluid_cell.json @@ -1,50 +1,6 @@ { "ambientocclusion": false, "elements": [ - { - "faces": { - "down": { - "cullface": "north", - "texture": "#cell", - "uv": [ - 6.0, - 6.0, - 0.0, - 8.0 - ] - }, - "north": { - "cullface": "north", - "texture": "#cell", - "uv": [ - 0.0, - 6.0, - 6.0, - 8.0 - ] - }, - "up": { - "cullface": "north", - "texture": "#cell", - "uv": [ - 6.0, - 6.0, - 0.0, - 8.0 - ] - } - }, - "from": [ - 0, - 0, - 0 - ], - "to": [ - 6, - 2, - 2 - ] - }, { "faces": { "down": { diff --git a/src/generated/resources/assets/megacells/models/block/drive/cells/64m_item_cell.json b/src/generated/resources/assets/megacells/models/block/drive/cells/64m_item_cell.json index 54acd7de..c88e7f90 100644 --- a/src/generated/resources/assets/megacells/models/block/drive/cells/64m_item_cell.json +++ b/src/generated/resources/assets/megacells/models/block/drive/cells/64m_item_cell.json @@ -1,50 +1,6 @@ { "ambientocclusion": false, "elements": [ - { - "faces": { - "down": { - "cullface": "north", - "texture": "#cell", - "uv": [ - 6.0, - 6.0, - 0.0, - 8.0 - ] - }, - "north": { - "cullface": "north", - "texture": "#cell", - "uv": [ - 0.0, - 6.0, - 6.0, - 8.0 - ] - }, - "up": { - "cullface": "north", - "texture": "#cell", - "uv": [ - 6.0, - 6.0, - 0.0, - 8.0 - ] - } - }, - "from": [ - 0, - 0, - 0 - ], - "to": [ - 6, - 2, - 2 - ] - }, { "faces": { "down": { diff --git a/src/generated/resources/assets/megacells/models/block/drive/cells/64m_source_cell.json b/src/generated/resources/assets/megacells/models/block/drive/cells/64m_source_cell.json index 28eb25ec..e107d021 100644 --- a/src/generated/resources/assets/megacells/models/block/drive/cells/64m_source_cell.json +++ b/src/generated/resources/assets/megacells/models/block/drive/cells/64m_source_cell.json @@ -1,50 +1,6 @@ { "ambientocclusion": false, "elements": [ - { - "faces": { - "down": { - "cullface": "north", - "texture": "#cell", - "uv": [ - 6.0, - 6.0, - 0.0, - 8.0 - ] - }, - "north": { - "cullface": "north", - "texture": "#cell", - "uv": [ - 0.0, - 6.0, - 6.0, - 8.0 - ] - }, - "up": { - "cullface": "north", - "texture": "#cell", - "uv": [ - 6.0, - 6.0, - 0.0, - 8.0 - ] - } - }, - "from": [ - 0, - 0, - 0 - ], - "to": [ - 6, - 2, - 2 - ] - }, { "faces": { "down": { diff --git a/src/main/java/gripe/_90/megacells/MEGACells.java b/src/main/java/gripe/_90/megacells/MEGACells.java index 387c26f0..5bb380cc 100644 --- a/src/main/java/gripe/_90/megacells/MEGACells.java +++ b/src/main/java/gripe/_90/megacells/MEGACells.java @@ -46,10 +46,7 @@ import gripe._90.megacells.definition.MEGAMenus; import gripe._90.megacells.definition.MEGATranslations; import gripe._90.megacells.integration.Addons; -import gripe._90.megacells.integration.ae2wt.AE2WTIntegration; -import gripe._90.megacells.integration.appmek.AppMekIntegration; import gripe._90.megacells.integration.appmek.RadioactiveCellItem; -import gripe._90.megacells.integration.arseng.ArsEngIntegration; import gripe._90.megacells.item.cell.BulkCellItem; import gripe._90.megacells.misc.CompressionService; @@ -87,32 +84,22 @@ private static void initUpgrades(FMLCommonSetupEvent event) { var interfaceGroup = GuiText.Interface.getTranslationKey(); var wirelessTerminalGroup = GuiText.WirelessTerminals.getTranslationKey(); - for (var itemCell : MEGAItems.getItemCells()) { - Upgrades.add(AEItems.FUZZY_CARD, itemCell, 1, storageCellGroup); - Upgrades.add(AEItems.INVERTER_CARD, itemCell, 1, storageCellGroup); - Upgrades.add(AEItems.EQUAL_DISTRIBUTION_CARD, itemCell, 1, storageCellGroup); - Upgrades.add(AEItems.VOID_CARD, itemCell, 1, storageCellGroup); - } + for (var cell : MEGAItems.getTieredCells()) { + if (!(cell.keyType().equals("item") || cell.keyType().equals("fluid"))) { + continue; + } - for (var fluidCell : MEGAItems.getFluidCells()) { - Upgrades.add(AEItems.INVERTER_CARD, fluidCell, 1, storageCellGroup); - Upgrades.add(AEItems.EQUAL_DISTRIBUTION_CARD, fluidCell, 1, storageCellGroup); - Upgrades.add(AEItems.VOID_CARD, fluidCell, 1, storageCellGroup); - } + Upgrades.add(AEItems.INVERTER_CARD, cell.item(), 1, storageCellGroup); + Upgrades.add(AEItems.EQUAL_DISTRIBUTION_CARD, cell.item(), 1, storageCellGroup); + Upgrades.add(AEItems.VOID_CARD, cell.item(), 1, storageCellGroup); - for (var itemPortable : MEGAItems.getItemPortables()) { - Upgrades.add(AEItems.FUZZY_CARD, itemPortable, 1, portableCellGroup); - Upgrades.add(AEItems.INVERTER_CARD, itemPortable, 1, portableCellGroup); - Upgrades.add(MEGAItems.GREATER_ENERGY_CARD, itemPortable, 2, portableCellGroup); - Upgrades.add(AEItems.EQUAL_DISTRIBUTION_CARD, itemPortable, 1, storageCellGroup); - Upgrades.add(AEItems.VOID_CARD, itemPortable, 1, storageCellGroup); - } + if (cell.keyType().equals("item")) { + Upgrades.add(AEItems.FUZZY_CARD, cell.item(), 1, storageCellGroup); + } - for (var fluidPortable : MEGAItems.getFluidPortables()) { - Upgrades.add(AEItems.INVERTER_CARD, fluidPortable, 1, portableCellGroup); - Upgrades.add(MEGAItems.GREATER_ENERGY_CARD, fluidPortable, 2, portableCellGroup); - Upgrades.add(AEItems.EQUAL_DISTRIBUTION_CARD, fluidPortable, 1, storageCellGroup); - Upgrades.add(AEItems.VOID_CARD, fluidPortable, 1, storageCellGroup); + if (cell.portable()) { + Upgrades.add(MEGAItems.GREATER_ENERGY_CARD, cell.item(), 2, portableCellGroup); + } } Upgrades.add(AEItems.CRAFTING_CARD, MEGABlocks.MEGA_INTERFACE, 1, interfaceGroup); @@ -142,15 +129,11 @@ private static void initUpgrades(FMLCommonSetupEvent event) { Upgrades.add(MEGAItems.GREATER_ENERGY_CARD, portableCell, 2, portableCellGroup); } - if (Addons.AE2WTLIB_API.isLoaded()) { - AE2WTIntegration.initUpgrades(); + for (var addon : Addons.values()) { + if (addon.isLoaded()) { + addon.getHelper().initUpgrades(); + } } - - if (Addons.APPMEK.isLoaded()) { - AppMekIntegration.initUpgrades(); - } - - if (Addons.ARSENG.isLoaded()) ArsEngIntegration.initUpgrades(); }); } @@ -158,10 +141,16 @@ private static void initStorageCells(FMLCommonSetupEvent event) { event.enqueueWork(() -> { StorageCells.addCellHandler(BulkCellItem.HANDLER); - MEGAItems.getItemPortables() - .forEach(cell -> HotkeyActions.registerPortableCell(cell, HotkeyAction.PORTABLE_ITEM_CELL)); - MEGAItems.getFluidPortables() - .forEach(cell -> HotkeyActions.registerPortableCell(cell, HotkeyAction.PORTABLE_FLUID_CELL)); + for (var cell : MEGAItems.getTieredCells()) { + if (cell.item().asItem() instanceof AbstractPortableCell portable) { + HotkeyActions.register( + portable, + portable::openFromInventory, + cell.keyType().equals("item") + ? HotkeyAction.PORTABLE_ITEM_CELL + : HotkeyAction.PORTABLE_FLUID_CELL); + } + } if (Addons.APPMEK.isLoaded()) { StorageCells.addCellHandler(RadioactiveCellItem.HANDLER); @@ -207,25 +196,17 @@ private static void initCapabilities(RegisterCapabilitiesEvent event) { MEGABlockEntities.MEGA_PATTERN_PROVIDER.get(), (be, context) -> be.getLogic().getReturnInv()); - MEGAItems.getItemPortables().forEach(portable -> registerPoweredItemCapability(event, portable.get())); - MEGAItems.getFluidPortables().forEach(portable -> registerPoweredItemCapability(event, portable.get())); - - for (var portable : MEGAItems.getChemicalPortables()) { - if (portable.get() instanceof AbstractPortableCell cell) { - registerPoweredItemCapability(event, cell); - } - } - - for (var portable : MEGAItems.getSourcePortables()) { - if (portable.get() instanceof AbstractPortableCell cell) { - registerPoweredItemCapability(event, cell); + for (var cell : MEGAItems.getTieredCells()) { + if (cell.portable()) { + registerPoweredItemCapability(event, cell.item().asItem()); } } } - private static void registerPoweredItemCapability( - RegisterCapabilitiesEvent event, T item) { - event.registerItem( - Capabilities.EnergyStorage.ITEM, (object, context) -> new PoweredItemCapabilities(object, item), item); + private static void registerPoweredItemCapability(RegisterCapabilitiesEvent event, T item) { + if (item instanceof IAEItemPowerStorage powered) { + event.registerItem( + Capabilities.EnergyStorage.ITEM, (stack, ctx) -> new PoweredItemCapabilities(stack, powered), item); + } } } diff --git a/src/main/java/gripe/_90/megacells/client/MEGACellsClient.java b/src/main/java/gripe/_90/megacells/client/MEGACellsClient.java index bd0771a8..6aab618e 100644 --- a/src/main/java/gripe/_90/megacells/client/MEGACellsClient.java +++ b/src/main/java/gripe/_90/megacells/client/MEGACellsClient.java @@ -2,8 +2,6 @@ import java.util.ArrayList; -import net.minecraft.client.renderer.ItemBlockRenderTypes; -import net.minecraft.client.renderer.RenderType; import net.minecraft.client.renderer.blockentity.BlockEntityRenderers; import net.minecraft.client.renderer.item.ItemProperties; import net.minecraft.util.FastColor; @@ -37,7 +35,6 @@ import gripe._90.megacells.menu.MEGAInterfaceMenu; import gripe._90.megacells.menu.MEGAPatternProviderMenu; -@SuppressWarnings("unused") @Mod(value = MEGACells.MODID, dist = Dist.CLIENT) public class MEGACellsClient { public MEGACellsClient(IEventBus eventBus) { @@ -61,15 +58,12 @@ private static void initScreens(RegisterMenuScreensEvent event) { "/screens/megacells/mega_pattern_provider.json"); } - @SuppressWarnings("deprecation") private static void initCraftingUnitModels(FMLClientSetupEvent event) { event.enqueueWork(() -> { for (var type : MEGACraftingUnitType.values()) { BuiltInModelHooks.addBuiltInModel( MEGACells.makeId("block/crafting/" + type.getAffix() + "_formed"), new CraftingCubeModel(new MEGACraftingUnitModelProvider(type))); - - ItemBlockRenderTypes.setRenderLayer(type.getDefinition().block(), RenderType.cutout()); } BlockEntityRenderers.register(MEGABlockEntities.MEGA_CRAFTING_MONITOR.get(), CraftingMonitorRenderer::new); @@ -92,7 +86,7 @@ private static void initStorageCellModels(FMLClientSetupEvent event) { event.enqueueWork(() -> { var modelPrefix = "block/drive/cells/"; - for (var cell : MEGAItems.getAllCells()) { + for (var cell : MEGAItems.getTieredCells()) { StorageCellModels.registerModel( cell.item(), MEGACells.makeId(modelPrefix + cell.tier().namePrefix() + "_" + cell.keyType() + "_cell")); @@ -111,19 +105,19 @@ private static void initStorageCellModels(FMLClientSetupEvent event) { private static void initItemColours(RegisterColorHandlersEvent.Item event) { var standardCells = new ArrayList(); - standardCells.addAll(MEGAItems.getItemCells()); - standardCells.addAll(MEGAItems.getFluidCells()); - standardCells.addAll(MEGAItems.getChemicalCells()); - standardCells.addAll(MEGAItems.getSourceCells()); + var portableCells = new ArrayList(); + + for (var cell : MEGAItems.getTieredCells()) { + if (cell.portable()) { + portableCells.add(cell.item()); + } else { + standardCells.add(cell.item()); + } + } + standardCells.add(MEGAItems.BULK_ITEM_CELL); standardCells.add(MEGAItems.RADIOACTIVE_CHEMICAL_CELL); - var portableCells = new ArrayList(); - portableCells.addAll(MEGAItems.getItemPortables()); - portableCells.addAll(MEGAItems.getFluidPortables()); - portableCells.addAll(MEGAItems.getChemicalPortables()); - portableCells.addAll(MEGAItems.getSourcePortables()); - event.register( (stack, tintIndex) -> FastColor.ARGB32.opaque(BasicStorageCell.getColor(stack, tintIndex)), standardCells.toArray(new ItemLike[0])); diff --git a/src/main/java/gripe/_90/megacells/definition/MEGAItems.java b/src/main/java/gripe/_90/megacells/definition/MEGAItems.java index a99b757f..fcf8321d 100644 --- a/src/main/java/gripe/_90/megacells/definition/MEGAItems.java +++ b/src/main/java/gripe/_90/megacells/definition/MEGAItems.java @@ -24,15 +24,12 @@ import appeng.items.parts.PartModelsHelper; import appeng.items.storage.BasicStorageCell; import appeng.items.storage.StorageTier; -import appeng.items.tools.powered.AbstractPortableCell; import appeng.menu.me.common.MEStorageMenu; import gripe._90.megacells.MEGACells; import gripe._90.megacells.integration.Addons; import gripe._90.megacells.integration.DummyIntegrationItem; -import gripe._90.megacells.integration.appmek.AppMekIntegration; import gripe._90.megacells.integration.appmek.RadioactiveCellItem; -import gripe._90.megacells.integration.arseng.ArsEngIntegration; import gripe._90.megacells.item.cell.BulkCellItem; import gripe._90.megacells.item.cell.MEGAPortableCell; import gripe._90.megacells.item.part.DecompressionModulePart; @@ -51,7 +48,7 @@ public static List> getItems() { return Collections.unmodifiableList(ITEMS); } - public static List getAllCells() { + public static List getTieredCells() { return Collections.unmodifiableList(CELLS); } @@ -145,17 +142,22 @@ public static List getAllCells() { public static final ItemDefinition MEGA_CHEMICAL_CELL_HOUSING = integrationItem( "MEGA Chemical Cell Housing", "mega_chemical_cell_housing", () -> MaterialItem::new, Addons.APPMEK); - public static final ItemDefinition CHEMICAL_CELL_1M = chemCell(TIER_1M); - public static final ItemDefinition CHEMICAL_CELL_4M = chemCell(TIER_4M); - public static final ItemDefinition CHEMICAL_CELL_16M = chemCell(TIER_16M); - public static final ItemDefinition CHEMICAL_CELL_64M = chemCell(TIER_64M); - public static final ItemDefinition CHEMICAL_CELL_256M = chemCell(TIER_256M); - - public static final ItemDefinition PORTABLE_CHEMICAL_CELL_1M = chemPortable(TIER_1M); - public static final ItemDefinition PORTABLE_CHEMICAL_CELL_4M = chemPortable(TIER_4M); - public static final ItemDefinition PORTABLE_CHEMICAL_CELL_16M = chemPortable(TIER_16M); - public static final ItemDefinition PORTABLE_CHEMICAL_CELL_64M = chemPortable(TIER_64M); - public static final ItemDefinition PORTABLE_CHEMICAL_CELL_256M = chemPortable(TIER_256M); + public static final ItemDefinition CHEMICAL_CELL_1M = integrationCell(TIER_1M, "Chemical", Addons.APPMEK); + public static final ItemDefinition CHEMICAL_CELL_4M = integrationCell(TIER_4M, "Chemical", Addons.APPMEK); + public static final ItemDefinition CHEMICAL_CELL_16M = integrationCell(TIER_16M, "Chemical", Addons.APPMEK); + public static final ItemDefinition CHEMICAL_CELL_64M = integrationCell(TIER_64M, "Chemical", Addons.APPMEK); + public static final ItemDefinition CHEMICAL_CELL_256M = integrationCell(TIER_256M, "Chemical", Addons.APPMEK); + + public static final ItemDefinition PORTABLE_CHEMICAL_CELL_1M = + integrationPortable(TIER_1M, "Chemical", Addons.APPMEK); + public static final ItemDefinition PORTABLE_CHEMICAL_CELL_4M = + integrationPortable(TIER_4M, "Chemical", Addons.APPMEK); + public static final ItemDefinition PORTABLE_CHEMICAL_CELL_16M = + integrationPortable(TIER_16M, "Chemical", Addons.APPMEK); + public static final ItemDefinition PORTABLE_CHEMICAL_CELL_64M = + integrationPortable(TIER_64M, "Chemical", Addons.APPMEK); + public static final ItemDefinition PORTABLE_CHEMICAL_CELL_256M = + integrationPortable(TIER_256M, "Chemical", Addons.APPMEK); public static final ItemDefinition RADIOACTIVE_CELL_COMPONENT = integrationItem( "MEGA Radioactive Storage Component", "radioactive_cell_component", () -> MaterialItem::new, Addons.APPMEK); @@ -168,69 +170,22 @@ public static List getAllCells() { public static final ItemDefinition MEGA_SOURCE_CELL_HOUSING = integrationItem( "MEGA Source Cell Housing", "mega_source_cell_housing", () -> MaterialItem::new, Addons.ARSENG); - public static final ItemDefinition SOURCE_CELL_1M = sourceCell(TIER_1M); - public static final ItemDefinition SOURCE_CELL_4M = sourceCell(TIER_4M); - public static final ItemDefinition SOURCE_CELL_16M = sourceCell(TIER_16M); - public static final ItemDefinition SOURCE_CELL_64M = sourceCell(TIER_64M); - public static final ItemDefinition SOURCE_CELL_256M = sourceCell(TIER_256M); - - public static final ItemDefinition PORTABLE_SOURCE_CELL_1M = sourcePortable(TIER_1M); - public static final ItemDefinition PORTABLE_SOURCE_CELL_4M = sourcePortable(TIER_4M); - public static final ItemDefinition PORTABLE_SOURCE_CELL_16M = sourcePortable(TIER_16M); - public static final ItemDefinition PORTABLE_SOURCE_CELL_64M = sourcePortable(TIER_64M); - public static final ItemDefinition PORTABLE_SOURCE_CELL_256M = sourcePortable(TIER_256M); - - public static List> getItemCells() { - return List.of(ITEM_CELL_1M, ITEM_CELL_4M, ITEM_CELL_16M, ITEM_CELL_64M, ITEM_CELL_256M); - } - - public static List> getFluidCells() { - return List.of(FLUID_CELL_1M, FLUID_CELL_4M, FLUID_CELL_16M, FLUID_CELL_64M, FLUID_CELL_256M); - } - - public static List> getChemicalCells() { - return List.of(CHEMICAL_CELL_1M, CHEMICAL_CELL_4M, CHEMICAL_CELL_16M, CHEMICAL_CELL_64M, CHEMICAL_CELL_256M); - } - - public static List> getSourceCells() { - return List.of(SOURCE_CELL_1M, SOURCE_CELL_4M, SOURCE_CELL_16M, SOURCE_CELL_64M, SOURCE_CELL_256M); - } - - public static List> getItemPortables() { - return List.of( - PORTABLE_ITEM_CELL_1M, - PORTABLE_ITEM_CELL_4M, - PORTABLE_ITEM_CELL_16M, - PORTABLE_ITEM_CELL_64M, - PORTABLE_ITEM_CELL_256M); - } - - public static List> getFluidPortables() { - return List.of( - PORTABLE_FLUID_CELL_1M, - PORTABLE_FLUID_CELL_4M, - PORTABLE_FLUID_CELL_16M, - PORTABLE_FLUID_CELL_64M, - PORTABLE_FLUID_CELL_256M); - } - - public static List> getChemicalPortables() { - return List.of( - PORTABLE_CHEMICAL_CELL_1M, - PORTABLE_CHEMICAL_CELL_4M, - PORTABLE_CHEMICAL_CELL_16M, - PORTABLE_CHEMICAL_CELL_64M, - PORTABLE_CHEMICAL_CELL_256M); - } - - public static List> getSourcePortables() { - return List.of( - PORTABLE_SOURCE_CELL_1M, - PORTABLE_SOURCE_CELL_4M, - PORTABLE_SOURCE_CELL_16M, - PORTABLE_SOURCE_CELL_64M, - PORTABLE_SOURCE_CELL_256M); - } + public static final ItemDefinition SOURCE_CELL_1M = integrationCell(TIER_1M, "Source", Addons.ARSENG); + public static final ItemDefinition SOURCE_CELL_4M = integrationCell(TIER_4M, "Source", Addons.ARSENG); + public static final ItemDefinition SOURCE_CELL_16M = integrationCell(TIER_16M, "Source", Addons.ARSENG); + public static final ItemDefinition SOURCE_CELL_64M = integrationCell(TIER_64M, "Source", Addons.ARSENG); + public static final ItemDefinition SOURCE_CELL_256M = integrationCell(TIER_256M, "Source", Addons.ARSENG); + + public static final ItemDefinition PORTABLE_SOURCE_CELL_1M = + integrationPortable(TIER_1M, "Source", Addons.ARSENG); + public static final ItemDefinition PORTABLE_SOURCE_CELL_4M = + integrationPortable(TIER_4M, "Source", Addons.ARSENG); + public static final ItemDefinition PORTABLE_SOURCE_CELL_16M = + integrationPortable(TIER_16M, "Source", Addons.ARSENG); + public static final ItemDefinition PORTABLE_SOURCE_CELL_64M = + integrationPortable(TIER_64M, "Source", Addons.ARSENG); + public static final ItemDefinition PORTABLE_SOURCE_CELL_256M = + integrationPortable(TIER_256M, "Source", Addons.ARSENG); private static StorageTier tier(int index, ItemDefinition component) { int multiplier = (int) Math.pow(4, index - 1); @@ -257,7 +212,7 @@ private static ItemDefinition itemCell(StorageTier tier) { tier.bytes() / 128, 63, AEKeyType.items())); - CELLS.add(new CellDefinition(cell, tier, "item")); + CELLS.add(new CellDefinition(cell, tier, "item", false)); return cell; } @@ -274,29 +229,18 @@ private static ItemDefinition fluidCell(StorageTier tier) { tier.bytes() / 128, 18, AEKeyType.fluids())); - CELLS.add(new CellDefinition(cell, tier, "fluid")); + CELLS.add(new CellDefinition(cell, tier, "fluid", false)); return cell; } - private static ItemDefinition chemCell(StorageTier tier) { + private static ItemDefinition integrationCell(StorageTier tier, String type, Addons addon) { var cell = integrationItem( - tier.namePrefix().toUpperCase() + " MEGA Chemical Storage Cell", - "chemical_storage_cell_" + tier.namePrefix(), - () -> AppMekIntegration.createChemCell(tier), - p -> p.stacksTo(1), - Addons.APPMEK); - CELLS.add(new CellDefinition(cell, tier, "chemical")); - return cell; - } - - private static ItemDefinition sourceCell(StorageTier tier) { - var cell = integrationItem( - tier.namePrefix().toUpperCase() + " MEGA Source Storage Cell", - "source_storage_cell_" + tier.namePrefix(), - () -> ArsEngIntegration.createSourceCell(tier), - p -> p.stacksTo(1), - Addons.ARSENG); - CELLS.add(new CellDefinition(cell, tier, "source")); + tier.namePrefix().toUpperCase() + " MEGA " + type + " Storage Cell", + type.toLowerCase() + "_storage_cell_" + tier.namePrefix(), + () -> addon.getHelper().createCell(tier), + props -> props.stacksTo(1), + addon); + CELLS.add(new CellDefinition(cell, tier, type.toLowerCase(), false)); return cell; } @@ -305,7 +249,7 @@ private static ItemDefinition itemPortable(StorageTier tier) { tier.namePrefix().toUpperCase() + " Portable Item Cell", "portable_item_cell_" + tier.namePrefix(), p -> new MEGAPortableCell(p, tier, AEKeyType.items(), MEStorageMenu.PORTABLE_ITEM_CELL_TYPE, 0x80caff)); - CELLS.add(new CellDefinition(cell, tier, "item")); + CELLS.add(new CellDefinition(cell, tier, "item", true)); return cell; } @@ -315,29 +259,18 @@ private static ItemDefinition fluidPortable(StorageTier tier) "portable_fluid_cell_" + tier.namePrefix(), p -> new MEGAPortableCell( p, tier, AEKeyType.fluids(), MEStorageMenu.PORTABLE_FLUID_CELL_TYPE, 0x80caff)); - CELLS.add(new CellDefinition(cell, tier, "fluid")); - return cell; - } - - private static ItemDefinition chemPortable(StorageTier tier) { - var cell = integrationItem( - tier.namePrefix().toUpperCase() + " Portable Chemical Cell", - "portable_chemical_cell_" + tier.namePrefix(), - () -> AppMekIntegration.createChemPortable(tier), - p -> p.stacksTo(1), - Addons.APPMEK); - CELLS.add(new CellDefinition(cell, tier, "chemical")); + CELLS.add(new CellDefinition(cell, tier, "fluid", true)); return cell; } - private static ItemDefinition sourcePortable(StorageTier tier) { + private static ItemDefinition integrationPortable(StorageTier tier, String type, Addons addon) { var cell = integrationItem( - tier.namePrefix().toUpperCase() + " Portable Source Cell", - "portable_source_cell_" + tier.namePrefix(), - () -> ArsEngIntegration.createSourcePortable(tier), - p -> p.stacksTo(1), - Addons.ARSENG); - CELLS.add(new CellDefinition(cell, tier, "source")); + tier.namePrefix().toUpperCase() + " Portable " + type + " Cell", + "portable_" + type.toLowerCase() + "_cell_" + tier.namePrefix(), + () -> addon.getHelper().createPortable(tier), + props -> props.stacksTo(1), + addon); + CELLS.add(new CellDefinition(cell, tier, type.toLowerCase(), true)); return cell; } @@ -373,5 +306,5 @@ private static ItemDefinition integrationItem( return integrationItem(englishName, id, factory, p -> p, addon); } - public record CellDefinition(ItemDefinition item, StorageTier tier, String keyType) {} + public record CellDefinition(ItemDefinition item, StorageTier tier, String keyType, boolean portable) {} } diff --git a/src/main/java/gripe/_90/megacells/integration/Addons.java b/src/main/java/gripe/_90/megacells/integration/Addons.java index cf91e7d7..5eed4b5d 100644 --- a/src/main/java/gripe/_90/megacells/integration/Addons.java +++ b/src/main/java/gripe/_90/megacells/integration/Addons.java @@ -1,22 +1,34 @@ package gripe._90.megacells.integration; +import java.util.function.Supplier; + import net.minecraft.data.recipes.RecipeOutput; import net.neoforged.fml.ModList; import net.neoforged.fml.loading.LoadingModList; import net.neoforged.fml.loading.moddiscovery.ModInfo; import net.neoforged.neoforge.common.conditions.ModLoadedCondition; +import net.neoforged.neoforge.common.util.Lazy; + +import gripe._90.megacells.integration.ae2wt.AE2WTIntegration; +import gripe._90.megacells.integration.appmek.AppMekIntegration; +import gripe._90.megacells.integration.arseng.ArsEngIntegration; +@SuppressWarnings("Convert2MethodRef") public enum Addons { - APPMEK("Applied Mekanistics"), - APPBOT("Applied Botanics"), - ARSENG("Ars Énergistique"), - APPLIEDE("AppliedE"), - AE2WTLIB_API("AE2WTLib API"); + APPMEK("Applied Mekanistics", () -> new AppMekIntegration()), + ARSENG("Ars Énergistique", () -> new ArsEngIntegration()), + AE2WTLIB_API("AE2WTLib", () -> new AE2WTIntegration()) +// APPBOT("Applied Botanics"), +// APPLIEDE("AppliedE"), +// APPELEM("Applied Elemental"), +; private final String modName; + private final Supplier helper; - Addons(String modName) { + Addons(String modName, Supplier helper) { this.modName = modName; + this.helper = Lazy.of(helper); } public String getModId() { @@ -27,6 +39,10 @@ public String getModName() { return modName; } + public IntegrationHelper getHelper() { + return helper.get(); + } + public boolean isLoaded() { return ModList.get() != null ? ModList.get().isLoaded(getModId()) diff --git a/src/main/java/gripe/_90/megacells/integration/IntegrationHelper.java b/src/main/java/gripe/_90/megacells/integration/IntegrationHelper.java new file mode 100644 index 00000000..70c4e642 --- /dev/null +++ b/src/main/java/gripe/_90/megacells/integration/IntegrationHelper.java @@ -0,0 +1,15 @@ +package gripe._90.megacells.integration; + +import java.util.function.Function; + +import net.minecraft.world.item.Item; + +import appeng.items.storage.StorageTier; + +public interface IntegrationHelper { + Function createCell(StorageTier tier); + + Function createPortable(StorageTier tier); + + void initUpgrades(); +} diff --git a/src/main/java/gripe/_90/megacells/integration/ae2wt/AE2WTIntegration.java b/src/main/java/gripe/_90/megacells/integration/ae2wt/AE2WTIntegration.java index c5d2e144..025e7802 100644 --- a/src/main/java/gripe/_90/megacells/integration/ae2wt/AE2WTIntegration.java +++ b/src/main/java/gripe/_90/megacells/integration/ae2wt/AE2WTIntegration.java @@ -2,10 +2,29 @@ import static gripe._90.megacells.definition.MEGAItems.GREATER_ENERGY_CARD; +import java.util.function.Function; + +import net.minecraft.world.item.Item; + +import appeng.items.storage.StorageTier; + import de.mari_023.ae2wtlib.api.registration.UpgradeHelper; -public final class AE2WTIntegration { - public static void initUpgrades() { +import gripe._90.megacells.integration.IntegrationHelper; + +public final class AE2WTIntegration implements IntegrationHelper { + @Override + public Function createCell(StorageTier tier) { + throw new UnsupportedOperationException(); + } + + @Override + public Function createPortable(StorageTier tier) { + throw new UnsupportedOperationException(); + } + + @Override + public void initUpgrades() { UpgradeHelper.addUpgradeToAllTerminals(GREATER_ENERGY_CARD, 0); } } diff --git a/src/main/java/gripe/_90/megacells/integration/appmek/AppMekIntegration.java b/src/main/java/gripe/_90/megacells/integration/appmek/AppMekIntegration.java index 8f903e63..a6e0e8b2 100644 --- a/src/main/java/gripe/_90/megacells/integration/appmek/AppMekIntegration.java +++ b/src/main/java/gripe/_90/megacells/integration/appmek/AppMekIntegration.java @@ -20,14 +20,17 @@ import mekanism.api.chemical.attribute.ChemicalAttributeValidator; import gripe._90.megacells.definition.MEGAItems; +import gripe._90.megacells.integration.IntegrationHelper; import gripe._90.megacells.item.cell.MEGAPortableCell; -public final class AppMekIntegration { - public static Function createChemCell(StorageTier tier) { +public final class AppMekIntegration implements IntegrationHelper { + @Override + public Function createCell(StorageTier tier) { return p -> new ChemicalStorageCell(p, tier, MEGAItems.MEGA_CHEMICAL_CELL_HOUSING); } - public static Function createChemPortable(StorageTier tier) { + @Override + public Function createPortable(StorageTier tier) { return p -> new MEGAPortableCell(p, tier, MekanismKeyType.TYPE, AMMenus.PORTABLE_CHEMICAL_CELL_TYPE, 0x80caff) { @Override public boolean isBlackListed(ItemStack cellItem, AEKey requestedAddition) { @@ -37,22 +40,22 @@ public boolean isBlackListed(ItemStack cellItem, AEKey requestedAddition) { }; } - public static void initUpgrades() { + @Override + public void initUpgrades() { var storageCellGroup = GuiText.StorageCells.getTranslationKey(); var portableCellGroup = GuiText.PortableCells.getTranslationKey(); - MEGAItems.getChemicalCells().forEach(cell -> { - Upgrades.add(AEItems.INVERTER_CARD, cell, 1, storageCellGroup); - Upgrades.add(AEItems.EQUAL_DISTRIBUTION_CARD, cell, 1, storageCellGroup); - Upgrades.add(AEItems.VOID_CARD, cell, 1, storageCellGroup); - }); + for (var cell : MEGAItems.getTieredCells()) { + if (cell.keyType().equals("chemical")) { + Upgrades.add(AEItems.INVERTER_CARD, cell.item(), 1, storageCellGroup); + Upgrades.add(AEItems.EQUAL_DISTRIBUTION_CARD, cell.item(), 1, storageCellGroup); + Upgrades.add(AEItems.VOID_CARD, cell.item(), 1, storageCellGroup); - MEGAItems.getChemicalPortables().forEach(portable -> { - Upgrades.add(AEItems.INVERTER_CARD, portable, 1, portableCellGroup); - Upgrades.add(MEGAItems.GREATER_ENERGY_CARD, portable, 2, portableCellGroup); - Upgrades.add(AEItems.EQUAL_DISTRIBUTION_CARD, portable, 1, portableCellGroup); - Upgrades.add(AEItems.VOID_CARD, portable, 1, portableCellGroup); - }); + if (cell.portable()) { + Upgrades.add(MEGAItems.GREATER_ENERGY_CARD, cell.item(), 2, portableCellGroup); + } + } + } for (var portable : List.of( AMItems.PORTABLE_CHEMICAL_CELL_1K, diff --git a/src/main/java/gripe/_90/megacells/integration/appmek/RadioactiveCellInventory.java b/src/main/java/gripe/_90/megacells/integration/appmek/RadioactiveCellInventory.java index 9ff24780..5b554b26 100644 --- a/src/main/java/gripe/_90/megacells/integration/appmek/RadioactiveCellInventory.java +++ b/src/main/java/gripe/_90/megacells/integration/appmek/RadioactiveCellInventory.java @@ -23,7 +23,7 @@ public class RadioactiveCellInventory implements StorageCell { static final int MAX_BYTES = 256; - private static final long MAX_MB = (long) MAX_BYTES * MekanismKeyType.TYPE.getAmountPerByte(); + private static final int MAX_MB = MAX_BYTES * MekanismKeyType.TYPE.getAmountPerByte(); private final ISaveProvider container; private final ItemStack stack; diff --git a/src/main/java/gripe/_90/megacells/integration/arseng/ArsEngIntegration.java b/src/main/java/gripe/_90/megacells/integration/arseng/ArsEngIntegration.java index 1f7ae9b6..70de5efb 100644 --- a/src/main/java/gripe/_90/megacells/integration/arseng/ArsEngIntegration.java +++ b/src/main/java/gripe/_90/megacells/integration/arseng/ArsEngIntegration.java @@ -16,13 +16,16 @@ import gripe._90.arseng.item.SourceCellItem; import gripe._90.megacells.MEGACells; import gripe._90.megacells.definition.MEGAItems; +import gripe._90.megacells.integration.IntegrationHelper; -public class ArsEngIntegration { - public static Function createSourceCell(StorageTier tier) { +public class ArsEngIntegration implements IntegrationHelper { + @Override + public Function createCell(StorageTier tier) { return p -> new SourceCellItem(p, tier, MEGAItems.MEGA_SOURCE_CELL_HOUSING); } - public static Function createSourcePortable(StorageTier tier) { + @Override + public Function createPortable(StorageTier tier) { return p -> new PortableSourceCellItem(p, tier) { @Override public ResourceLocation getRecipeId() { @@ -32,17 +35,21 @@ public ResourceLocation getRecipeId() { }; } - @SuppressWarnings("CodeBlock2Expr") - public static void initUpgrades() { - MEGAItems.getSourceCells().forEach(cell -> { - Upgrades.add(AEItems.VOID_CARD, cell, 1, GuiText.StorageCells.getTranslationKey()); - }); - MEGAItems.getSourcePortables().forEach(cell -> { - Upgrades.add(MEGAItems.GREATER_ENERGY_CARD, cell, 2, GuiText.PortableCells.getTranslationKey()); - Upgrades.add(AEItems.VOID_CARD, cell, 1, GuiText.PortableCells.getTranslationKey()); - }); - ArsEngItems.getPortables().forEach(cell -> { + @Override + public void initUpgrades() { + for (var cell : MEGAItems.getTieredCells()) { + if (cell.keyType().equals("source")) { + Upgrades.add(AEItems.VOID_CARD, cell.item(), 1, GuiText.StorageCells.getTranslationKey()); + + if (cell.portable()) { + Upgrades.add( + MEGAItems.GREATER_ENERGY_CARD, cell.item(), 2, GuiText.PortableCells.getTranslationKey()); + } + } + } + + for (var cell : ArsEngItems.getPortables()) { Upgrades.add(MEGAItems.GREATER_ENERGY_CARD, cell, 2, GuiText.PortableCells.getTranslationKey()); - }); + } } } diff --git a/src/main/java/gripe/_90/megacells/mixin/client/BuiltInModelHooksAccessor.java b/src/main/java/gripe/_90/megacells/mixin/client/BuiltInModelHooksAccessor.java index d0298847..6115d299 100644 --- a/src/main/java/gripe/_90/megacells/mixin/client/BuiltInModelHooksAccessor.java +++ b/src/main/java/gripe/_90/megacells/mixin/client/BuiltInModelHooksAccessor.java @@ -12,7 +12,7 @@ @Mixin(BuiltInModelHooks.class) public interface BuiltInModelHooksAccessor { - @Accessor(value = "builtInModels", remap = false) + @Accessor static Map getBuiltInModels() { throw new AssertionError(); }