Skip to content

Commit

Permalink
Update to 1.21.4.
Browse files Browse the repository at this point in the history
- Update to 1.21.4
- Improve armor trim compatibility with other mods
* Loom 1.9 and Gradle 8.11
* Apply `ItemSettings.useBlockPrefixedTranslationKey()`
* Add CinderscapesBlockFamilies
* Datagen for models
* Improve datagen for recipes
* Now requires and includes Mixson
  • Loading branch information
gniftygnome committed Jan 11, 2025
1 parent 9ab36fd commit 432f46f
Show file tree
Hide file tree
Showing 540 changed files with 778 additions and 8,781 deletions.
20 changes: 18 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ plugins {
id 'maven-publish'
id 'idea'
id 'eclipse'
id 'fabric-loom' version '1.7.+'
id 'fabric-loom' version '1.9.+'
}

apply from: 'https://raw.githubusercontent.com/TerraformersMC/GradleScripts/2.7/ferry.gradle'
Expand All @@ -24,6 +24,8 @@ dependencies {

includeMod "cloth-config", "me.shedaniel.cloth:cloth-config-fabric:${project.clothconfig_version}"

includeMod "mixson", "com.github.ramixin:mixson:${project.mixson_version}"

if (findProject(':cinderscapes-worldgen') != null) {
includeMod "biolith", "com.terraformersmc:biolith-fabric:${biolith_version}"
}
Expand Down Expand Up @@ -95,7 +97,19 @@ allprojects {

// Cloth Config
maven {
url = "https://maven.shedaniel.me"
url = 'https://maven.shedaniel.me'
}

// for Mixson
exclusiveContent {
forRepository {
maven {
url 'https://jitpack.io'
}
}
filter {
includeGroup "com.github.ramixin"
}
}
}
}
Expand All @@ -115,6 +129,8 @@ subprojects {
modImplementation "com.terraformersmc.terraform-api:terraform-wood-api-v1:${project.terraform_wood_api_version}"

modImplementation "me.shedaniel.cloth:cloth-config-fabric:${project.clothconfig_version}"

modImplementation "com.github.ramixin:mixson:${project.mixson_version}"
}

version = rootProject.version
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.terraformersmc.cinderscapes;

import com.terraformersmc.cinderscapes.init.CinderscapesArmorTrimItemModels;
import com.terraformersmc.cinderscapes.init.CinderscapesBlocks;
import net.fabricmc.api.ClientModInitializer;
import net.fabricmc.api.EnvType;
Expand All @@ -17,6 +18,7 @@ public class CinderscapesClient implements ClientModInitializer {

@Override
public void onInitializeClient() {
CinderscapesArmorTrimItemModels.init();

BlockRenderLayerMap.INSTANCE.putBlocks(RenderLayer.getTranslucent(),
// Ashy Shoals
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
package com.terraformersmc.cinderscapes.init;

import com.google.gson.JsonArray;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import com.terraformersmc.cinderscapes.Cinderscapes;
import net.minecraft.util.Identifier;
import net.ramixin.mixson.Mixson;
import net.ramixin.mixson.events.ModificationEvent;
import org.jetbrains.annotations.NotNull;

import java.util.List;

public final class CinderscapesArmorTrimItemModels {
private static final List<String> ARMORS = List.of("helmet", "chestplate", "leggings", "boots");
private static final List<String> ARMOR_MATERIALS = List.of("leather", "chainmail", "iron", "golden", "diamond", "netherite");

@SuppressWarnings("UnnecessaryReturnStatement")
private CinderscapesArmorTrimItemModels() {
return;
}

public static void init() {
/*
* Add trim materials to each armor.
*/
ARMORS.forEach(armor -> ARMOR_MATERIALS.forEach(armorMaterial -> registerAddTrimsToArmor(armor, armorMaterial)));

// (dare to be different)
registerAddTrimsToArmor("helmet", "turtle");

/*
* Add trim materials to vanilla atlases.
*/
registerAddTrimsToAtlas("armor_trims");
registerAddTrimsToAtlas("blocks");
}

private static void registerAddTrimsToArmor(String armor, String armorMaterial) {
Mixson.registerModificationEvent(
Identifier.ofVanilla("items/" + armorMaterial + "_" + armor),
Identifier.of(Cinderscapes.MOD_ID, "add_trims_to_" + armorMaterial + "_" + armor),
new ModificationEvent() {
@Override
public @NotNull JsonElement run(JsonElement elem) {
JsonObject root = elem.getAsJsonObject();
JsonObject model = root.getAsJsonObject("model");
JsonArray cases = model.getAsJsonArray("cases");
JsonObject case0 = cases.get(0).getAsJsonObject();

CinderscapesArmorTrimMaterials.TRIM_MATERIALS.forEach(trim -> {
JsonObject newCase = case0.deepCopy();

newCase.addProperty("when", trimMaterialId(trim).toString());
newCase.getAsJsonObject("model")
.addProperty("model", itemModelId(armor, armorMaterial, trim).toString());

cases.add(newCase);
});

return elem;
}

@Override
public int ordinal() {
return 0;
}
}
);
}

private static void registerAddTrimsToAtlas(String name) {
Mixson.registerModificationEvent(
Identifier.ofVanilla("atlases/" + name),
Identifier.of(Cinderscapes.MOD_ID, "add_trims_to_" + name + "_atlas"),
new ModificationEvent() {
@Override
public @NotNull JsonElement run(JsonElement elem) {
JsonObject root = elem.getAsJsonObject();
JsonArray sources = root.getAsJsonArray("sources");

for (int i = 0; i < sources.size(); ++i) {
JsonObject source = sources.get(i).getAsJsonObject();

if ("paletted_permutations".equals(source.getAsJsonPrimitive("type").getAsString())) {
JsonObject permutations = source.getAsJsonObject("permutations");

CinderscapesArmorTrimMaterials.TRIM_MATERIALS.forEach(trim ->
permutations.addProperty(trim, paletteId(trim).toString())
);

break;
}
}

return elem;
}

@Override
public int ordinal() {
return 0;
}
}
);
}

private static Identifier trimMaterialId(String trim) {
return Identifier.of(Cinderscapes.MOD_ID, trim);
}

private static Identifier itemModelId(String armor, String armorMaterial, String trim) {
return Identifier.of(Cinderscapes.MOD_ID, "item/" + armorMaterial + "_" + armor + "_" + trim + "_trim");
}

private static Identifier paletteId(String trim) {
return Identifier.of(Cinderscapes.MOD_ID, "trims/color_palettes/" + trim);
}
}

This file was deleted.

28 changes: 0 additions & 28 deletions client/src/main/resources/assets/cinderscapes/blockstates/ash.json

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Loading

0 comments on commit 432f46f

Please sign in to comment.