diff --git a/build.gradle b/build.gradle index 15f7947..a57028e 100644 --- a/build.gradle +++ b/build.gradle @@ -10,11 +10,13 @@ buildscript { name = "sonatype" url = "https://oss.sonatype.org/content/repositories/snapshots/" } + maven { url = 'https://repo.spongepowered.org/maven' } } dependencies { classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '5.1.+' classpath 'org.parchmentmc:librarian:1.+' classpath 'org.ajoberstar:gradle-git:0.10.1' + classpath "org.spongepowered:mixingradle:0.7-SNAPSHOT" } } plugins { @@ -24,6 +26,7 @@ plugins { apply plugin: 'eclipse' apply plugin: 'net.minecraftforge.gradle' apply plugin: 'org.parchmentmc.librarian.forgegradle' +apply plugin: 'org.spongepowered.mixin' apply plugin: 'maven-publish' import org.ajoberstar.grgit.Grgit @@ -55,6 +58,7 @@ minecraft { // Recommended logging level for the console property 'forge.logging.console.level', 'debug' + arg '-mixin.config=ctm.mixins.json' mods { ctm { @@ -70,6 +74,7 @@ minecraft { // Recommended logging level for the console property 'forge.logging.console.level', 'debug' + arg '-mixin.config=ctm.mixins.json' mods { ctm { @@ -92,16 +97,26 @@ jar { "Implementation-Title": project.name, "Implementation-Version": "${version}", "Implementation-Vendor" :"chisel-team", - "Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ")],) + "Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ"), + "MixinConfigs": "ctm.mixins.json"],) } } repositories { mavenLocal() + maven { + name = 'sponge' + url = 'https://repo.spongepowered.org/repository/maven-public/' + content { + includeGroup "org.spongepowered" + } + } } dependencies { minecraft 'net.minecraftforge:forge:' + minecraft_version + '-' + forge_version + + annotationProcessor 'org.spongepowered:mixin:0.8.5-SNAPSHOT:processor' } lombok { @@ -116,6 +131,10 @@ task apiJar(type: Jar) { classifier = 'api' } +mixin { + add sourceSets.main, "ctm.refmap.json" +} + publishing { tasks.publish.dependsOn 'build' publications { diff --git a/gradle.properties b/gradle.properties index 5b216b0..c935d8f 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,4 +1,4 @@ -mod_version=1.1.5 +mod_version=1.1.6 minecraft_version=1.18.2 forge_version=40.0.36 diff --git a/src/main/java/team/chisel/ctm/api/texture/ICTMTexture.java b/src/main/java/team/chisel/ctm/api/texture/ICTMTexture.java index c852beb..e5f7b8e 100644 --- a/src/main/java/team/chisel/ctm/api/texture/ICTMTexture.java +++ b/src/main/java/team/chisel/ctm/api/texture/ICTMTexture.java @@ -31,6 +31,8 @@ public interface ICTMTexture { List transformQuad(BakedQuad quad, @Nullable ITextureContext context, int quadGoal); Collection getTextures(); + + public void addSprite(TextureAtlasSprite sprite); /** * Gets the block render type of this texture diff --git a/src/main/java/team/chisel/ctm/client/BlockModelExtension.java b/src/main/java/team/chisel/ctm/client/BlockModelExtension.java new file mode 100644 index 0000000..fcf14c1 --- /dev/null +++ b/src/main/java/team/chisel/ctm/client/BlockModelExtension.java @@ -0,0 +1,10 @@ +package team.chisel.ctm.client; + +import it.unimi.dsi.fastutil.ints.Int2ObjectMap; +import team.chisel.ctm.client.texture.IMetadataSectionCTM; + +public interface BlockModelExtension { + Int2ObjectMap getMetaOverrides(); + + void setMetaOverrides(Int2ObjectMap overrides); +} diff --git a/src/main/java/team/chisel/ctm/client/mixin/BlockModelDeserializerMixin.java b/src/main/java/team/chisel/ctm/client/mixin/BlockModelDeserializerMixin.java new file mode 100644 index 0000000..5aceb12 --- /dev/null +++ b/src/main/java/team/chisel/ctm/client/mixin/BlockModelDeserializerMixin.java @@ -0,0 +1,46 @@ +package team.chisel.ctm.client.mixin; + +import com.google.gson.*; +import com.google.gson.reflect.TypeToken; +import it.unimi.dsi.fastutil.ints.Int2ObjectArrayMap; +import it.unimi.dsi.fastutil.ints.Int2ObjectMap; +import net.minecraft.client.renderer.block.model.BlockModel; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; +import team.chisel.ctm.client.BlockModelExtension; +import team.chisel.ctm.client.texture.IMetadataSectionCTM; + +import java.lang.reflect.Type; +import java.util.Collections; +import java.util.Map; + +@Mixin(BlockModel.Deserializer.class) +public abstract class BlockModelDeserializerMixin implements JsonDeserializer { + + private static final Gson GSON = new Gson(); + + @Inject(at = @At("TAIL"), method = "deserialize(Lcom/google/gson/JsonElement;Ljava/lang/reflect/Type;Lcom/google/gson/JsonDeserializationContext;)Lnet/minecraft/client/renderer/block/model/BlockModel;") + private void addCTMData(JsonElement pJson, Type pType, JsonDeserializationContext pContext, CallbackInfoReturnable cir) { + Map parsed = GSON.fromJson(pJson.getAsJsonObject().getAsJsonObject("ctm_overrides"), new TypeToken>(){}.getType()); + if (parsed == null) { + parsed = Collections.emptyMap(); + } + Int2ObjectMap overrides = new Int2ObjectArrayMap<>(parsed.size()); + for (Map.Entry e : parsed.entrySet()) { + try { + int index = Integer.parseInt(e.getKey()); + if (!e.getValue().getAsJsonObject().has("ctm_version")) { + // This model can only be version 1, TODO improve this + e.getValue().getAsJsonObject().add("ctm_version", new JsonPrimitive(1)); + } + overrides.put(index, new IMetadataSectionCTM.Serializer().fromJson(e.getValue().getAsJsonObject())); + } catch (NumberFormatException ex) {} + } + + ((BlockModelExtension) cir.getReturnValue()).setMetaOverrides(overrides); + + } + +} diff --git a/src/main/java/team/chisel/ctm/client/mixin/BlockModelMixin.java b/src/main/java/team/chisel/ctm/client/mixin/BlockModelMixin.java new file mode 100644 index 0000000..751aaa0 --- /dev/null +++ b/src/main/java/team/chisel/ctm/client/mixin/BlockModelMixin.java @@ -0,0 +1,88 @@ +package team.chisel.ctm.client.mixin; + +import com.mojang.datafixers.util.Pair; +import it.unimi.dsi.fastutil.ints.Int2ObjectArrayMap; +import it.unimi.dsi.fastutil.ints.Int2ObjectMap; +import net.minecraft.client.renderer.block.model.BlockModel; +import net.minecraft.client.renderer.texture.MissingTextureAtlasSprite; +import net.minecraft.client.renderer.texture.TextureAtlasSprite; +import net.minecraft.client.resources.model.*; +import net.minecraft.resources.ResourceLocation; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Shadow; +import org.spongepowered.asm.mixin.Unique; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; +import team.chisel.ctm.client.BlockModelExtension; +import team.chisel.ctm.client.model.ModelBakedCTM; +import team.chisel.ctm.client.model.ModelCTM; +import team.chisel.ctm.client.texture.IMetadataSectionCTM; + +import java.util.Collection; +import java.util.Objects; +import java.util.Set; +import java.util.function.Function; + +@Mixin(BlockModel.class) +public abstract class BlockModelMixin implements UnbakedModel, BlockModelExtension { + + @Shadow public abstract BakedModel bake(ModelBakery pBakery, BlockModel pModel, Function pSpriteGetter, ModelState pTransform, ResourceLocation pLocation, boolean pGuiLight3d); + + @Shadow public abstract Material getMaterial(String pName); + + @Shadow public abstract String toString(); + + @Unique + protected Int2ObjectMap metaOverrides = new Int2ObjectArrayMap<>(); + + @Inject(at = @At("TAIL"), method = "bake(Lnet/minecraft/client/resources/model/ModelBakery;Lnet/minecraft/client/renderer/block/model/BlockModel;Ljava/util/function/Function;Lnet/minecraft/client/resources/model/ModelState;Lnet/minecraft/resources/ResourceLocation;Z)Lnet/minecraft/client/resources/model/BakedModel;", + cancellable = true) + private void ctm$bake(ModelBakery pBakery, BlockModel pModel, Function pSpriteGetter, ModelState pTransform, ResourceLocation pLocation, boolean pGuiLight3d, CallbackInfoReturnable cir) { + if (pModel instanceof BlockModelExtension extension && !extension.getMetaOverrides().isEmpty()) { + ModelCTM model = new ModelCTM(pModel); + model.initializeTextures(pBakery, pSpriteGetter); + ModelBakedCTM bakedCTM = new ModelBakedCTM(model, cir.getReturnValue()); + cir.setReturnValue(bakedCTM); + } + } + + @Inject(at = @At("RETURN"), method = "getMaterials") + private void ctm$materials(Function pModelGetter, Set> pMissingTextureErrors, CallbackInfoReturnable> cir) { + for (IMetadataSectionCTM meta : getMetaOverrides().values()) { + for (String s : meta.getAdditionalTextures()) { + Material material = this.getMaterial(s); + + if (Objects.equals(material.texture(), MissingTextureAtlasSprite.getLocation())) { + pMissingTextureErrors.add(Pair.of(s, this.toString())); + } + + cir.getReturnValue().add(material); + } + } + } + + private Int2ObjectMap ctm$merge(Int2ObjectMap other) { + Int2ObjectMap copy = new Int2ObjectArrayMap<>(this.metaOverrides).clone(); + for (int i: other.keySet()) { + if (!metaOverrides.containsKey(i)) { + copy.put(i, other.get(i)); + } else { + copy.get(i).merge(other.get(i)); + } + } + return copy; + } + + public Int2ObjectMap getMetaOverrides() { + if (((BlockModel) (Object) this).parent != null ) { + return ctm$merge(((BlockModelMixin) (Object) ((BlockModel) (Object) this).parent).getMetaOverrides()); + } + return metaOverrides; + } + + @Override + public void setMetaOverrides(Int2ObjectMap overrides) { + this.metaOverrides = overrides; + } +} diff --git a/src/main/java/team/chisel/ctm/client/model/ModelCTM.java b/src/main/java/team/chisel/ctm/client/model/ModelCTM.java index 548bdc0..569ddaa 100644 --- a/src/main/java/team/chisel/ctm/client/model/ModelCTM.java +++ b/src/main/java/team/chisel/ctm/client/model/ModelCTM.java @@ -6,7 +6,6 @@ import com.google.gson.JsonElement; import com.google.gson.JsonObject; import com.google.gson.JsonPrimitive; -import com.mojang.datafixers.util.Either; import com.mojang.datafixers.util.Pair; import it.unimi.dsi.fastutil.ints.Int2ObjectArrayMap; import it.unimi.dsi.fastutil.ints.Int2ObjectMap; @@ -31,6 +30,7 @@ import team.chisel.ctm.api.model.IModelCTM; import team.chisel.ctm.api.texture.ICTMTexture; import team.chisel.ctm.api.util.TextureInfo; +import team.chisel.ctm.client.BlockModelExtension; import team.chisel.ctm.client.texture.IMetadataSectionCTM; import team.chisel.ctm.client.texture.render.TextureNormal; import team.chisel.ctm.client.texture.type.TextureTypeNormal; @@ -45,13 +45,13 @@ public class ModelCTM implements IModelCTM { // Populated from overrides data during construction private final Int2ObjectMap overrides; - protected final Int2ObjectMap metaOverrides = new Int2ObjectArrayMap<>(); + protected Int2ObjectMap metaOverrides = new Int2ObjectArrayMap<>(); // Populated during bake with real texture data protected Int2ObjectMap spriteOverrides; protected Map, ICTMTexture> textureOverrides; - private final Collection textureDependencies; + private final Collection textureDependencies; private transient byte layers; @@ -59,9 +59,19 @@ public class ModelCTM implements IModelCTM { public ModelCTM(UnbakedModel modelinfo) { this.vanillamodel = modelinfo; - this.modelinfo = null; this.overrides = new Int2ObjectOpenHashMap<>(); this.textureDependencies = new HashSet<>(); + BlockModel temp = null; + + if (modelinfo instanceof BlockModel blockmodel && blockmodel instanceof BlockModelExtension extension) { + temp = blockmodel; + metaOverrides = extension.getMetaOverrides(); + for (IMetadataSectionCTM meta: metaOverrides.values()) { + textureDependencies.addAll(Arrays.asList(meta.getAdditionalTextures())); + } + this.textureDependencies.removeIf(rl -> rl.contains("#")); + } + this.modelinfo = temp; } public ModelCTM(BlockModel modelinfo, Int2ObjectMap overrides) throws IOException { @@ -71,10 +81,10 @@ public ModelCTM(BlockModel modelinfo, Int2ObjectMap overrides) thro this.textureDependencies = new HashSet<>(); for (Int2ObjectMap.Entry e : this.overrides.int2ObjectEntrySet()) { IMetadataSectionCTM meta = null; - if (e.getValue().isJsonPrimitive() && e.getValue().getAsJsonPrimitive().isString()) { + if (e.getValue().isJsonPrimitive() && e.getValue().getAsJsonPrimitive().isString()) { //TODO is this still a thing? ResourceLocation rl = new ResourceLocation(e.getValue().getAsString()); meta = ResourceUtil.getMetadata(ResourceUtil.spriteToAbsolute(rl)); - textureDependencies.add(rl); + textureDependencies.add(rl.toString()); } else if (e.getValue().isJsonObject()) { JsonObject obj = e.getValue().getAsJsonObject(); if (!obj.has("ctm_version")) { @@ -89,15 +99,15 @@ public ModelCTM(BlockModel modelinfo, Int2ObjectMap overrides) thro } } - this.textureDependencies.removeIf(rl -> rl.getPath().startsWith("#")); + this.textureDependencies.removeIf(rl -> rl.contains("#")); } @Override public Collection getTextures(IModelConfiguration owner, Function modelGetter, Set> missingTextureErrors) { List ret = textureDependencies.stream() - .map(rl -> new Material(TextureAtlas.LOCATION_BLOCKS, rl)) + .map(rl -> new Material(TextureAtlas.LOCATION_BLOCKS, new ResourceLocation(rl))) .collect(Collectors.toList()); - ret.addAll(vanillamodel.getMaterials(modelGetter, missingTextureErrors)); + ret.addAll(vanillamodel.getMaterials(modelGetter, missingTextureErrors)); // Validate all texture metadata for (Material tex : ret) { IMetadataSectionCTM meta; @@ -117,7 +127,7 @@ public Collection getTextures(IModelConfiguration owner, Function spriteGetter, ModelState modelTransform, ItemOverrides itemOverrides, ResourceLocation modelLocation) { - return bake(bakery, spriteGetter, modelTransform, modelLocation); + return bake(bakery, spriteGetter, modelTransform, modelLocation); } private static final ItemModelGenerator ITEM_MODEL_GENERATOR = new ItemModelGenerator(); @@ -152,7 +162,7 @@ public void initializeTextures(ModelBakery bakery, Function(); // Convert all primitive values into sprites for (Int2ObjectMap.Entry e : overrides.int2ObjectEntrySet()) { @@ -168,15 +178,19 @@ public void initializeTextures(ModelBakery bakery, Function matches = modelinfo.getElements().stream().flatMap(b -> b.faces.values().stream()).filter(b -> b.tintIndex == e.getIntKey()).toList(); Multimap bySprite = HashMultimap.create(); // TODO 1.15 this isn't right - matches.forEach(part -> bySprite.put(modelinfo.textureMap.getOrDefault(part.texture.substring(1), Either.right(part.texture)).left().get(), part)); + matches.forEach(part -> bySprite.put(modelinfo.getMaterial(part.texture), part)); for (var e2 : bySprite.asMap().entrySet()) { - ResourceLocation texLoc = e2.getKey().sprite().getName(); + ResourceLocation texLoc = e2.getKey().texture(); TextureAtlasSprite sprite = getOverrideSprite(e.getIntKey()); if (sprite == null) { sprite = spriteGetter.apply(new Material(TextureAtlas.LOCATION_BLOCKS, texLoc)); } ICTMTexture tex = e.getValue().makeTexture(sprite, spriteGetter); layers |= 1 << (tex.getLayer() == null ? 7 : tex.getLayer().ordinal()); + for (String s: e.getValue().getAdditionalTextures()) { + TextureAtlasSprite atlasSprite = spriteGetter.apply(modelinfo.getMaterial(s)); + tex.addSprite(atlasSprite); + } textureOverrides.put(Pair.of(e.getIntKey(), texLoc), tex); } } diff --git a/src/main/java/team/chisel/ctm/client/texture/IMetadataSectionCTM.java b/src/main/java/team/chisel/ctm/client/texture/IMetadataSectionCTM.java index 20fd202..55834b7 100644 --- a/src/main/java/team/chisel/ctm/client/texture/IMetadataSectionCTM.java +++ b/src/main/java/team/chisel/ctm/client/texture/IMetadataSectionCTM.java @@ -22,6 +22,7 @@ import net.minecraft.client.resources.model.Material; import net.minecraft.resources.ResourceLocation; import net.minecraft.server.packs.metadata.MetadataSectionSerializer; +import org.apache.commons.lang3.ArrayUtils; import team.chisel.ctm.CTM; import team.chisel.ctm.api.texture.ICTMTexture; import team.chisel.ctm.api.texture.ITextureType; @@ -41,7 +42,7 @@ public interface IMetadataSectionCTM { BlockRenderLayer getLayer(); - ResourceLocation[] getAdditionalTextures(); + String[] getAdditionalTextures(); @Nullable String getProxy(); @@ -63,15 +64,18 @@ default ICTMTexture makeTexture(TextureAtlasSprite sprite, Function new Material(TextureAtlas.LOCATION_BLOCKS, rl)) + Arrays.stream(ObjectArrays.concat(sprite.getName().toString(), meta.getAdditionalTextures())) + .filter(s -> !s.startsWith("#")) + .map(rl -> new Material(TextureAtlas.LOCATION_BLOCKS, new ResourceLocation(rl))) .map(bakedTextureGetter) .toArray(TextureAtlasSprite[]::new), Optional.of(meta.getExtraData()), meta.getLayer() )); } - + + void merge(IMetadataSectionCTM iMetadataSectionCTM); + @ToString @Getter class V1 implements IMetadataSectionCTM { @@ -79,7 +83,7 @@ class V1 implements IMetadataSectionCTM { private ITextureType type = TextureTypeRegistry.getType("NORMAL"); private BlockRenderLayer layer = null; private String proxy; - private ResourceLocation[] additionalTextures = new ResourceLocation[0]; + private String[] additionalTextures = new String[0]; private JsonObject extraData = new JsonObject(); @Override @@ -87,6 +91,24 @@ public int getVersion() { return 1; } + @Override + public void merge(@Nonnull IMetadataSectionCTM other) { + if (type == TextureTypeRegistry.getType("NORMAL")) { + type = other.getType(); + } + if (this.proxy == null) { + this.proxy = other.getProxy(); + } + + if (this.layer == null) { + this.layer = other.getLayer(); + } + this.additionalTextures = ArrayUtils.addAll(this.additionalTextures, other.getAdditionalTextures()); + if (this.extraData.isJsonNull()) { + this.extraData = other.getExtraData(); + } + } + public static IMetadataSectionCTM fromJson(JsonObject obj) throws JsonParseException { V1 ret = new V1(); @@ -128,11 +150,11 @@ public static IMetadataSectionCTM fromJson(JsonObject obj) throws JsonParseExcep JsonElement texturesEle = obj.get("textures"); if (texturesEle.isJsonArray()) { JsonArray texturesArr = texturesEle.getAsJsonArray(); - ret.additionalTextures = new ResourceLocation[texturesArr.size()]; + ret.additionalTextures = new String[texturesArr.size()]; for (int i = 0; i < texturesArr.size(); i++) { JsonElement e = texturesArr.get(i); if (e.isJsonPrimitive() && e.getAsJsonPrimitive().isString()) { - ret.additionalTextures[i] = new ResourceLocation(e.getAsString()); + ret.additionalTextures[i] = e.getAsString(); } } } diff --git a/src/main/java/team/chisel/ctm/client/texture/render/AbstractTexture.java b/src/main/java/team/chisel/ctm/client/texture/render/AbstractTexture.java index 40ce05e..a5d0ce0 100644 --- a/src/main/java/team/chisel/ctm/client/texture/render/AbstractTexture.java +++ b/src/main/java/team/chisel/ctm/client/texture/render/AbstractTexture.java @@ -15,6 +15,7 @@ import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.resources.ResourceLocation; import net.minecraft.util.Mth; +import org.apache.commons.lang3.ArrayUtils; import team.chisel.ctm.api.texture.ICTMTexture; import team.chisel.ctm.api.texture.ITextureContext; import team.chisel.ctm.api.texture.ITextureType; @@ -100,4 +101,9 @@ protected Quad makeQuad(BakedQuad bq, @Nullable ITextureContext context) { } return q; } + + @Override + public void addSprite(TextureAtlasSprite sprite) { + sprites = ArrayUtils.add(sprites, sprite); + } } diff --git a/src/main/java/team/chisel/ctm/client/util/TextureMetadataHandler.java b/src/main/java/team/chisel/ctm/client/util/TextureMetadataHandler.java index f59d510..83a0933 100644 --- a/src/main/java/team/chisel/ctm/client/util/TextureMetadataHandler.java +++ b/src/main/java/team/chisel/ctm/client/util/TextureMetadataHandler.java @@ -10,6 +10,7 @@ import javax.annotation.Nonnull; +import net.minecraft.client.renderer.block.model.MultiVariant; import org.apache.logging.log4j.message.ParameterizedMessage; import com.google.common.collect.Sets; @@ -30,6 +31,7 @@ import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.fml.util.ObfuscationReflectionHelper; import team.chisel.ctm.CTM; +import team.chisel.ctm.client.BlockModelExtension; import team.chisel.ctm.client.model.AbstractCTMBakedModel; import team.chisel.ctm.client.model.ModelBakedCTM; import team.chisel.ctm.client.model.ModelCTM; @@ -61,17 +63,17 @@ public void onTextureStitch(TextureStitchEvent.Pre event) { event.addSprite(proxysprite); if (proxymeta != null) { // Load proxy's additional textures - for (ResourceLocation r : proxymeta.getAdditionalTextures()) { - if (registeredTextures.add(r)) { - event.addSprite(r); + for (String r : proxymeta.getAdditionalTextures()) { + if (registeredTextures.add(new ResourceLocation(r))) { + event.addSprite(new ResourceLocation(r)); } } } } // Load additional textures - for (ResourceLocation r : metadata.getAdditionalTextures()) { - if (registeredTextures.add(r)) { - event.addSprite(r); + for (String r : metadata.getAdditionalTextures()) { + if (registeredTextures.add(new ResourceLocation(r))) { + event.addSprite(new ResourceLocation(r)); } } } diff --git a/src/main/resources/ctm.mixins.json b/src/main/resources/ctm.mixins.json new file mode 100644 index 0000000..ec68669 --- /dev/null +++ b/src/main/resources/ctm.mixins.json @@ -0,0 +1,14 @@ +{ + "required": true, + "package": "team.chisel.ctm.client.mixin", + "compatibilityLevel": "JAVA_17", + "refmap": "ctm.refmap.json", + "mixins": [ + "BlockModelMixin", + "BlockModelDeserializerMixin" + ], + "injectors": { + "defaultRequire": 1 + }, + "minVersion": "0.8" +} \ No newline at end of file diff --git a/src/test/resources/assets/ctm/textures/block/tiles_small.png b/src/test/resources/assets/ctm/textures/block/tiles_small.png new file mode 100644 index 0000000..52aa0ac Binary files /dev/null and b/src/test/resources/assets/ctm/textures/block/tiles_small.png differ diff --git a/src/test/resources/assets/minecraft/models/block/beacon.json b/src/test/resources/assets/minecraft/models/block/beacon.json index baffadf..01fda52 100644 --- a/src/test/resources/assets/minecraft/models/block/beacon.json +++ b/src/test/resources/assets/minecraft/models/block/beacon.json @@ -8,7 +8,6 @@ "beacon": "block/beacon", "beaconlines": "block/lines" }, - "loader": "ctm:ctm", "elements": [ { "__comment": "Glass shell", "from": [ 0, 0, 0 ], diff --git a/src/test/resources/assets/minecraft/models/block/gold_block.json b/src/test/resources/assets/minecraft/models/block/gold_block.json new file mode 100644 index 0000000..847aedc --- /dev/null +++ b/src/test/resources/assets/minecraft/models/block/gold_block.json @@ -0,0 +1,12 @@ +{ + "parent": "block/util_cube_glow_5_all", + "textures": { + "glow_4": "minecraft:block/gold_block", + "glow_3": "minecraft:block/gold_block", + "glow_2": "minecraft:block/gold_block", + "glow_1": "minecraft:block/gold_block", + "glow_0": "minecraft:block/tiles_small", + "ctm": "ctm:block/tiles_small", + "particle": "minecraft:block/gold_block" + } +} diff --git a/src/test/resources/assets/minecraft/models/block/redstone_block.json b/src/test/resources/assets/minecraft/models/block/redstone_block.json deleted file mode 100644 index 0dd00fb..0000000 --- a/src/test/resources/assets/minecraft/models/block/redstone_block.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "parent": "block/util_cube_glow_5_all", - "textures": { - "glow_4": "block/redstone_block_glow_4", - "glow_3": "block/redstone_block_glow_3", - "glow_2": "block/redstone_block_glow_2", - "glow_1": "block/redstone_block_glow_1", - "glow_0": "block/redstone_block_glow_0", - "particle": "block/redstone_block" - }, - "loader": "ctm:ctm", - "ctm_version": 1 -} diff --git a/src/test/resources/assets/minecraft/models/block/util_cube_glow_5_all.json b/src/test/resources/assets/minecraft/models/block/util_cube_glow_5_all.json index 8f51977..e24796d 100644 --- a/src/test/resources/assets/minecraft/models/block/util_cube_glow_5_all.json +++ b/src/test/resources/assets/minecraft/models/block/util_cube_glow_5_all.json @@ -4,63 +4,71 @@ "elements": [ { "from": [ 0, 0, 0 ], "to": [ 16, 16, 16 ], - "shade": false, "faces": { - "down": { "texture": "#glow_4", "cullface": "down" }, - "up": { "texture": "#glow_4", "cullface": "up" }, - "north": { "texture": "#glow_4", "cullface": "north" }, - "south": { "texture": "#glow_4", "cullface": "south" }, - "west": { "texture": "#glow_4", "cullface": "west" }, - "east": { "texture": "#glow_4", "cullface": "east" } + "down": { "texture": "#glow_4", "cullface": "down", "tintindex": 0 }, + "up": { "texture": "#glow_4", "cullface": "up", "tintindex": 0 }, + "north": { "texture": "#glow_4", "cullface": "north", "tintindex": 0 }, + "south": { "texture": "#glow_4", "cullface": "south", "tintindex": 0 }, + "west": { "texture": "#glow_4", "cullface": "west", "tintindex": 0 }, + "east": { "texture": "#glow_4", "cullface": "east", "tintindex": 0 } } }, { "from": [ 0, 0, 0 ], "to": [ 16, 16, 16 ], - "shade": false, "faces": { - "down": { "texture": "#glow_3", "cullface": "down" }, - "up": { "texture": "#glow_3", "cullface": "up" }, - "north": { "texture": "#glow_3", "cullface": "north" }, - "south": { "texture": "#glow_3", "cullface": "south" }, - "west": { "texture": "#glow_3", "cullface": "west" }, - "east": { "texture": "#glow_3", "cullface": "east" } + "down": { "texture": "#glow_3", "cullface": "down", "tintindex": 0 }, + "up": { "texture": "#glow_3", "cullface": "up", "tintindex": 0 }, + "north": { "texture": "#glow_3", "cullface": "north", "tintindex": 0 }, + "south": { "texture": "#glow_3", "cullface": "south", "tintindex": 0 }, + "west": { "texture": "#glow_3", "cullface": "west", "tintindex": 0 }, + "east": { "texture": "#glow_3", "cullface": "east", "tintindex": 0 } } }, { "from": [ 0, 0, 0 ], "to": [ 16, 16, 16 ], - "shade": false, "faces": { - "down": { "texture": "#glow_2", "cullface": "down" }, - "up": { "texture": "#glow_2", "cullface": "up" }, - "north": { "texture": "#glow_2", "cullface": "north" }, - "south": { "texture": "#glow_2", "cullface": "south" }, - "west": { "texture": "#glow_2", "cullface": "west" }, - "east": { "texture": "#glow_2", "cullface": "east" } + "down": { "texture": "#glow_2", "cullface": "down", "tintindex": 0 }, + "up": { "texture": "#glow_2", "cullface": "up", "tintindex": 0 }, + "north": { "texture": "#glow_2", "cullface": "north", "tintindex": 0 }, + "south": { "texture": "#glow_2", "cullface": "south", "tintindex": 0 }, + "west": { "texture": "#glow_2", "cullface": "west", "tintindex": 0 }, + "east": { "texture": "#glow_2", "cullface": "east", "tintindex": 0 } } }, { "from": [ 0, 0, 0 ], "to": [ 16, 16, 16 ], - "shade": false, "faces": { - "down": { "texture": "#glow_1", "cullface": "down" }, - "up": { "texture": "#glow_1", "cullface": "up" }, - "north": { "texture": "#glow_1", "cullface": "north" }, - "south": { "texture": "#glow_1", "cullface": "south" }, - "west": { "texture": "#glow_1", "cullface": "west" }, - "east": { "texture": "#glow_1", "cullface": "east" } + "down": { "texture": "#glow_1", "cullface": "down", "tintindex": 0 }, + "up": { "texture": "#glow_1", "cullface": "up", "tintindex": 0 }, + "north": { "texture": "#glow_1", "cullface": "north", "tintindex": 0 }, + "south": { "texture": "#glow_1", "cullface": "south", "tintindex": 0 }, + "west": { "texture": "#glow_1", "cullface": "west", "tintindex": 0 }, + "east": { "texture": "#glow_1", "cullface": "east", "tintindex": 0 } } }, { "from": [ 0, 0, 0 ], "to": [ 16, 16, 16 ], - "shade": false, "faces": { - "down": { "texture": "#glow_0", "cullface": "down" }, - "up": { "texture": "#glow_0", "cullface": "up" }, - "north": { "texture": "#glow_0", "cullface": "north" }, - "south": { "texture": "#glow_0", "cullface": "south" }, - "west": { "texture": "#glow_0", "cullface": "west" }, - "east": { "texture": "#glow_0", "cullface": "east" } + "down": { "texture": "#glow_0", "cullface": "down", "tintindex": 0 }, + "up": { "texture": "#glow_0", "cullface": "up", "tintindex": 0 }, + "north": { "texture": "#glow_0", "cullface": "north", "tintindex": 0 }, + "south": { "texture": "#glow_0", "cullface": "south", "tintindex": 0 }, + "west": { "texture": "#glow_0", "cullface": "west", "tintindex": 0 }, + "east": { "texture": "#glow_0", "cullface": "east", "tintindex": 0 } } } - ] + ], + "ctm_version": 1, + "ctm_overrides": { + "0": { + "layer": "TRANSLUCENT", + "type": "ctm", + "textures": [ + "#ctm" + ], + "extra": { + "light": 15 + } + } + } } diff --git a/src/test/resources/assets/minecraft/textures/block/tiles_small.png b/src/test/resources/assets/minecraft/textures/block/tiles_small.png new file mode 100644 index 0000000..52aa0ac Binary files /dev/null and b/src/test/resources/assets/minecraft/textures/block/tiles_small.png differ