Skip to content

Commit

Permalink
Unify drive cell textures
Browse files Browse the repository at this point in the history
  • Loading branch information
62832 committed Dec 20, 2022
1 parent ba7e677 commit 01d6913
Show file tree
Hide file tree
Showing 26 changed files with 47 additions and 63 deletions.
18 changes: 9 additions & 9 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,17 @@ plugins {
}

architectury {
minecraft = rootProject.minecraft_version
minecraft = minecraft_version
}

subprojects {
apply plugin: "dev.architectury.loom"
apply plugin: "io.github.juuxel.loom-quiltflower"
apply plugin: "me.shedaniel.unified-publishing"

archivesBaseName = rootProject.mod_id + "-" + project.name
version = (System.getenv("MEGA_VERSION") ?: "v0.0.0").substring(1) + "-" + rootProject.minecraft_version
group = rootProject.maven_group
archivesBaseName = mod_id + "-" + project.name
version = (System.getenv("MEGA_VERSION") ?: "v0.0.0").substring(1)
group = maven_group + "-" + mod_id

loom {
silentMojangMappingsLicense()
Expand All @@ -30,7 +30,7 @@ subprojects {
targetCompatibility = JavaVersion.VERSION_17

dependencies {
minecraft "com.mojang:minecraft:${rootProject.minecraft_version}"
minecraft "com.mojang:minecraft:${minecraft_version}"
mappings loom.officialMojangMappings()
}

Expand Down Expand Up @@ -153,16 +153,16 @@ allprojects {

jar {
from("LICENSE") {
rename { "${it}_${rootProject.archivesBaseName}"}
rename { "${it}_${archivesBaseName}"}
}
}

if ((project.name == "fabric" || project.name == "forge") && project.version != "0.0.0") {
unifiedPublishing {
project {
gameVersions = [rootProject.minecraft_version]
gameVersions = [minecraft_version]
gameLoaders = [project.name]
version = project.name + "-" + project.version
version = project.name + "-" + project.version + "-" + minecraft_version

def loader = project.name.substring(0, 1).toUpperCase() + project.name.substring(1)
def releaseChannel = "release"
Expand All @@ -177,7 +177,7 @@ allprojects {

releaseType = releaseChannel
changelog = changes
displayName = String.format("%s (%s %s)", project.version.substring(0, 5), loader, rootProject.minecraft_version)
displayName = String.format("%s (%s %s)", project.version, loader, minecraft_version)

mainPublication remapJar // Declares the publicated jar

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,13 @@
public class InitStorageCells {

public static void init() {
StorageCells.addCellHandler(BulkCellHandler.INSTANCE);

MEGAItems.getItemCells().forEach(c -> StorageCellModels.registerModel(c,
Utils.makeId("block/drive/cells/standard/" + c.id().getPath())));
MEGAItems.getFluidCells().forEach(c -> StorageCellModels.registerModel(c,
Utils.makeId("block/drive/cells/standard/" + c.id().getPath())));
Stream.of(MEGAItems.getItemCells(), MEGAItems.getItemPortables()).flatMap(Collection::stream)
.forEach(c -> StorageCellModels.registerModel(c, Utils.makeId("block/drive/cells/mega_item_cell")));
Stream.of(MEGAItems.getFluidCells(), MEGAItems.getFluidPortables()).flatMap(Collection::stream)
.forEach(c -> StorageCellModels.registerModel(c, Utils.makeId("block/drive/cells/mega_fluid_cell")));

MEGAItems.getItemPortables().forEach(c -> StorageCellModels.registerModel(c,
Utils.makeId("block/drive/cells/portable/portable_mega_item_cell")));
MEGAItems.getFluidPortables().forEach(c -> StorageCellModels.registerModel(c,
Utils.makeId("block/drive/cells/portable/portable_mega_fluid_cell")));

StorageCellModels.registerModel(MEGAItems.BULK_ITEM_CELL,
Utils.makeId("block/drive/cells/standard/bulk_item_cell"));
StorageCells.addCellHandler(BulkCellHandler.INSTANCE);
StorageCellModels.registerModel(MEGAItems.BULK_ITEM_CELL, Utils.makeId("block/drive/cells/bulk_item_cell"));

if (Utils.PLATFORM.isModLoaded("appbot")) {
Stream.of(AppBotItems.getCells(), AppBotItems.getPortables()).flatMap(Collection::stream)
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
import appeng.core.AppEng;

import gripe._90.megacells.definition.MEGABlocks;
import gripe._90.megacells.integration.appbot.AppBotItems;
import gripe._90.megacells.util.Utils;

public class ModelProvider extends FabricModelProvider {
Expand Down Expand Up @@ -74,9 +73,6 @@ public void generateItemModels(ItemModelGenerators generator) {
createCellItem(
Utils.makeId("item/cell/standard/" + cell.id().getPath()),
Utils.makeId("item/" + cell.id().getPath()), STORAGE_CELL_LED, generator.output);
if (!AppBotItems.getCells().contains(cell)) {
createDriveCellModel("standard/" + cell.id().getPath(), generator.output);
}
}

for (var cell : CommonModelSupplier.PORTABLE_CELLS) {
Expand All @@ -85,9 +81,10 @@ public void generateItemModels(ItemModelGenerators generator) {
Utils.makeId("item/" + cell.id().getPath()), PORTABLE_CELL_LED, generator.output);
}

createDriveCellModel("portable/portable_mega_item_cell", generator.output);
createDriveCellModel("portable/portable_mega_fluid_cell", generator.output);
createDriveCellModel("mega_item_cell", generator.output);
createDriveCellModel("mega_fluid_cell", generator.output);
createDriveCellModel("mega_mana_cell", generator.output);
createDriveCellModel("bulk_item_cell", generator.output);
}

private TextureMapping cell(ResourceLocation cell, ResourceLocation led) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
import appeng.core.definitions.ItemDefinition;

import gripe._90.megacells.datagen.CommonModelSupplier;
import gripe._90.megacells.integration.appbot.AppBotItems;
import gripe._90.megacells.util.Utils;

public class ItemModelProvider extends net.minecraftforge.client.model.generators.ItemModelProvider {
Expand All @@ -28,35 +27,28 @@ public ItemModelProvider(DataGenerator gen, ExistingFileHelper efh) {
@Override
protected void registerModels() {
CommonModelSupplier.FLAT_ITEMS.forEach(this::flatSingleLayer);

CommonModelSupplier.STORAGE_CELLS.forEach(item -> {
cell(item);
if (!AppBotItems.getCells().contains(item)) {
var driveCellPath = "block/drive/cells/standard/" + item.id().getPath();
withExistingParent(driveCellPath, DRIVE_CELL).texture("cell", Utils.makeId(driveCellPath));
}
});

CommonModelSupplier.STORAGE_CELLS.forEach(this::cell);
CommonModelSupplier.PORTABLE_CELLS.forEach(this::portable);
driveCell("mega_item_cell");
driveCell("mega_fluid_cell");
driveCell("mega_mana_cell");
driveCell("bulk_item_cell");
}

withExistingParent("block/drive/cells/portable/portable_mega_item_cell", DRIVE_CELL).texture("cell",
Utils.makeId("block/drive/cells/portable/portable_mega_item_cell"));
withExistingParent("block/drive/cells/portable/portable_mega_fluid_cell", DRIVE_CELL).texture("cell",
Utils.makeId("block/drive/cells/portable/portable_mega_fluid_cell"));

withExistingParent("block/drive/cells/mega_mana_cell", DRIVE_CELL).texture("cell",
Utils.makeId("block/drive/cells/mega_mana_cell"));
private void driveCell(String texture) {
withExistingParent("block/drive/cells/" + texture, DRIVE_CELL).texture("cell",
Utils.makeId("block/drive/cells/" + texture));
}

public void cell(ItemDefinition<?> cell) {
private void cell(ItemDefinition<?> cell) {
flatSingleLayer(cell, "cell/standard/").texture("layer1", STORAGE_CELL_LED);
}

public void portable(ItemDefinition<?> cell) {
private void portable(ItemDefinition<?> cell) {
flatSingleLayer(cell, "cell/portable/").texture("layer1", PORTABLE_CELL_LED);
}

public void flatSingleLayer(ItemDefinition<?> item) {
private void flatSingleLayer(ItemDefinition<?> item) {
flatSingleLayer(item, "");
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package gripe._90.megacells.integration.appmek;

import java.util.Collection;
import java.util.List;
import java.util.stream.Stream;

import appeng.api.client.StorageCellModels;
import appeng.api.storage.StorageCells;
Expand Down Expand Up @@ -43,14 +45,11 @@ public static void initUpgrades() {
}

public static void initStorageCells() {
StorageCells.addCellHandler(RadioactiveCellHandler.INSTANCE);

AppMekItems.getCells().forEach(c -> StorageCellModels.registerModel(c,
Utils.makeId("block/drive/cells/standard/" + c.id().getPath())));
AppMekItems.getPortables().forEach(c -> StorageCellModels.registerModel(c,
Utils.makeId("block/drive/cells/portable/portable_mega_chemical_cell")));
Stream.of(AppMekItems.getCells(), AppMekItems.getPortables()).flatMap(Collection::stream)
.forEach(c -> StorageCellModels.registerModel(c, Utils.makeId("block/drive/cells/mega_chemical_cell")));

StorageCells.addCellHandler(RadioactiveCellHandler.INSTANCE);
StorageCellModels.registerModel(AppMekItems.RADIOACTIVE_CHEMICAL_CELL.asItem(),
Utils.makeId("block/drive/cells/standard/radioactive_chemical_cell"));
Utils.makeId("block/drive/cells/radioactive_chemical_cell"));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -33,20 +33,22 @@ protected void registerModels() {

for (var storage : AppMekItems.getCells()) {
cell(storage);
var driveCellPath = "block/drive/cells/standard/" + storage.id().getPath();
withExistingParent(driveCellPath, DRIVE_CELL).texture("cell", Utils.makeId(driveCellPath));
}

for (var portable : AppMekItems.getPortables()) {
portable(portable);
}

withExistingParent("block/drive/cells/portable/portable_mega_chemical_cell", DRIVE_CELL).texture("cell",
Utils.makeId("block/drive/cells/portable/portable_mega_chemical_cell"));

flatSingleLayer(AppMekItems.RADIOACTIVE_CELL_COMPONENT);
cell(AppMekItems.RADIOACTIVE_CHEMICAL_CELL);
withExistingParent("block/drive/cells/standard/radioactive_chemical_cell", DRIVE_CELL).texture("cell",
Utils.makeId("block/drive/cells/standard/radioactive_chemical_cell"));

driveCell("mega_chemical_cell");
driveCell("radioactive_chemical_cell");
}

private void driveCell(String texture) {
withExistingParent("block/drive/cells/" + texture, DRIVE_CELL).texture("cell",
Utils.makeId("block/drive/cells/" + texture));
}

private void cell(ItemDefinition<?> cell) {
Expand All @@ -66,8 +68,9 @@ private ItemModelBuilder flatSingleLayer(ItemDefinition<?> item, String subfolde
return singleTexture(path, mcLoc("item/generated"), "layer0", Utils.makeId("item/" + subfolder + path));
}

@NotNull
@Override
public @NotNull String getName() {
public String getName() {
return super.getName() + "/appmek";
}
}
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

0 comments on commit 01d6913

Please sign in to comment.