Skip to content
Merged
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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
The diff you're trying to view is too large. We only load the first 3000 changed files.
23 changes: 23 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ on:
- 'gradle/**'
- 'tools/buildtools/**'
- 'tools/comments/**'
- 'tools/resources/**'
- 'gradlew'
- 'gradlew.bat'
- 'build.gradle'
Expand Down Expand Up @@ -92,6 +93,28 @@ jobs:
":minecraft:${{ matrix.node }}:compileTestJava"
":minecraft:${{ matrix.node }}:spotlessCheck"
-Pmod_version=${{ steps.version.outputs.version }}
- name: Verify packaged resources
run: |
set -euo pipefail
metadata=META-INF/mods.toml
if [[ "${{ matrix.loader }}" == "neoforge" ]]; then metadata=META-INF/neoforge.mods.toml; fi
jar=""
for candidate in minecraft/versions/${{ matrix.node }}/build/libs/*-${{ steps.version.outputs.version }}.jar; do
[[ -f "$candidate" ]] || continue
if unzip -p "$candidate" "$metadata" >/dev/null 2>&1; then
if [[ -n "$jar" ]]; then
echo "Expected one installable mod jar, found more" >&2
exit 1
fi
jar="$candidate"
fi
done
test -n "$jar"
python tools/resources/check_compact_model_json.py "$jar" \
--resources core/build/resources/main minecraft/versions/${{ matrix.node }}/build/resources/main
python tools/resources/check_png_metadata.py "$jar" --strict
python tools/resources/check_png_metadata.py core/build/resources/main \
minecraft/versions/${{ matrix.node }}/build/resources/main --strict
- name: Upload platform artifacts
uses: actions/upload-artifact@v4
with:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,14 +51,54 @@ public enum MaterialTextureSet {
SPACE,
BRICK;

private static final MaterialTextureSet[] MODELED_SETS = values();
/**
* Sets that own shared model JSON and icon templates. Constants outside this list remain
* declared so addon code and API consumers keep compiling, but no material resolves to them
* and no resources are shipped for them.
*/
private static final List<MaterialTextureSet> MODELED_SETS = List.of(
METALLIC,
DULL,
SHINY,
FINE,
SAND,
STONE,
WOOD,
DIAMOND,
EMERALD,
QUARTZ,
RUBY,
REDSTONE,
ROUGH,
POWDER,
COPPER,
CUBE,
CUBE_SHINY,
FIERY,
FLINT,
FOOD,
GEM_HORIZONTAL,
GEM_VERTICAL,
GLASS,
LAPIS,
LEAF,
LIGNITE,
MAGNETIC,
NONE,
OPAL,
PAPER,
PRISMARINE,
RUBBER,
SHARDS,
SPACE,
BRICK);

/**
* Texture sets that have shared model JSON under {@code models/item/material/}. Every constant
* currently qualifies, so this has the same elements as {@link #values()}; use this method
* rather than assuming the two stay equal.
* Texture sets that have shared model JSON under {@code models/item/material/} and icon
* templates under {@code textures/{item,block}/material_icons/}. Iterate this rather than
* {@link #values()}: the remaining constants have no generated model or texture resources.
*/
public static List<MaterialTextureSet> modeled() { return List.of(MODELED_SETS); }
public static List<MaterialTextureSet> modeled() { return MODELED_SETS; }

/** Lowercase folder name used in resource locations (MC normalizes paths to lowercase). */
public String folder() {
Expand Down
4 changes: 3 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ group = mod_group_id

// Incremental resource moves can leave empty old directories in build outputs.
// Only files define mod content; never retain those directories in a delivered jar.
subprojects {
// All projects, not only subprojects: the Stonecutter version nodes and the API platform
// nodes build jars of their own and carry the same directory entries.
allprojects {
tasks.withType(org.gradle.jvm.tasks.Jar).configureEach { includeEmptyDirs = false }
}

Expand Down
2 changes: 2 additions & 0 deletions core/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,6 @@ tasks.named('jar', Jar).configure {
zip64 = true
preserveFileTimestamps = false
reproducibleFileOrder = true
// Empty directories come from deleted resources; they add entries without adding assets.
includeEmptyDirs = false
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,9 @@ public static String modelPath(MaterialTextureSet set, MaterialPrefix prefix) {
return "item/material/" + set.folder() + "/" + prefix.getTextureFileName();
}

public static String modelJson(GTMaterial material, MaterialPrefix prefix) {
return generatedModelJson(resolveTextureSet(material), prefix);
/** Item model for this material and prefix; {@code overlay} follows the icon art of its set. */
public static String modelJson(GTMaterial material, MaterialPrefix prefix, boolean overlay) {
return generatedModelJson(resolveTextureSet(material), prefix, overlay);
}

/** One generated item model. The texture lives in the addon namespace and is tinted by material colour. */
Expand All @@ -45,8 +46,8 @@ public static String addonItemModel(MaterialPrefix prefix) {
""".formatted(prefix.textureNamespace(), prefix.addonTexturePath());
}

public static String sharedModelJson(MaterialTextureSet set, MaterialPrefix prefix) {
return generatedModelJson(set, prefix);
public static String sharedModelJson(MaterialTextureSet set, MaterialPrefix prefix, boolean overlay) {
return generatedModelJson(set, prefix, overlay);
}

/** Both platform geometry loaders delegate this reference to the original baked template cache. */
Expand All @@ -55,7 +56,17 @@ public static String sharedInventoryJson(String parent) {
+ parent + "\"}";
}

private static String generatedModelJson(MaterialTextureSet set, MaterialPrefix prefix) {
private static String generatedModelJson(MaterialTextureSet set, MaterialPrefix prefix, boolean overlay) {
if (!overlay) {
return """
{
"parent": "minecraft:item/generated",
"textures": {
"layer0": "%s"
}
}
""".formatted("gt6ce:" + texturePath(set, prefix, false));
}
return """
{
"parent": "minecraft:item/generated",
Expand Down

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.

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
Loading