diff options
26 files changed, 258 insertions, 144 deletions
diff --git a/build.gradle b/build.gradle index 81f6b2a..b64bf84 100644 --- a/build.gradle +++ b/build.gradle @@ -1,7 +1,7 @@ import java.nio.file.Files plugins { - id 'fabric-loom' version '0.12-SNAPSHOT' apply false + id 'fabric-loom' version '1.0-SNAPSHOT' apply false id 'io.shcm.shsupercm.fabric.fletchingtable' version '1.5' apply false id 'com.modrinth.minotaur' version '2.+' apply false id 'com.matthewprenger.cursegradle' version '1.4.0' apply false @@ -25,11 +25,11 @@ allprojects { mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2" modImplementation "net.fabricmc:fabric-loader:${project.loader_version}" - fletchingTable.fungible project.fungible + //fletchingTable.fungible project.fungible - modImplementation fabricApi.module("fabric-api-base", "${project.fabric_api}") - modImplementation fabricApi.module("fabric-resource-loader-v0", "${project.fabric_api}") - modImplementation fabricApi.module("fabric-command-api-v2", "${project.fabric_api}") + modCompileOnly fabricApi.module("fabric-api-base", "${project.fabric_api}") + modCompileOnly fabricApi.module("fabric-resource-loader-v0", "${project.fabric_api}") + modCompileOnly fabricApi.module("fabric-command-api-v2", "${project.fabric_api}") modCompileOnly("com.terraformersmc:modmenu:${project.modmenu}") { exclude(group: "net.fabricmc.fabric-api") @@ -67,10 +67,6 @@ allprojects { rename { "${it}_${project.archivesBaseName}" } } } - - loom { - shareRemapCaches = true - } } apply plugin: 'com.modrinth.minotaur' diff --git a/defaults/src/main/java/shcm/shsupercm/fabric/citresewn/defaults/cit/conditions/ConditionEnchantments.java b/defaults/src/main/java/shcm/shsupercm/fabric/citresewn/defaults/cit/conditions/ConditionEnchantments.java index 079c288..0dfc6f0 100644 --- a/defaults/src/main/java/shcm/shsupercm/fabric/citresewn/defaults/cit/conditions/ConditionEnchantments.java +++ b/defaults/src/main/java/shcm/shsupercm/fabric/citresewn/defaults/cit/conditions/ConditionEnchantments.java @@ -1,8 +1,8 @@ package shcm.shsupercm.fabric.citresewn.defaults.cit.conditions; import io.shcm.shsupercm.fabric.fletchingtable.api.Entrypoint; +import net.minecraft.registry.Registries; import net.minecraft.util.Identifier; -import net.minecraft.util.registry.Registry; import shcm.shsupercm.fabric.citresewn.api.CITConditionContainer; import shcm.shsupercm.fabric.citresewn.cit.CITCondition; import shcm.shsupercm.fabric.citresewn.cit.CITContext; @@ -42,7 +42,7 @@ public class ConditionEnchantments extends ListCondition<ConditionEnchantments.E public void load(PropertyValue value, PropertyGroup properties) throws CITParsingException { super.load(value, properties); - if (!Registry.ENCHANTMENT.containsId(this.value)) + if (!Registries.ENCHANTMENT.containsId(this.value)) warn(this.value + " is not in the enchantment registry", value, properties); } diff --git a/defaults/src/main/java/shcm/shsupercm/fabric/citresewn/defaults/cit/conditions/ConditionItems.java b/defaults/src/main/java/shcm/shsupercm/fabric/citresewn/defaults/cit/conditions/ConditionItems.java index 08986fc..cb82678 100644 --- a/defaults/src/main/java/shcm/shsupercm/fabric/citresewn/defaults/cit/conditions/ConditionItems.java +++ b/defaults/src/main/java/shcm/shsupercm/fabric/citresewn/defaults/cit/conditions/ConditionItems.java @@ -2,8 +2,8 @@ package shcm.shsupercm.fabric.citresewn.defaults.cit.conditions; import io.shcm.shsupercm.fabric.fletchingtable.api.Entrypoint; import net.minecraft.item.Item; +import net.minecraft.registry.Registries; import net.minecraft.util.Identifier; -import net.minecraft.util.registry.Registry; import shcm.shsupercm.fabric.citresewn.api.CITConditionContainer; import shcm.shsupercm.fabric.citresewn.cit.CITContext; import shcm.shsupercm.fabric.citresewn.cit.builtin.conditions.IdentifierCondition; @@ -59,8 +59,8 @@ public class ConditionItems extends ListCondition<ConditionItems.ItemCondition> public void load(PropertyValue value, PropertyGroup properties) throws CITParsingException { super.load(value, properties); - if (Registry.ITEM.containsId(this.value)) - this.item = Registry.ITEM.get(this.value); + if (Registries.ITEM.containsId(this.value)) + this.item = Registries.ITEM.get(this.value); else { this.item = null; warn(this.value + " is not in the item registry", value, properties); diff --git a/defaults/src/main/java/shcm/shsupercm/fabric/citresewn/defaults/cit/types/TypeArmor.java b/defaults/src/main/java/shcm/shsupercm/fabric/citresewn/defaults/cit/types/TypeArmor.java index ae757a4..b1abbd4 100644 --- a/defaults/src/main/java/shcm/shsupercm/fabric/citresewn/defaults/cit/types/TypeArmor.java +++ b/defaults/src/main/java/shcm/shsupercm/fabric/citresewn/defaults/cit/types/TypeArmor.java @@ -6,9 +6,9 @@ import net.minecraft.entity.LivingEntity; import net.minecraft.item.ArmorItem; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; +import net.minecraft.registry.Registries; import net.minecraft.resource.ResourceManager; import net.minecraft.util.Identifier; -import net.minecraft.util.registry.Registry; import shcm.shsupercm.fabric.citresewn.api.CITTypeContainer; import shcm.shsupercm.fabric.citresewn.cit.*; import shcm.shsupercm.fabric.citresewn.defaults.cit.conditions.ConditionItems; @@ -45,9 +45,9 @@ public class TypeArmor extends CITType { if (!itemsConditionPresent) try { Identifier propertiesName = new Identifier(properties.stripName()); - if (!Registry.ITEM.containsId(propertiesName)) + if (!Registries.ITEM.containsId(propertiesName)) throw new Exception(); - Item item = Registry.ITEM.get(propertiesName); + Item item = Registries.ITEM.get(propertiesName); if (!(item instanceof ArmorItem)) throw new Exception(); conditions.add(new ConditionItems(item)); diff --git a/defaults/src/main/java/shcm/shsupercm/fabric/citresewn/defaults/cit/types/TypeEnchantment.java b/defaults/src/main/java/shcm/shsupercm/fabric/citresewn/defaults/cit/types/TypeEnchantment.java index 1d20201..6e20ad8 100644 --- a/defaults/src/main/java/shcm/shsupercm/fabric/citresewn/defaults/cit/types/TypeEnchantment.java +++ b/defaults/src/main/java/shcm/shsupercm/fabric/citresewn/defaults/cit/types/TypeEnchantment.java @@ -7,8 +7,7 @@ import net.minecraft.client.render.*; import net.minecraft.resource.ResourceManager; import net.minecraft.util.Identifier; import net.minecraft.util.Util; -import net.minecraft.util.math.Matrix4f; -import net.minecraft.util.math.Vec3f; +import org.joml.Matrix4f; import org.lwjgl.opengl.GL11; import shcm.shsupercm.fabric.citresewn.api.CITGlobalProperties; import shcm.shsupercm.fabric.citresewn.api.CITTypeContainer; @@ -23,7 +22,7 @@ import shcm.shsupercm.fabric.citresewn.pack.format.PropertyKey; import shcm.shsupercm.fabric.citresewn.pack.format.PropertyValue; import shcm.shsupercm.util.logic.Loops; -import javax.annotation.Nullable; +import blue.endless.jankson.annotation.Nullable; import java.lang.ref.WeakReference; import java.util.*; import java.util.function.Consumer; @@ -242,41 +241,41 @@ public class TypeEnchantment extends CITType { public enum GlintRenderLayer { ARMOR_GLINT("armor_glint", 8f, layer -> layer - .shader(RenderPhaseAccessor.ARMOR_GLINT_SHADER()) + .program(RenderPhaseAccessor.ARMOR_GLINT_SHADER()) .writeMaskState(RenderPhaseAccessor.COLOR_MASK()) .cull(RenderPhaseAccessor.DISABLE_CULLING()) .depthTest(RenderPhaseAccessor.EQUAL_DEPTH_TEST()) .layering(RenderPhaseAccessor.VIEW_OFFSET_Z_LAYERING())), ARMOR_ENTITY_GLINT("armor_entity_glint", 0.16f, layer -> layer - .shader(RenderPhaseAccessor.ARMOR_ENTITY_GLINT_SHADER()) + .program(RenderPhaseAccessor.ARMOR_ENTITY_GLINT_SHADER()) .writeMaskState(RenderPhaseAccessor.COLOR_MASK()) .cull(RenderPhaseAccessor.DISABLE_CULLING()) .depthTest(RenderPhaseAccessor.EQUAL_DEPTH_TEST()) .layering(RenderPhaseAccessor.VIEW_OFFSET_Z_LAYERING())), GLINT_TRANSLUCENT("glint_translucent", 8f, layer -> layer - .shader(RenderPhaseAccessor.TRANSLUCENT_GLINT_SHADER()) + .program(RenderPhaseAccessor.TRANSLUCENT_GLINT_SHADER()) .writeMaskState(RenderPhaseAccessor.COLOR_MASK()) .cull(RenderPhaseAccessor.DISABLE_CULLING()) .depthTest(RenderPhaseAccessor.EQUAL_DEPTH_TEST()) .target(RenderPhaseAccessor.ITEM_TARGET())), GLINT("glint", 8f, layer -> layer - .shader(RenderPhaseAccessor.GLINT_SHADER()) + .program(RenderPhaseAccessor.GLINT_SHADER()) .writeMaskState(RenderPhaseAccessor.COLOR_MASK()) .cull(RenderPhaseAccessor.DISABLE_CULLING()) .depthTest(RenderPhaseAccessor.EQUAL_DEPTH_TEST())), DIRECT_GLINT("glint_direct", 8f, layer -> layer - .shader(RenderPhaseAccessor.DIRECT_GLINT_SHADER()) + .program(RenderPhaseAccessor.DIRECT_GLINT_SHADER()) .writeMaskState(RenderPhaseAccessor.COLOR_MASK()) .cull(RenderPhaseAccessor.DISABLE_CULLING()) .depthTest(RenderPhaseAccessor.EQUAL_DEPTH_TEST())), ENTITY_GLINT("entity_glint", 0.16f, layer -> layer - .shader(RenderPhaseAccessor.ENTITY_GLINT_SHADER()) + .program(RenderPhaseAccessor.ENTITY_GLINT_SHADER()) .writeMaskState(RenderPhaseAccessor.COLOR_MASK()) .cull(RenderPhaseAccessor.DISABLE_CULLING()) .depthTest(RenderPhaseAccessor.EQUAL_DEPTH_TEST()) .target(RenderPhaseAccessor.ITEM_TARGET())), DIRECT_ENTITY_GLINT("entity_glint_direct", 0.16f, layer -> layer - .shader(RenderPhaseAccessor.DIRECT_ENTITY_GLINT_SHADER()) + .program(RenderPhaseAccessor.DIRECT_ENTITY_GLINT_SHADER()) .writeMaskState(RenderPhaseAccessor.COLOR_MASK()) .cull(RenderPhaseAccessor.DISABLE_CULLING()) .depthTest(RenderPhaseAccessor.EQUAL_DEPTH_TEST())); @@ -311,10 +310,10 @@ public class TypeEnchantment extends CITType { float l = Util.getMeasuringTimeMs() * CITResewnDefaultsConfig.INSTANCE.type_enchantment_scroll_multiplier * speed; float x = (l % 110000f) / 110000f; float y = (l % 30000f) / 30000f; - Matrix4f matrix4f = Matrix4f.translate(-x, y, 0.0f); - matrix4f.multiply(Vec3f.POSITIVE_Z.getDegreesQuaternion(rotation)); - matrix4f.multiply(Matrix4f.scale(scale, scale, scale)); - setTextureMatrix(matrix4f); + setTextureMatrix(new Matrix4f() + .translation(-x, y, 0.0f) + .rotateZ(rotation) + .scale(scale)); setShaderColor(r, g, b, a * methodIntensity.intensity); } diff --git a/defaults/src/main/java/shcm/shsupercm/fabric/citresewn/defaults/cit/types/TypeItem.java b/defaults/src/main/java/shcm/shsupercm/fabric/citresewn/defaults/cit/types/TypeItem.java index 2eed0f7..1d2cc8b 100644 --- a/defaults/src/main/java/shcm/shsupercm/fabric/citresewn/defaults/cit/types/TypeItem.java +++ b/defaults/src/main/java/shcm/shsupercm/fabric/citresewn/defaults/cit/types/TypeItem.java @@ -15,9 +15,9 @@ import net.minecraft.client.util.SpriteIdentifier; import net.minecraft.client.world.ClientWorld; import net.minecraft.item.Item; import net.minecraft.item.Items; +import net.minecraft.registry.Registries; import net.minecraft.resource.ResourceManager; import net.minecraft.util.Identifier; -import net.minecraft.util.registry.Registry; import org.apache.commons.io.IOUtils; import shcm.shsupercm.fabric.citresewn.CITResewn; import shcm.shsupercm.fabric.citresewn.api.CITTypeContainer; @@ -75,9 +75,9 @@ public class TypeItem extends CITType { if (this.items.size() == 0) try { Identifier propertiesName = new Identifier(properties.stripName()); - if (!Registry.ITEM.containsId(propertiesName)) + if (!Registries.ITEM.containsId(propertiesName)) throw new Exception(); - Item item = Registry.ITEM.get(propertiesName); + Item item = Registries.ITEM.get(propertiesName); conditions.add(new ConditionItems(item)); this.items.add(item); } catch (Exception ignored) { @@ -185,7 +185,7 @@ public class TypeItem extends CITType { if (!assetIdentifiers.isEmpty()) { // contains sub models LinkedHashMap<Identifier, List<ModelOverride.Condition>> overrideConditions = new LinkedHashMap<>(); for (Item item : this.items) { - Identifier itemIdentifier = Registry.ITEM.getId(item); + Identifier itemIdentifier = Registries.ITEM.getId(item); overrideConditions.put(new Identifier(itemIdentifier.getNamespace(), "item/" + itemIdentifier.getPath()), Collections.emptyList()); Identifier itemModelIdentifier = new Identifier(itemIdentifier.getNamespace(), "models/item/" + itemIdentifier.getPath() + ".json"); @@ -269,7 +269,7 @@ public class TypeItem extends CITType { if (!assetIdentifiers.isEmpty()) { // contains sub models LinkedHashMap<Identifier, List<ModelOverride.Condition>> overrideConditions = new LinkedHashMap<>(); for (Item item : this.items) { - Identifier itemIdentifier = Registry.ITEM.getId(item); + Identifier itemIdentifier = Registries.ITEM.getId(item); overrideConditions.put(new Identifier(itemIdentifier.getNamespace(), "item/" + itemIdentifier.getPath()), Collections.emptyList()); Identifier itemModelIdentifier = new Identifier(itemIdentifier.getNamespace(), "models/item/" + itemIdentifier.getPath() + ".json"); @@ -404,7 +404,7 @@ public class TypeItem extends CITType { if (subItem == null) return null; String replacement = switch (subItem) { - case "bow_pulling_standby" -> "bow"; + case "bow_standby" -> "bow"; case "crossbow_standby" -> "crossbow"; case "potion_bottle_drinkable" -> "potion"; case "potion_bottle_splash" -> "splash_potion"; @@ -424,7 +424,7 @@ public class TypeItem extends CITType { } private JsonUnbakedModel getModelForFirstItemType(ResourceManager resourceManager) { - Identifier firstItemIdentifier = Registry.ITEM.getId(this.items.iterator().next()), firstItemModelIdentifier = new Identifier(firstItemIdentifier.getNamespace(), "models/item/" + firstItemIdentifier.getPath() + ".json"); + Identifier firstItemIdentifier = Registries.ITEM.getId(this.items.iterator().next()), firstItemModelIdentifier = new Identifier(firstItemIdentifier.getNamespace(), "models/item/" + firstItemIdentifier.getPath() + ".json"); try (InputStream is = resourceManager.getResource(firstItemModelIdentifier).orElseThrow().getInputStream()) { JsonUnbakedModel json = JsonUnbakedModel.deserialize(IOUtils.toString(is, StandardCharsets.UTF_8)); diff --git a/defaults/src/main/java/shcm/shsupercm/fabric/citresewn/defaults/mixin/common/ModelLoaderMixin.java b/defaults/src/main/java/shcm/shsupercm/fabric/citresewn/defaults/mixin/common/ModelLoaderMixin.java index a1e8e54..a652bd9 100644 --- a/defaults/src/main/java/shcm/shsupercm/fabric/citresewn/defaults/mixin/common/ModelLoaderMixin.java +++ b/defaults/src/main/java/shcm/shsupercm/fabric/citresewn/defaults/mixin/common/ModelLoaderMixin.java @@ -1,16 +1,14 @@ package shcm.shsupercm.fabric.citresewn.defaults.mixin.common; import com.mojang.datafixers.util.Either; +import net.minecraft.client.MinecraftClient; import net.minecraft.client.render.model.ModelLoader; import net.minecraft.client.render.model.json.JsonUnbakedModel; import net.minecraft.client.render.model.json.ModelOverride; import net.minecraft.client.util.SpriteIdentifier; -import net.minecraft.resource.ResourceManager; import net.minecraft.util.Identifier; import org.apache.commons.io.IOUtils; -import org.spongepowered.asm.mixin.Final; import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.Shadow; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; @@ -28,12 +26,10 @@ import java.util.stream.Collectors; */ @Mixin(ModelLoader.class) public class ModelLoaderMixin { - @Shadow @Final private ResourceManager resourceManager; - @Inject(method = "loadModelFromJson", cancellable = true, at = @At("HEAD")) public void citresewn$forceLiteralResewnModelIdentifier(Identifier id, CallbackInfoReturnable<JsonUnbakedModel> cir) { if (id instanceof ResewnItemModelIdentifier) { - try (InputStream is = resourceManager.getResource(id).orElseThrow().getInputStream()) { + try (InputStream is = MinecraftClient.getInstance().getResourceManager().getResource(id).orElseThrow().getInputStream()) { JsonUnbakedModel json = JsonUnbakedModel.deserialize(IOUtils.toString(is, StandardCharsets.UTF_8)); json.id = id.toString(); json.id = json.id.substring(0, json.id.length() - 5); @@ -44,7 +40,7 @@ public class ModelLoaderMixin { String originalPath = left.get().getTextureId().getPath(); String[] split = originalPath.split("/"); if (originalPath.startsWith("./") || (split.length > 2 && split[1].equals("cit"))) { - Identifier resolvedIdentifier = CITType.resolveAsset(id, originalPath, "textures", ".png", resourceManager); + Identifier resolvedIdentifier = CITType.resolveAsset(id, originalPath, "textures", ".png", MinecraftClient.getInstance().getResourceManager()); if (resolvedIdentifier != null) return Either.left(new SpriteIdentifier(left.get().getAtlasId(), resolvedIdentifier)); } @@ -56,7 +52,7 @@ public class ModelLoaderMixin { if (parentId != null) { String[] parentIdPathSplit = parentId.getPath().split("/"); if (parentId.getPath().startsWith("./") || (parentIdPathSplit.length > 2 && parentIdPathSplit[1].equals("cit"))) { - parentId = CITType.resolveAsset(id, parentId.getPath(), "models", ".json", resourceManager); + parentId = CITType.resolveAsset(id, parentId.getPath(), "models", ".json", MinecraftClient.getInstance().getResourceManager()); if (parentId != null) ((JsonUnbakedModelAccessor) json).setParentId(new ResewnItemModelIdentifier(parentId)); } @@ -65,7 +61,7 @@ public class ModelLoaderMixin { json.getOverrides().replaceAll(override -> { String[] modelIdPathSplit = override.getModelId().getPath().split("/"); if (override.getModelId().getPath().startsWith("./") || (modelIdPathSplit.length > 2 && modelIdPathSplit[1].equals("cit"))) { - Identifier resolvedOverridePath = CITType.resolveAsset(id, override.getModelId().getPath(), "models", ".json", resourceManager); + Identifier resolvedOverridePath = CITType.resolveAsset(id, override.getModelId().getPath(), "models", ".json", MinecraftClient.getInstance().getResourceManager()); if (resolvedOverridePath != null) return new ModelOverride(new ResewnItemModelIdentifier(resolvedOverridePath), override.streamConditions().collect(Collectors.toList())); } diff --git a/defaults/src/main/java/shcm/shsupercm/fabric/citresewn/defaults/mixin/common/SpriteAtlasTextureMixin.java b/defaults/src/main/java/shcm/shsupercm/fabric/citresewn/defaults/mixin/common/SpriteAtlasTextureMixin.java deleted file mode 100644 index 0e05a42..0000000 --- a/defaults/src/main/java/shcm/shsupercm/fabric/citresewn/defaults/mixin/common/SpriteAtlasTextureMixin.java +++ /dev/null @@ -1,21 +0,0 @@ -package shcm.shsupercm.fabric.citresewn.defaults.mixin.common; - -import net.minecraft.client.texture.SpriteAtlasTexture; -import net.minecraft.util.Identifier; -import org.spongepowered.asm.mixin.Final; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.Shadow; -import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.Inject; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; - -@Mixin(SpriteAtlasTexture.class) -public class SpriteAtlasTextureMixin { - @Shadow @Final private static String PNG_EXTENSION; - - @Inject(method = "getTexturePath", cancellable = true, at = @At("HEAD")) - public void citresewn$forceAbsoluteTextureIdentifier(Identifier id, CallbackInfoReturnable<Identifier> cir) { - if (id.getPath().endsWith(PNG_EXTENSION)) - cir.setReturnValue(id); - } -} diff --git a/defaults/src/main/java/shcm/shsupercm/fabric/citresewn/defaults/mixin/types/enchantment/ItemRendererMixin.java b/defaults/src/main/java/shcm/shsupercm/fabric/citresewn/defaults/mixin/types/enchantment/ItemRendererMixin.java index b4bd37d..1d27326 100644 --- a/defaults/src/main/java/shcm/shsupercm/fabric/citresewn/defaults/mixin/types/enchantment/ItemRendererMixin.java +++ b/defaults/src/main/java/shcm/shsupercm/fabric/citresewn/defaults/mixin/types/enchantment/ItemRendererMixin.java @@ -54,7 +54,7 @@ public class ItemRendererMixin { return; VertexConsumer vertexConsumer = TypeEnchantment.GlintRenderLayer.GLINT.tryApply(null, layer, provider); if (vertexConsumer != null) - cir.setReturnValue(VertexConsumers.union(new OverlayVertexConsumer(vertexConsumer, entry.getPositionMatrix(), entry.getNormalMatrix()), cir.getReturnValue())); + cir.setReturnValue(VertexConsumers.union(new OverlayVertexConsumer(vertexConsumer, entry.getPositionMatrix(), entry.getNormalMatrix(), 1f), cir.getReturnValue())); } @Inject(method = "getDirectCompassGlintConsumer", cancellable = true, at = @At("RETURN")) @@ -63,7 +63,7 @@ public class ItemRendererMixin { return; VertexConsumer vertexConsumer = TypeEnchantment.GlintRenderLayer.DIRECT_GLINT.tryApply(null, layer, provider); if (vertexConsumer != null) - cir.setReturnValue(VertexConsumers.union(new OverlayVertexConsumer(vertexConsumer, entry.getPositionMatrix(), entry.getNormalMatrix()), cir.getReturnValue())); + cir.setReturnValue(VertexConsumers.union(new OverlayVertexConsumer(vertexConsumer, entry.getPositionMatrix(), entry.getNormalMatrix(), 1f), cir.getReturnValue())); } @Inject(method = "getItemGlintConsumer", cancellable = true, at = @At("RETURN")) diff --git a/defaults/src/main/java/shcm/shsupercm/fabric/citresewn/defaults/mixin/types/enchantment/RenderPhaseAccessor.java b/defaults/src/main/java/shcm/shsupercm/fabric/citresewn/defaults/mixin/types/enchantment/RenderPhaseAccessor.java index b2a59b4..216248d 100644 --- a/defaults/src/main/java/shcm/shsupercm/fabric/citresewn/defaults/mixin/types/enchantment/RenderPhaseAccessor.java +++ b/defaults/src/main/java/shcm/shsupercm/fabric/citresewn/defaults/mixin/types/enchantment/RenderPhaseAccessor.java @@ -6,13 +6,13 @@ import org.spongepowered.asm.mixin.gen.Accessor; @Mixin(RenderPhase.class) public interface RenderPhaseAccessor { - @Accessor("ARMOR_GLINT_SHADER") static RenderPhase.Shader ARMOR_GLINT_SHADER() { throw new RuntimeException(); } - @Accessor("ARMOR_ENTITY_GLINT_SHADER") static RenderPhase.Shader ARMOR_ENTITY_GLINT_SHADER() { throw new RuntimeException(); } - @Accessor("TRANSLUCENT_GLINT_SHADER") static RenderPhase.Shader TRANSLUCENT_GLINT_SHADER() { throw new RuntimeException(); } - @Accessor("GLINT_SHADER") static RenderPhase.Shader GLINT_SHADER() { throw new RuntimeException(); } - @Accessor("DIRECT_GLINT_SHADER") static RenderPhase.Shader DIRECT_GLINT_SHADER() { throw new RuntimeException(); } - @Accessor("ENTITY_GLINT_SHADER") static RenderPhase.Shader ENTITY_GLINT_SHADER() { throw new RuntimeException(); } - @Accessor("DIRECT_ENTITY_GLINT_SHADER") static RenderPhase.Shader DIRECT_ENTITY_GLINT_SHADER() { throw new RuntimeException(); } + @Accessor("ARMOR_GLINT_PROGRAM") static RenderPhase.ShaderProgram ARMOR_GLINT_SHADER() { throw new RuntimeException(); } + @Accessor("ARMOR_ENTITY_GLINT_PROGRAM") static RenderPhase.ShaderProgram ARMOR_ENTITY_GLINT_SHADER() { throw new RuntimeException(); } + @Accessor("TRANSLUCENT_GLINT_PROGRAM") static RenderPhase.ShaderProgram TRANSLUCENT_GLINT_SHADER() { throw new RuntimeException(); } + @Accessor("GLINT_PROGRAM") static RenderPhase.ShaderProgram GLINT_SHADER() { throw new RuntimeException(); } + @Accessor("DIRECT_GLINT_PROGRAM") static RenderPhase.ShaderProgram DIRECT_GLINT_SHADER() { throw new RuntimeException(); } + @Accessor("ENTITY_GLINT_PROGRAM") static RenderPhase.ShaderProgram ENTITY_GLINT_SHADER() { throw new RuntimeException(); } + @Accessor("DIRECT_ENTITY_GLINT_PROGRAM") static RenderPhase.ShaderProgram DIRECT_ENTITY_GLINT_SHADER() { throw new RuntimeException(); } @Accessor("DISABLE_CULLING") static RenderPhase.Cull DISABLE_CULLING() { throw new RuntimeException(); } @Accessor("EQUAL_DEPTH_TEST") static RenderPhase.DepthTest EQUAL_DEPTH_TEST() { throw new RuntimeException(); } @Accessor("COLOR_MASK") static RenderPhase.WriteMaskState COLOR_MASK() { throw new RuntimeException(); } diff --git a/defaults/src/main/java/shcm/shsupercm/fabric/citresewn/defaults/mixin/types/item/ModelLoaderMixin.java b/defaults/src/main/java/shcm/shsupercm/fabric/citresewn/defaults/mixin/types/item/ModelLoaderMixin.java index 68d6bfc..9c4d1dd 100644 --- a/defaults/src/main/java/shcm/shsupercm/fabric/citresewn/defaults/mixin/types/item/ModelLoaderMixin.java +++ b/defaults/src/main/java/shcm/shsupercm/fabric/citresewn/defaults/mixin/types/item/ModelLoaderMixin.java @@ -1,14 +1,14 @@ package shcm.shsupercm.fabric.citresewn.defaults.mixin.types.item; +import net.minecraft.client.MinecraftClient; import net.minecraft.client.color.block.BlockColors; import net.minecraft.client.render.model.BakedModel; import net.minecraft.client.render.model.ModelLoader; -import net.minecraft.client.render.model.SpriteAtlasManager; import net.minecraft.client.render.model.UnbakedModel; import net.minecraft.client.render.model.json.JsonUnbakedModel; import net.minecraft.client.render.model.json.ModelOverride; -import net.minecraft.client.texture.TextureManager; -import net.minecraft.resource.ResourceManager; +import net.minecraft.client.texture.Sprite; +import net.minecraft.client.util.SpriteIdentifier; import net.minecraft.util.Identifier; import net.minecraft.util.profiler.Profiler; import org.spongepowered.asm.mixin.Final; @@ -18,13 +18,13 @@ import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.ModifyArg; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; import shcm.shsupercm.fabric.citresewn.CITResewn; import shcm.shsupercm.fabric.citresewn.cit.CIT; import shcm.shsupercm.fabric.citresewn.defaults.cit.types.TypeItem; import shcm.shsupercm.fabric.citresewn.defaults.common.ResewnItemModelIdentifier; import java.util.*; +import java.util.function.BiFunction; import static shcm.shsupercm.fabric.citresewn.CITResewn.info; import static shcm.shsupercm.fabric.citresewn.defaults.cit.types.TypeItem.CONTAINER; @@ -38,7 +38,7 @@ public class ModelLoaderMixin { @Inject(method = "<init>", at = @At(value = "INVOKE", ordinal = 0, target = "Lnet/minecraft/util/profiler/Profiler;swap(Ljava/lang/String;)V")) - public void citresewn$addTypeItemModels(ResourceManager resourceManager, BlockColors blockColors, Profiler profiler, int i, CallbackInfo ci) { + public void citresewn$addTypeItemModels(BlockColors blockColors, Profiler profiler, Map map, Map map2, CallbackInfo ci) { profiler.swap("citresewn:type_item_models"); if (!CONTAINER.active()) return; @@ -46,7 +46,7 @@ public class ModelLoaderMixin { info("Loading item CIT models..."); for (CIT<TypeItem> cit : CONTAINER.loaded) try { - cit.type.loadUnbakedAssets(resourceManager); + cit.type.loadUnbakedAssets(MinecraftClient.getInstance().getResourceManager()); for (JsonUnbakedModel unbakedModel : cit.type.unbakedAssets.values()) { ResewnItemModelIdentifier id = new ResewnItemModelIdentifier(unbakedModel.id); @@ -61,12 +61,11 @@ public class ModelLoaderMixin { TypeItem.GENERATED_SUB_CITS_SEEN.clear(); } - @Inject(method = "upload", at = @At("RETURN")) - public void citresewn$linkTypeItemModels(TextureManager textureManager, Profiler profiler, CallbackInfoReturnable<SpriteAtlasManager> cir) { + @Inject(method = "bake", at = @At("RETURN")) + public void citresewn$linkTypeItemModels(BiFunction<Identifier, SpriteIdentifier, Sprite> spriteLoader, CallbackInfo ci) { if (!CONTAINER.active()) return; - profiler.push("citresewn:type_item_linking"); info("Linking baked models to item CITs..."); for (CIT<TypeItem> cit : CONTAINER.loaded) { @@ -83,13 +82,12 @@ public class ModelLoaderMixin { } cit.type.unbakedAssets = null; } - - profiler.pop(); } @ModifyArg(method = "loadModelFromJson", at = - @At(value = "INVOKE", target = "Lnet/minecraft/resource/ResourceManager;openAsReader(Lnet/minecraft/util/Identifier;)Ljava/io/BufferedReader;")) - public Identifier citresewn$fixDuplicatePrefixSuffix(Identifier original) { + @At(value = "INVOKE", ordinal = 1, target = "Ljava/util/Map;get(Ljava/lang/Object;)Ljava/lang/Object;")) + public Object citresewn$fixDuplicatePrefixSuffix(Object key) { + Identifier original = (Identifier) key; if (CONTAINER.active() && original.getPath().startsWith("models/models/") && original.getPath().endsWith(".json.json") && original.getPath().contains("cit")) return new Identifier(original.getNamespace(), original.getPath().substring(7, original.getPath().length() - 5)); diff --git a/defaults/src/main/resources/assets/citresewn-defaults/lang/zh_tw.json b/defaults/src/main/resources/assets/citresewn-defaults/lang/zh_tw.json new file mode 100644 index 0000000..77d0ec6 --- /dev/null +++ b/defaults/src/main/resources/assets/citresewn-defaults/lang/zh_tw.json @@ -0,0 +1,7 @@ +{
+ "config.citresewn-defaults.title": "CIT Resewn:預設",
+ "config.citresewn-defaults.tooltip": "前往「預設」設定選單",
+
+ "config.citresewn-defaults.type_enchantment_scroll_multiplier.title": "附魔類別:捲動乘數",
+ "config.citresewn-defaults.type_enchantment_scroll_multiplier.tooltip": "用於調整「自訂物品紋理」的附魔閃光捲動速度"
+}
\ No newline at end of file diff --git a/defaults/src/main/resources/citresewn-defaults.accesswidener b/defaults/src/main/resources/citresewn-defaults.accesswidener index 739fc5e..fbf3f4d 100644 --- a/defaults/src/main/resources/citresewn-defaults.accesswidener +++ b/defaults/src/main/resources/citresewn-defaults.accesswidener @@ -17,7 +17,7 @@ mutable field net/minecraft/client/render/model/json/ModelOverrideList co # TypeEnchantment accessible class net/minecraft/client/render/RenderLayer$MultiPhaseParameters accessible method net/minecraft/client/render/RenderLayer of (Ljava/lang/String;Lnet/minecraft/client/render/VertexFormat;Lnet/minecraft/client/render/VertexFormat$DrawMode;ILnet/minecraft/client/render/RenderLayer$MultiPhaseParameters;)Lnet/minecraft/client/render/RenderLayer$MultiPhase; -accessible class net/minecraft/client/render/RenderPhase$Shader +accessible class net/minecraft/client/render/RenderPhase$ShaderProgram accessible class net/minecraft/client/render/RenderPhase$Texturing accessible class net/minecraft/client/render/RenderPhase$Transparency accessible class net/minecraft/client/render/RenderPhase$Texture diff --git a/gradle.properties b/gradle.properties index cb57d7b..e397383 100644 --- a/gradle.properties +++ b/gradle.properties @@ -3,15 +3,15 @@ org.gradle.jvmargs=-Xmx1G # Fabric Properties # check these on https://modmuss50.me/fabric.html -minecraft_version=1.19.2 -publish_minecraft_versions=1.19,1.19.1,1.19.2 -yarn_mappings=1.19.2+build.8 -loader_version=0.14.9 +minecraft_version=1.19.3 +publish_minecraft_versions=1.19.3 +yarn_mappings=1.19.3+build.4 +loader_version=0.14.12 fungible=1.2+mc1.19.2 -fabric_api=0.60.0+1.19.2 -modmenu=4.0.6 -cloth=8.0.75 +fabric_api=0.69.1+1.19.3 +modmenu=5.0.2 +cloth=9.0.94 # Mod Properties mod_version=1.1.2 diff --git a/src/main/java/shcm/shsupercm/fabric/citresewn/api/CITGlobalProperties.java b/src/main/java/shcm/shsupercm/fabric/citresewn/api/CITGlobalProperties.java index 05495af..6a6ec22 100644 --- a/src/main/java/shcm/shsupercm/fabric/citresewn/api/CITGlobalProperties.java +++ b/src/main/java/shcm/shsupercm/fabric/citresewn/api/CITGlobalProperties.java @@ -2,7 +2,7 @@ package shcm.shsupercm.fabric.citresewn.api; import shcm.shsupercm.fabric.citresewn.pack.format.PropertyValue; -import javax.annotation.Nullable; +import blue.endless.jankson.annotation.Nullable; /** * @see #globalProperty(String, PropertyValue) diff --git a/src/main/java/shcm/shsupercm/fabric/citresewn/cit/CITContext.java b/src/main/java/shcm/shsupercm/fabric/citresewn/cit/CITContext.java index cfc10f8..0a44915 100644 --- a/src/main/java/shcm/shsupercm/fabric/citresewn/cit/CITContext.java +++ b/src/main/java/shcm/shsupercm/fabric/citresewn/cit/CITContext.java @@ -11,7 +11,7 @@ import net.minecraft.nbt.NbtElement; import net.minecraft.util.Identifier; import net.minecraft.world.World; -import javax.annotation.Nullable; +import blue.endless.jankson.annotation.Nullable; import java.util.LinkedHashMap; import java.util.Map; import java.util.Objects; diff --git a/src/main/java/shcm/shsupercm/fabric/citresewn/mixin/AtlasLoaderMixin.java b/src/main/java/shcm/shsupercm/fabric/citresewn/mixin/AtlasLoaderMixin.java new file mode 100644 index 0000000..ee5c125 --- /dev/null +++ b/src/main/java/shcm/shsupercm/fabric/citresewn/mixin/AtlasLoaderMixin.java @@ -0,0 +1,45 @@ +package shcm.shsupercm.fabric.citresewn.mixin; + +import net.minecraft.client.texture.atlas.AtlasLoader; +import net.minecraft.client.texture.atlas.AtlasSource; +import net.minecraft.client.texture.atlas.AtlasSourceType; +import net.minecraft.resource.Resource; +import net.minecraft.resource.ResourceFinder; +import net.minecraft.resource.ResourceManager; +import net.minecraft.util.Identifier; +import org.spongepowered.asm.mixin.Final; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Shadow; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; +import shcm.shsupercm.fabric.citresewn.pack.PackParser; + +import java.util.List; +import java.util.Map; + +@Mixin(AtlasLoader.class) +public class AtlasLoaderMixin { + @Shadow @Final private List<AtlasSource> sources; + + @Inject(method = "of", at = @At("RETURN"), cancellable = true) + private static void citresewn$atlasSource(ResourceManager resourceManager, Identifier id, CallbackInfoReturnable<AtlasLoader> cir) { + if (id.getPath().equals("blocks") && id.getNamespace().equals("minecraft")) { + ((AtlasLoaderMixin) (Object) cir.getReturnValue()).sources.add(new AtlasSource() { + @Override + public void load(ResourceManager resourceManager, SpriteRegions regions) { + for (String root : PackParser.ROOTS) { + ResourceFinder resourceFinder = new ResourceFinder(root + "/cit", ".png"); + for (Map.Entry<Identifier, Resource> entry : resourceFinder.findResources(resourceManager).entrySet()) + regions.add(resourceFinder.toResourceId(entry.getKey()).withPrefixedPath(root + "/cit/"), entry.getValue()); + } + } + + @Override + public AtlasSourceType getType() { + return null; + } + }); + } + } +} diff --git a/src/main/java/shcm/shsupercm/fabric/citresewn/mixin/AtlasPreparationMixin.java b/src/main/java/shcm/shsupercm/fabric/citresewn/mixin/AtlasPreparationMixin.java new file mode 100644 index 0000000..7a6cfa1 --- /dev/null +++ b/src/main/java/shcm/shsupercm/fabric/citresewn/mixin/AtlasPreparationMixin.java @@ -0,0 +1,22 @@ +package shcm.shsupercm.fabric.citresewn.mixin; + +import net.minecraft.client.render.model.SpriteAtlasManager; +import net.minecraft.util.Identifier; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.ModifyVariable; + +@Mixin(SpriteAtlasManager.AtlasPreparation.class) +public abstract class AtlasPreparationMixin { + + @ModifyVariable(method = "getSprite", argsOnly = true, at = @At("HEAD")) + private Identifier citresewn$unwrapTexturePaths(Identifier id) { + if (id.getPath().endsWith(".png")) { + id = id.withPath(path -> path.substring(0, path.length() - 4)); + + if (id.getPath().startsWith("textures/")) + id = id.withPath(path -> path.substring(9)); + } + return id; + } +} diff --git a/src/main/java/shcm/shsupercm/fabric/citresewn/mixin/ModelLoaderMixin.java b/src/main/java/shcm/shsupercm/fabric/citresewn/mixin/ModelLoaderMixin.java index df11ac9..215c596 100644 --- a/src/main/java/shcm/shsupercm/fabric/citresewn/mixin/ModelLoaderMixin.java +++ b/src/main/java/shcm/shsupercm/fabric/citresewn/mixin/ModelLoaderMixin.java @@ -1,5 +1,6 @@ package shcm.shsupercm.fabric.citresewn.mixin; +import net.minecraft.client.MinecraftClient; import net.minecraft.client.color.block.BlockColors; import net.minecraft.client.render.model.ModelLoader; import net.minecraft.resource.ResourceManager; @@ -10,6 +11,8 @@ import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; import shcm.shsupercm.fabric.citresewn.cit.ActiveCITs; +import java.util.Map; + /** * Initializes the (re)loading of active cits in the resource manager. * @see ActiveCITs @@ -21,9 +24,9 @@ public class ModelLoaderMixin { */ @Inject(method = "<init>", at = @At(value = "INVOKE", ordinal = 0, target = "Lnet/minecraft/util/profiler/Profiler;push(Ljava/lang/String;)V")) - private void citresewn$loadCITs(ResourceManager resourceManager, BlockColors blockColors, Profiler profiler, int i, CallbackInfo ci) { + private void citresewn$loadCITs(BlockColors blockColors, Profiler profiler, Map jsonUnbakedModels, Map blockStates, CallbackInfo ci) { profiler.push("citresewn:reloading_cits"); - ActiveCITs.load(resourceManager, profiler); + ActiveCITs.load(MinecraftClient.getInstance().getResourceManager(), profiler); profiler.pop(); } } diff --git a/src/main/java/shcm/shsupercm/fabric/citresewn/mixin/ResourceFinderMixin.java b/src/main/java/shcm/shsupercm/fabric/citresewn/mixin/ResourceFinderMixin.java new file mode 100644 index 0000000..0abdf76 --- /dev/null +++ b/src/main/java/shcm/shsupercm/fabric/citresewn/mixin/ResourceFinderMixin.java @@ -0,0 +1,23 @@ +package shcm.shsupercm.fabric.citresewn.mixin; + +import net.minecraft.resource.ResourceFinder; +import net.minecraft.util.Identifier; +import org.spongepowered.asm.mixin.Final; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Shadow; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; + +@Mixin(ResourceFinder.class) +public class ResourceFinderMixin { + + @Shadow @Final private String fileExtension; + + @Inject(method = "toResourcePath", cancellable = true, at = + @At("HEAD")) + private void citresewn$forceAbsoluteTextureIdentifier(Identifier id, CallbackInfoReturnable<Identifier> cir) { + if (id.getPath().endsWith(".png") && this.fileExtension.equals(".png")) + cir.setReturnValue(id); + } +} diff --git a/src/main/java/shcm/shsupercm/fabric/citresewn/mixin/broken_paths/AbstractFileResourcePackMixin.java b/src/main/java/shcm/shsupercm/fabric/citresewn/mixin/broken_paths/AbstractFileResourcePackMixin.java index b241fff..673ddbf 100644 --- a/src/main/java/shcm/shsupercm/fabric/citresewn/mixin/broken_paths/AbstractFileResourcePackMixin.java +++ b/src/main/java/shcm/shsupercm/fabric/citresewn/mixin/broken_paths/AbstractFileResourcePackMixin.java @@ -1,26 +1,17 @@ package shcm.shsupercm.fabric.citresewn.mixin.broken_paths; import net.minecraft.resource.AbstractFileResourcePack; -import net.minecraft.resource.DirectoryResourcePack; import net.minecraft.resource.ResourcePack; -import net.minecraft.resource.ZipResourcePack; +import net.minecraft.resource.ResourceType; import net.minecraft.resource.metadata.PackResourceMetadata; import net.minecraft.resource.metadata.ResourceMetadataReader; -import net.minecraft.util.Identifier; import net.minecraft.util.InvalidIdentifierException; -import org.spongepowered.asm.mixin.Final; import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.Shadow; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; import shcm.shsupercm.fabric.citresewn.config.BrokenPaths; -import java.io.File; -import java.nio.file.Files; -import java.nio.file.Path; -import java.util.zip.ZipFile; - /** * Adds a resourcepack compatibility error message when broken paths are enabled and are detected in a pack. * @see BrokenPaths @@ -28,32 +19,17 @@ import java.util.zip.ZipFile; */ @Mixin(AbstractFileResourcePack.class) public abstract class AbstractFileResourcePackMixin implements ResourcePack { - @Shadow @Final protected File base; - @SuppressWarnings({"unchecked", "ConstantConditions", "EqualsBetweenInconvertibleTypes"}) + @SuppressWarnings({"unchecked"}) @Inject(method = "parseMetadata(Lnet/minecraft/resource/metadata/ResourceMetadataReader;)Ljava/lang/Object;", cancellable = true, at = @At("RETURN")) public <T extends PackResourceMetadata> void citresewn$brokenpaths$parseMetadata(ResourceMetadataReader<T> metaReader, CallbackInfoReturnable<T> cir) { - if (cir.getReturnValue() != null) - try { - if (this.getClass().equals(ZipResourcePack.class)) { - try (ZipFile zipFile = new ZipFile(base)) { - zipFile.stream() - .forEach(entry -> { - if (entry.getName().startsWith("assets") && !entry.getName().endsWith(".DS_Store")) - new Identifier("minecraft", entry.getName()); - }); - } - } else if (this.getClass().equals(DirectoryResourcePack.class)) { - final Path assets = new File(base, "assets").toPath(); - Files.walk(assets) - .forEach(fullPath -> { - String path = assets.relativize(fullPath).toString().replace('\\', '/'); - if (!path.endsWith(".DS_Store")) - new Identifier("minecraft", path); - }); - } - } catch (InvalidIdentifierException e) { - cir.setReturnValue((T) new PackResourceMetadata(cir.getReturnValue().getDescription(), Integer.MAX_VALUE - 53)); - } catch (Exception ignored) {} + if (cir.getReturnValue() != null) try { + for (String namespace : getNamespaces(ResourceType.CLIENT_RESOURCES)) { + findResources(ResourceType.CLIENT_RESOURCES, namespace, "", (identifier, inputStreamInputSupplier) -> { + }); + } + } catch (InvalidIdentifierException e) { + cir.setReturnValue((T) new PackResourceMetadata(cir.getReturnValue().getDescription(), Integer.MAX_VALUE - 53)); + } catch (Exception ignored) { } } } diff --git a/src/main/java/shcm/shsupercm/fabric/citresewn/pack/PackParser.java b/src/main/java/shcm/shsupercm/fabric/citresewn/pack/PackParser.java index ffc242f..aa367b7 100644 --- a/src/main/java/shcm/shsupercm/fabric/citresewn/pack/PackParser.java +++ b/src/main/java/shcm/shsupercm/fabric/citresewn/pack/PackParser.java @@ -1,9 +1,6 @@ package shcm.shsupercm.fabric.citresewn.pack; -import net.minecraft.resource.Resource; -import net.minecraft.resource.ResourceManager; -import net.minecraft.resource.ResourcePack; -import net.minecraft.resource.ResourceType; +import net.minecraft.resource.*; import net.minecraft.util.Identifier; import shcm.shsupercm.fabric.citresewn.CITResewn; import shcm.shsupercm.fabric.citresewn.cit.builtin.conditions.core.FallbackCondition; @@ -18,6 +15,7 @@ import shcm.shsupercm.fabric.citresewn.pack.format.PropertyKey; import shcm.shsupercm.fabric.citresewn.pack.format.PropertyValue; import java.io.FileNotFoundException; +import java.io.InputStream; import java.util.*; import java.util.stream.Collectors; @@ -28,7 +26,7 @@ public final class PackParser { private PackParser() {} /** * Possible CIT roots in resourcepacks ordered in increasing order of priority. */ - private static final String[] ROOTS = new String[] { "mcpatcher", "optifine", "citresewn" }; + public static final List<String> ROOTS = List.of("mcpatcher", "optifine", "citresewn"); /** * Loads a merged global property group from loaded packs making sure to respect order. @@ -44,8 +42,9 @@ public final class PackParser { private PackParser() {} for (String root : ROOTS) { Identifier identifier = new Identifier(namespace, root + "/cit.properties"); try { - if (pack.contains(ResourceType.CLIENT_RESOURCES, identifier)) - globalProperties.load(pack.getName(), identifier, pack.open(ResourceType.CLIENT_RESOURCES, identifier)); + InputSupplier<InputStream> citPropertiesSupplier = pack.open(ResourceType.CLIENT_RESOURCES, identifier); + if (citPropertiesSupplier != null) + globalProperties.load(pack.getName(), identifier, citPropertiesSupplier.get()); } catch (FileNotFoundException ignored) { } catch (Exception e) { CITResewn.logErrorLoading("Errored while loading global properties: " + identifier + " from " + pack.getName()); diff --git a/src/main/resources/assets/citresewn/lang/it_it.json b/src/main/resources/assets/citresewn/lang/it_it.json new file mode 100644 index 0000000..debdc34 --- /dev/null +++ b/src/main/resources/assets/citresewn/lang/it_it.json @@ -0,0 +1,19 @@ +{ + "config.citresewn.title": "Configurazione CIT Resewn", + "config.citresewn.configure": "Configura", + "config.citresewn.enabled.title": "Attivato", + "config.citresewn.enabled.tooltip": "CIT Resewn può caricare e iniettare cits dalle resourcepack?", + "config.citresewn.mute_errors.title": "Muta gli errori di caricamento", + "config.citresewn.mute_errors.tooltip": "Dovrebbe CIT Resewn mutare gli errori cit?", + "config.citresewn.mute_warns.title": "Muta avvisi di caricamento", + "config.citresewn.mute_warns.tooltip": "Muta gli avvisi di caricamento cit", + "config.citresewn.broken_paths.title": "Consenti percorsi non funzionanti nelle resourcepacks", + "config.citresewn.broken_paths.tooltip": "Permette di caricare le resourcepack non funzionanti, Potrebbe causare problemi!", + "config.citresewn.cache_ms.title": "Cache", + "config.citresewn.cache_ms.tooltip": "Quanto spesso le cache cit dovrebbero essere ricaricate.\\nValori più alti daranno più performance.\\nValori più bassi faranno caricare prima i cit.\\n\"Tempo Reale\" rimuovve le cache del tutto caricando le cits ogni frame.", + "config.citresewn.cache_ms.ticks.0": "TEMPO REALE", + "config.citresewn.cache_ms.ticks.1": "OGNI TICK", + "config.citresewn.cache_ms.ticks.any": "OGNI %s TICK", + "pack.incompatible.broken_paths": "(Contiene percorsi non funzionanti)", + "pack.incompatible.confirm.broken_paths": "Questo pack contiene persorsi non funzionanti e il supporto per questi potrebbe mancare in futuro. Contatta l'autore del pack per rimuovere questo avviso (~ CIT Resewn)" +} diff --git a/src/main/resources/assets/citresewn/lang/pt_br.json b/src/main/resources/assets/citresewn/lang/pt_br.json new file mode 100644 index 0000000..f5a6f5b --- /dev/null +++ b/src/main/resources/assets/citresewn/lang/pt_br.json @@ -0,0 +1,26 @@ +{
+ "config.citresewn.title": "Configuração Refeita CIT",
+ "config.citresewn.configure": "Configurar",
+
+ "config.citresewn.enabled.title": "Habilitado",
+ "config.citresewn.enabled.tooltip": "O CIT Resewn deve carregar e injetar citações de pacotes de recursos",
+
+ "config.citresewn.mute_errors.title": "Silenciar erros de carregamento",
+ "config.citresewn.mute_errors.tooltip": "O CIT Resewn não deve registrar erros cit",
+
+ "config.citresewn.mute_warns.title": "Silenciar avisos de carregamento",
+ "config.citresewn.mute_warns.tooltip": "O CIT Resewn não deve registrar os avisos do cit",
+
+ "config.citresewn.broken_paths.title": "Permitir caminhos quebrados em resourcepacks",
+ "config.citresewn.broken_paths.tooltip": "Permite que pacotes com caminhos de recursos ilegais sejam carregados.\nPode causar problemas!",
+
+ "config.citresewn.cache_ms.title": "Cache",
+ "config.citresewn.cache_ms.tooltip": "Com que frequência o cache cit deve ser atualizado.\nValores mais altos darão mais desempenho.\nValores mais baixos farão com que as citações sejam atualizadas mais rapidamente.\nREALTIME removerá o cache completamente,\n fazendo com que os itens verifiquem citações a cada quadro.",
+ "config.citresewn.cache_ms.ticks.0": "TEMPO REAL",
+ "config.citresewn.cache_ms.ticks.1": "CADA TICK",
+ "config.citresewn.cache_ms.ticks.any": "CADA %s TICKS",
+
+
+ "pack.incompatible.broken_paths": "(Contém caminhos quebrados)",
+ "pack.incompatible.confirm.broken_paths": "Este pacote contém caminhos quebrados e o suporte para ele pode ser descartado no futuro. Entre em contato com o autor do pacote para remover este aviso. (~ CIT Resewn)"
+ }
\ No newline at end of file diff --git a/src/main/resources/assets/citresewn/lang/zh_tw.json b/src/main/resources/assets/citresewn/lang/zh_tw.json new file mode 100644 index 0000000..a85fbe4 --- /dev/null +++ b/src/main/resources/assets/citresewn/lang/zh_tw.json @@ -0,0 +1,26 @@ +{
+ "config.citresewn.title": "CIT Resewn 設定檔",
+ "config.citresewn.configure": "設定",
+
+ "config.citresewn.enabled.title": "啟用",
+ "config.citresewn.enabled.tooltip": "CIT Resewn 是否載入並注入來自資源包的自訂物品紋理",
+
+ "config.citresewn.mute_errors.title": "記錄「載入錯誤」訊息",
+ "config.citresewn.mute_errors.tooltip": "CIT Resewn 是否記錄「自訂物品紋理」的載入錯誤訊息",
+
+ "config.citresewn.mute_warns.title": "記錄「載入警告」訊息",
+ "config.citresewn.mute_warns.tooltip": "CIT Resewn 是否記錄「自訂物品紋理」的載入警告訊息",
+
+ "config.citresewn.broken_paths.title": "允許路徑損壞的資源包",
+ "config.citresewn.broken_paths.tooltip": "允許載入有違反規則路徑的資源包。\n可能會造成問題!",
+
+ "config.citresewn.cache_ms.title": "快取",
+ "config.citresewn.cache_ms.tooltip": "間隔多久刷新自訂物品紋理的快取,\n數值越高需要使用更多效能。\n即時載入將會移除整個快取,\n並在每幀下檢查自訂物品紋理。",
+ "config.citresewn.cache_ms.ticks.0": "即時",
+ "config.citresewn.cache_ms.ticks.1": "每 Tick",
+ "config.citresewn.cache_ms.ticks.any": "每 %s Ticks",
+
+
+ "pack.incompatible.broken_paths": "(包含損壞路徑)",
+ "pack.incompatible.confirm.broken_paths": "這個資源包包含了損壞路徑,未來可能移除對於它的支援。請聯繫資源包作者來移除這個警告。(~CIT Resewn)"
+}
\ No newline at end of file diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index 0822b80..66bd512 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -23,7 +23,7 @@ "depends": { "fabric": "*", "fabricloader": "*", - "minecraft": "1.19.x" + "minecraft": "~1.19.3" }, "recommends": { "modmenu": "*", |