Skip to content

Commit

Permalink
Reimplement Applied Mekanistics integration
Browse files Browse the repository at this point in the history
  • Loading branch information
62832 committed Jul 14, 2024
1 parent 89fda5d commit c521af7
Show file tree
Hide file tree
Showing 89 changed files with 2,570 additions and 277 deletions.
5 changes: 5 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@ java.toolchain.languageVersion = JavaLanguageVersion.of(21)
dependencies {
implementation(libs.ae2)
implementation(libs.ae2wtlib)

implementation(libs.appmek)
compileOnly(libs.mekanism)
compileOnly(variantOf(libs.mekanism) { classifier("generators") })
runtimeOnly(variantOf(libs.mekanism) { classifier("all") })
}

sourceSets {
Expand Down
6 changes: 5 additions & 1 deletion settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,18 @@ run {

versionCatalogs {
create("libs") {
version("minecraft", "1.21")
val mc = "1.21"
version("minecraft", mc)
version("neoforge", "21.0.87-beta")
version("parchment", "2024.06.23")

version("ae2", "19.0.12-alpha")
library("ae2", "appeng", "appliedenergistics2").versionRef("ae2")

library("ae2wtlib", "maven.modrinth", "applied-energistics-2-wireless-terminals").version("WyPbb8sE")

library("appmek", "maven.modrinth", "applied-mekanistics").version("yh6fz02r")
library("mekanism", "mekanism", "Mekanism").version("$mc-10.6.5.52")
}
}
}
Expand Down
53 changes: 16 additions & 37 deletions src/data/java/gripe/_90/megacells/datagen/MEGAModelProvider.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
import net.minecraft.data.models.blockstates.PropertyDispatch;
import net.minecraft.data.models.blockstates.Variant;
import net.minecraft.data.models.blockstates.VariantProperties;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.server.packs.PackType;
import net.minecraft.world.level.block.state.properties.BlockStateProperties;
import net.neoforged.neoforge.client.model.generators.ConfiguredModel;
Expand Down Expand Up @@ -45,39 +44,42 @@ public MEGAModelProvider(PackOutput output, ExistingFileHelper existing) {
protected void registerStatesAndModels() {
basicItem(MEGAItems.SKY_STEEL_INGOT);
basicItem(MEGAItems.SKY_BRONZE_INGOT);
basicItem(MEGAItems.SKY_OSMIUM_INGOT);

basicItem(MEGAItems.ACCUMULATION_PROCESSOR);
basicItem(MEGAItems.ACCUMULATION_PROCESSOR_PRINT);
basicItem(MEGAItems.ACCUMULATION_PROCESSOR_PRESS);

basicItem(MEGAItems.MEGA_ITEM_CELL_HOUSING);
basicItem(MEGAItems.MEGA_FLUID_CELL_HOUSING);
basicItem(MEGAItems.MEGA_CHEMICAL_CELL_HOUSING);

basicItem(MEGAItems.CELL_COMPONENT_1M);
basicItem(MEGAItems.CELL_COMPONENT_4M);
basicItem(MEGAItems.CELL_COMPONENT_16M);
basicItem(MEGAItems.CELL_COMPONENT_64M);
basicItem(MEGAItems.CELL_COMPONENT_256M);
basicItem(MEGAItems.BULK_CELL_COMPONENT);
basicItem(MEGAItems.RADIOACTIVE_CELL_COMPONENT);

basicItem(MEGAItems.GREATER_ENERGY_CARD);
basicItem(MEGAItems.COMPRESSION_CARD);

existing.trackGenerated(AppEng.makeId("item/storage_cell_led"), ModelProvider.TEXTURE);
MEGAItems.getItemCells().forEach(this::cell);
MEGAItems.getFluidCells().forEach(this::cell);
MEGAItems.getChemicalCells().forEach(this::cell);
cell(MEGAItems.BULK_ITEM_CELL);
cell(MEGAItems.RADIOACTIVE_CHEMICAL_CELL);

var itemPortableHousing = MEGACells.makeId("item/cell/portable/portable_cell_item_housing");
var fluidPortableHousing = MEGACells.makeId("item/cell/portable/portable_cell_fluid_housing");
existing.trackGenerated(itemPortableHousing, ModelProvider.TEXTURE);
existing.trackGenerated(fluidPortableHousing, ModelProvider.TEXTURE);
existing.trackGenerated(AppEng.makeId("item/portable_cell_led"), ModelProvider.TEXTURE);
MEGAItems.getItemPortables().forEach(cell -> portable(cell, itemPortableHousing));
MEGAItems.getFluidPortables().forEach(cell -> portable(cell, fluidPortableHousing));
MEGAItems.getItemPortables().forEach(cell -> portable(cell, "item"));
MEGAItems.getFluidPortables().forEach(cell -> portable(cell, "fluid"));
MEGAItems.getChemicalPortables().forEach(cell -> portable(cell, "chemical"));

MEGAItems.getAllCells().forEach(this::driveCell);
driveCell(MEGAItems.BULK_ITEM_CELL, 0);
driveCell(MEGAItems.RADIOACTIVE_CHEMICAL_CELL, 2);

var craftingPattern =
AppEng.makeId("item/" + AEItems.CRAFTING_PATTERN.id().getPath());
Expand All @@ -91,6 +93,7 @@ protected void registerStatesAndModels() {

simpleBlockWithItem(MEGABlocks.SKY_STEEL_BLOCK.block(), cubeAll(MEGABlocks.SKY_STEEL_BLOCK.block()));
simpleBlockWithItem(MEGABlocks.SKY_BRONZE_BLOCK.block(), cubeAll(MEGABlocks.SKY_BRONZE_BLOCK.block()));
simpleBlockWithItem(MEGABlocks.SKY_OSMIUM_BLOCK.block(), cubeAll(MEGABlocks.SKY_OSMIUM_BLOCK.block()));
simpleBlockWithItem(MEGABlocks.MEGA_INTERFACE.block(), cubeAll(MEGABlocks.MEGA_INTERFACE.block()));

interfaceOrProviderPart(MEGAItems.MEGA_INTERFACE);
Expand Down Expand Up @@ -194,24 +197,6 @@ protected void registerStatesAndModels() {
0);
}
}));

/*
if (Addons.APPMEK.isLoaded()) {
basicItem(AppMekItems.MEGA_CHEMICAL_CELL_HOUSING);
AppMekItems.getCells().forEach(this::cell);
var chemicalPortableHousing = MEGACells.makeId("item/cell/portable/portable_cell_chemical_housing");
existing.trackGenerated(chemicalPortableHousing, ModelProvider.TEXTURE);
AppMekItems.getPortables().forEach(cell -> portable(cell, chemicalPortableHousing));
basicItem(AppMekItems.RADIOACTIVE_CELL_COMPONENT);
cell(AppMekItems.RADIOACTIVE_CHEMICAL_CELL);
driveCell("mega_chemical_cell");
driveCell("radioactive_chemical_cell");
}
*/
}

private void basicItem(ItemDefinition<?> item) {
Expand All @@ -225,13 +210,16 @@ private void cell(ItemDefinition<?> cell) {
.texture("layer1", AppEng.makeId("item/storage_cell_led"));
}

private void portable(ItemDefinition<?> portable, ResourceLocation housing) {
private void portable(ItemDefinition<?> portable, String housingType) {
var id = portable.id().getPath();
var tierSuffix = id.substring(id.lastIndexOf('_'));
existing.trackGenerated(housing, ModelProvider.TEXTURE);

itemModels()
.singleTexture(id, mcLoc("item/generated"), "layer0", housing)
.singleTexture(
id,
mcLoc("item/generated"),
"layer0",
MEGACells.makeId("item/cell/portable/portable_cell_" + housingType + "_housing"))
.texture("layer1", AppEng.makeId("item/portable_cell_led"))
.texture("layer2", MEGACells.makeId("item/cell/portable/portable_cell_screen"))
.texture("layer3", MEGACells.makeId("item/cell/portable/portable_cell_side" + tierSuffix));
Expand Down Expand Up @@ -270,15 +258,6 @@ private void driveCell(String cell, String texture, int offset) {
.end();
}

/*
private void portable(ItemDefinition<?> portable) {
var id = portable.id().getPath();
itemModels()
.singleTexture(id, mcLoc("item/generated"), "layer0", MEGACells.makeId("item/cell/portable/" + id))
.texture("layer1", AppEng.makeId("item/portable_cell_led"));
}
*/

private void interfaceOrProviderPart(ItemDefinition<?> part) {
var id = part.id().getPath();
var partName = id.substring(id.indexOf('_') + 1);
Expand Down
Loading

0 comments on commit c521af7

Please sign in to comment.