diff --git a/build.gradle b/build.gradle index 482dadc..0d4f50e 100644 --- a/build.gradle +++ b/build.gradle @@ -1,13 +1,17 @@ plugins { - id 'fabric-loom' version "${loom_version}" + id 'net.fabricmc.fabric-loom' version "${loom_version}" } -sourceCompatibility = JavaVersion.VERSION_21 -targetCompatibility = JavaVersion.VERSION_21 +java{ + sourceCompatibility = JavaVersion.VERSION_25 + targetCompatibility = JavaVersion.VERSION_25 +} -archivesBaseName = project.archives_base_name -version = project.mod_version -group = project.maven_group +base { + version = project.mod_version + group = project.maven_group + archivesName = project.archives_base_name +} repositories { } @@ -15,9 +19,8 @@ repositories { dependencies { // To change the versions see the gradle.properties file minecraft "com.mojang:minecraft:${project.minecraft_version}" - mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2" - modImplementation "net.fabricmc:fabric-loader:${project.loader_version}" - modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}" + implementation "net.fabricmc:fabric-loader:${project.loader_version}" + implementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}" } processResources { @@ -30,7 +33,7 @@ processResources { tasks.withType(JavaCompile).configureEach { it.options.encoding = "UTF-8" - it.options.release = 21 + it.options.release = 25 } java { @@ -39,6 +42,6 @@ java { jar { from("LICENSE") { - rename { "${it}_${project.archivesBaseName}"} + rename { "${it}_${project.base.archivesName}"} } } diff --git a/gradle.properties b/gradle.properties index 0ad5f5a..f046483 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,14 +1,14 @@ org.gradle.jvmargs=-Xmx1G +org.gradle.java.home = C:/jdk-25.0.2 -minecraft_version=1.21.5 -yarn_mappings=1.21.5+build.1 -loader_version=0.16.14 -loom_version=1.10-SNAPSHOT +minecraft_version=26.1.2 +loader_version=0.19.1 +loom_version=1.16-SNAPSHOT # Fabric API -fabric_version=0.127.1+1.21.5 +fabric_version=0.145.4+26.1.2 -mod_version = 0.6.1+1.21.5 +mod_version = 0.6.1+26.1 maven_group = io.github.foundationgames archives_base_name = animatica diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index d6e308a..221c4f9 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.12-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-9.4.1-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/src/main/java/io/github/foundationgames/animatica/Animatica.java b/src/main/java/io/github/foundationgames/animatica/Animatica.java index 039a899..1a595d5 100644 --- a/src/main/java/io/github/foundationgames/animatica/Animatica.java +++ b/src/main/java/io/github/foundationgames/animatica/Animatica.java @@ -4,8 +4,8 @@ import io.github.foundationgames.animatica.config.AnimaticaConfig; import net.fabricmc.api.ClientModInitializer; import net.fabricmc.fabric.api.resource.ResourceManagerHelper; -import net.minecraft.resource.ResourceType; -import net.minecraft.util.Identifier; +import net.minecraft.resources.Identifier; +import net.minecraft.server.packs.PackType; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -17,10 +17,10 @@ public class Animatica implements ClientModInitializer { @Override public void onInitializeClient() { - ResourceManagerHelper.get(ResourceType.CLIENT_RESOURCES).registerReloadListener(AnimationLoader.INSTANCE); + ResourceManagerHelper.get(PackType.CLIENT_RESOURCES).registerReloadListener(AnimationLoader.INSTANCE); } public static Identifier id(String path) { - return Identifier.of(NAMESPACE, path); + return Identifier.fromNamespaceAndPath(NAMESPACE, path); } } diff --git a/src/main/java/io/github/foundationgames/animatica/animation/AnimatedTexture.java b/src/main/java/io/github/foundationgames/animatica/animation/AnimatedTexture.java index 7d5436a..d5eb9ae 100644 --- a/src/main/java/io/github/foundationgames/animatica/animation/AnimatedTexture.java +++ b/src/main/java/io/github/foundationgames/animatica/animation/AnimatedTexture.java @@ -1,15 +1,9 @@ package io.github.foundationgames.animatica.animation; import com.google.common.collect.ImmutableList; +import com.mojang.blaze3d.platform.NativeImage; import io.github.foundationgames.animatica.Animatica; import io.github.foundationgames.animatica.util.TextureUtil; -import net.minecraft.client.MinecraftClient; -import net.minecraft.client.texture.NativeImage; -import net.minecraft.client.texture.NativeImageBackedTexture; -import net.minecraft.client.texture.TextureTickListener; -import net.minecraft.resource.ResourceManager; -import net.minecraft.util.Identifier; -import net.minecraft.util.math.MathHelper; import org.jetbrains.annotations.Nullable; import java.io.IOException; @@ -21,8 +15,14 @@ import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.function.Supplier; - -public class AnimatedTexture extends NativeImageBackedTexture implements TextureTickListener { +import net.minecraft.client.Minecraft; +import net.minecraft.client.renderer.texture.DynamicTexture; +import net.minecraft.client.renderer.texture.TickableTexture; +import net.minecraft.resources.Identifier; +import net.minecraft.server.packs.resources.ResourceManager; +import net.minecraft.util.Mth; + +public class AnimatedTexture extends DynamicTexture implements TickableTexture { public static final ExecutorService EXECUTORS = Executors.newFixedThreadPool(4); public final Animation[] anims; @@ -32,7 +32,7 @@ public class AnimatedTexture extends NativeImageBackedTexture implements Texture private CompletableFuture frameWaitingOn = null; public static Optional tryCreate(ResourceManager resources, Identifier targetTexId, List anims) { - try (var targetTexResource = resources.getResourceOrThrow(targetTexId).getInputStream()) { + try (var targetTexResource = resources.getResourceOrThrow(targetTexId).open()) { return Optional.of(new AnimatedTexture(targetTexId::toString, resources, anims, NativeImage.read(targetTexResource))); } catch (IOException e) { Animatica.LOG.error(e); } @@ -48,7 +48,7 @@ public AnimatedTexture(Supplier name, ResourceManager resources, List MinecraftClient.getInstance().execute(this::upload)); + }, exec).thenAccept(v -> Minecraft.getInstance().execute(this::upload)); } } @@ -115,7 +115,7 @@ public void updateAndDraw(NativeImage image, boolean force, Executor exec) { @Override public void tick() { - this.updateAndDraw(this.getImage(), false, EXECUTORS); + this.updateAndDraw(this.getPixels(), false, EXECUTORS); } @Override @@ -150,7 +150,7 @@ public Animation(AnimationMeta meta, ResourceManager resources) throws IOExcepti this.width = meta.width(); this.height = meta.height(); - try (var source = resources.getResourceOrThrow(meta.source()).getInputStream()) { + try (var source = resources.getResourceOrThrow(meta.source()).open()) { this.sourceTexture = NativeImage.read(source); } @@ -256,7 +256,7 @@ public void close() { } private int getVForFrame(int frame, int textureFrameCount) { - return MathHelper.clamp(frame * this.height, 0, (textureFrameCount - 1) * this.height); + return Mth.clamp(frame * this.height, 0, (textureFrameCount - 1) * this.height); } } diff --git a/src/main/java/io/github/foundationgames/animatica/animation/AnimationLoader.java b/src/main/java/io/github/foundationgames/animatica/animation/AnimationLoader.java index 46bf2fe..1be50e4 100644 --- a/src/main/java/io/github/foundationgames/animatica/animation/AnimationLoader.java +++ b/src/main/java/io/github/foundationgames/animatica/animation/AnimationLoader.java @@ -4,10 +4,10 @@ import io.github.foundationgames.animatica.util.Flags; import io.github.foundationgames.animatica.util.exception.PropertyParseException; import net.fabricmc.fabric.api.resource.SimpleSynchronousResourceReloadListener; -import net.minecraft.client.MinecraftClient; -import net.minecraft.resource.Resource; -import net.minecraft.resource.ResourceManager; -import net.minecraft.util.Identifier; +import net.minecraft.client.Minecraft; +import net.minecraft.resources.Identifier; +import net.minecraft.server.packs.resources.Resource; +import net.minecraft.server.packs.resources.ResourceManager; import org.jetbrains.annotations.Nullable; import java.io.IOException; @@ -35,7 +35,7 @@ private AnimationLoader() { private static void findAllMCPAnimations(ResourceManager manager, BiConsumer action) { for (var path : ANIM_PATHS) { - manager.findResources(path, p -> p.getPath().endsWith(".properties")).forEach(action); + manager.listResources(path, p -> p.getPath().endsWith(".properties")).forEach(action); } } @@ -49,7 +49,7 @@ public Identifier getFabricId() { } @Override - public void reload(ResourceManager manager) { + public void onResourceManagerReload(ResourceManager manager) { this.animationIds.clear(); if (!Animatica.CONFIG.animatedTextures) { @@ -62,7 +62,7 @@ public void reload(ResourceManager manager) { findAllMCPAnimations(manager, (id, resource) -> { try { - try (var resourceInputStream = resource.getInputStream()) { + try (var resourceInputStream = resource.open()) { var ppt = new Properties(); ppt.load(resourceInputStream); @@ -80,9 +80,9 @@ public void reload(ResourceManager manager) { for (var targetId : animations.keySet()) { AnimatedTexture.tryCreate(manager, targetId, animations.get(targetId)) .ifPresent(tex -> { - var animId = Identifier.of(targetId.getNamespace(), targetId.getPath() + "-anim"); + var animId = Identifier.fromNamespaceAndPath(targetId.getNamespace(), targetId.getPath() + "-anim"); this.animationIds.put(targetId, animId); - MinecraftClient.getInstance().getTextureManager().registerTexture(animId, tex); + Minecraft.getInstance().getTextureManager().register(animId, tex); }); } diff --git a/src/main/java/io/github/foundationgames/animatica/animation/AnimationMeta.java b/src/main/java/io/github/foundationgames/animatica/animation/AnimationMeta.java index ac7f341..6982b36 100644 --- a/src/main/java/io/github/foundationgames/animatica/animation/AnimationMeta.java +++ b/src/main/java/io/github/foundationgames/animatica/animation/AnimationMeta.java @@ -4,13 +4,12 @@ import io.github.foundationgames.animatica.util.Utilities; import io.github.foundationgames.animatica.util.exception.InvalidPropertyException; import io.github.foundationgames.animatica.util.exception.PropertyParseException; -import net.minecraft.util.Identifier; -import net.minecraft.util.InvalidIdentifierException; - import java.util.HashSet; import java.util.Map; import java.util.Properties; import java.util.Set; +import net.minecraft.IdentifierException; +import net.minecraft.resources.Identifier; public record AnimationMeta( Identifier source, Identifier target, int targetX, @@ -22,11 +21,11 @@ public static AnimationMeta of(Identifier file, Properties properties) throws Pr Identifier source; Identifier target; try { - source = Utilities.processPath(file, Identifier.of(PropertyUtil.get(file, properties, "from"))); - } catch (InvalidIdentifierException ex) { throw new InvalidPropertyException(file, "from", "resource location"); } + source = Utilities.processPath(file, Identifier.parse(PropertyUtil.get(file, properties, "from"))); + } catch (IdentifierException ex) { throw new InvalidPropertyException(file, "from", "resource location"); } try { - target = Utilities.processPath(file, Identifier.of(PropertyUtil.get(file, properties, "to"))); - } catch (InvalidIdentifierException ex) { throw new InvalidPropertyException(file, "to", "resource location"); } + target = Utilities.processPath(file, Identifier.parse(PropertyUtil.get(file, properties, "to"))); + } catch (IdentifierException ex) { throw new InvalidPropertyException(file, "to", "resource location"); } return new AnimationMeta( source, target, diff --git a/src/main/java/io/github/foundationgames/animatica/config/AnimaticaConfig.java b/src/main/java/io/github/foundationgames/animatica/config/AnimaticaConfig.java index 50df044..7793347 100644 --- a/src/main/java/io/github/foundationgames/animatica/config/AnimaticaConfig.java +++ b/src/main/java/io/github/foundationgames/animatica/config/AnimaticaConfig.java @@ -2,9 +2,8 @@ import io.github.foundationgames.animatica.Animatica; import net.fabricmc.loader.api.FabricLoader; -import net.minecraft.client.MinecraftClient; -import net.minecraft.client.option.SimpleOption; - +import net.minecraft.client.Minecraft; +import net.minecraft.client.OptionInstance; import java.io.IOException; import java.nio.file.Files; import java.nio.file.Path; @@ -15,7 +14,7 @@ public class AnimaticaConfig { public static final String FILE_NAME = "animatica.properties"; - private final SimpleOption animatedTexturesOption; + private final OptionInstance animatedTexturesOption; public boolean animatedTextures; public AnimaticaConfig() { @@ -25,7 +24,7 @@ public AnimaticaConfig() { Animatica.LOG.error("Error loading config during initialization!", e); } - this.animatedTexturesOption = SimpleOption.ofBoolean( + this.animatedTexturesOption = OptionInstance.createBoolean( "option.animatica.animated_textures", this.animatedTextures, value -> { @@ -33,7 +32,7 @@ public AnimaticaConfig() { try { this.save(); } catch (IOException e) { Animatica.LOG.error("Error saving config while changing in game!", e); } - MinecraftClient.getInstance().reloadResources(); + Minecraft.getInstance().reloadResourcePacks(); } ); } @@ -55,7 +54,7 @@ public Path getFile() throws IOException { return file; } - public SimpleOption getAnimatedTexturesOption() { + public OptionInstance getAnimatedTexturesOption() { return animatedTexturesOption; } diff --git a/src/main/java/io/github/foundationgames/animatica/mixin/IdentifierMixin.java b/src/main/java/io/github/foundationgames/animatica/mixin/IdentifierMixin.java index 40dfa9e..59d365b 100644 --- a/src/main/java/io/github/foundationgames/animatica/mixin/IdentifierMixin.java +++ b/src/main/java/io/github/foundationgames/animatica/mixin/IdentifierMixin.java @@ -2,7 +2,7 @@ import io.github.foundationgames.animatica.Animatica; import io.github.foundationgames.animatica.util.Flags; -import net.minecraft.util.Identifier; +import net.minecraft.resources.Identifier; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; @@ -11,14 +11,14 @@ // Allows invalid characters in paths to support packs with extremely outdated formatting (because OptiFine does too) @Mixin(Identifier.class) public class IdentifierMixin { - @Inject(method = "of(Ljava/lang/String;)Lnet/minecraft/util/Identifier;", at = @At("TAIL")) + @Inject(method = "parse(Ljava/lang/String;)Lnet/minecraft/resources/Identifier;", at = @At("TAIL")) private static void animatica$reportInvalidIdentifierCharacters(String id, CallbackInfoReturnable ci) { - if (Flags.ALLOW_INVALID_ID_CHARS && !animatica$isPathAllowed(Identifier.splitOn(id, ':').getPath()) && !Identifier.splitOn(id, ':').getPath().startsWith("~/")) { + if (Flags.ALLOW_INVALID_ID_CHARS && !animatica$isPathAllowed(Identifier.bySeparator(id, ':').getPath()) && !Identifier.bySeparator(id, ':').getPath().startsWith("~/")) { Animatica.LOG.warn("Legacy resource pack is using an invalid namespaced identifier '{}'! DO NOT use non [a-z0-9_.-] characters for resource pack files and file names!", id); } } - @Inject(method = "isPathCharacterValid", at = @At("RETURN"), cancellable = true) + @Inject(method = "validPathChar", at = @At("RETURN"), cancellable = true) private static void animatica$allowInvalidCharacters(char character, CallbackInfoReturnable cir) { if (Flags.ALLOW_INVALID_ID_CHARS) { cir.setReturnValue(true); diff --git a/src/main/java/io/github/foundationgames/animatica/mixin/NativeImageAccessor.java b/src/main/java/io/github/foundationgames/animatica/mixin/NativeImageAccessor.java index 25037e9..916fc21 100644 --- a/src/main/java/io/github/foundationgames/animatica/mixin/NativeImageAccessor.java +++ b/src/main/java/io/github/foundationgames/animatica/mixin/NativeImageAccessor.java @@ -1,11 +1,11 @@ package io.github.foundationgames.animatica.mixin; -import net.minecraft.client.texture.NativeImage; +import com.mojang.blaze3d.platform.NativeImage; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.gen.Accessor; @Mixin(NativeImage.class) public interface NativeImageAccessor { - @Accessor("pointer") + @Accessor("pixels") long getPointer(); } diff --git a/src/main/java/io/github/foundationgames/animatica/mixin/TextureManagerMixin.java b/src/main/java/io/github/foundationgames/animatica/mixin/TextureManagerMixin.java index 811eccc..2de71d4 100644 --- a/src/main/java/io/github/foundationgames/animatica/mixin/TextureManagerMixin.java +++ b/src/main/java/io/github/foundationgames/animatica/mixin/TextureManagerMixin.java @@ -2,8 +2,8 @@ import io.github.foundationgames.animatica.Animatica; import io.github.foundationgames.animatica.animation.AnimationLoader; -import net.minecraft.client.texture.TextureManager; -import net.minecraft.util.Identifier; +import net.minecraft.client.renderer.texture.TextureManager; +import net.minecraft.resources.Identifier; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.ModifyVariable; diff --git a/src/main/java/io/github/foundationgames/animatica/mixin/VideoOptionsScreenMixin.java b/src/main/java/io/github/foundationgames/animatica/mixin/VideoOptionsScreenMixin.java index f8f38f1..4e6c249 100644 --- a/src/main/java/io/github/foundationgames/animatica/mixin/VideoOptionsScreenMixin.java +++ b/src/main/java/io/github/foundationgames/animatica/mixin/VideoOptionsScreenMixin.java @@ -1,17 +1,17 @@ package io.github.foundationgames.animatica.mixin; import io.github.foundationgames.animatica.Animatica; -import net.minecraft.client.gui.screen.Screen; -import net.minecraft.client.gui.screen.option.VideoOptionsScreen; -import net.minecraft.client.option.SimpleOption; -import net.minecraft.text.Text; +import net.minecraft.client.OptionInstance; +import net.minecraft.client.gui.screens.Screen; +import net.minecraft.client.gui.screens.options.VideoSettingsScreen; +import net.minecraft.network.chat.Component; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.ModifyArg; -@Mixin(VideoOptionsScreen.class) +@Mixin(VideoSettingsScreen.class) public abstract class VideoOptionsScreenMixin extends Screen { - protected VideoOptionsScreenMixin(Text title) { + protected VideoOptionsScreenMixin(Component title) { super(title); } @@ -19,12 +19,12 @@ protected VideoOptionsScreenMixin(Text title) { method = "addOptions", at = @At( value = "INVOKE", - target = "Lnet/minecraft/client/gui/widget/OptionListWidget;addAll([Lnet/minecraft/client/option/SimpleOption;)V" + target = "Lnet/minecraft/client/gui/components/OptionsList;addSmall([Lnet/minecraft/client/OptionInstance;)V" ), index = 0 ) - private SimpleOption[] animatica$addTextureAnimationOptionButton(SimpleOption[] old) { - var options = new SimpleOption[old.length + 1]; + private OptionInstance[] animatica$addTextureAnimationOptionButton(OptionInstance[] old) { + var options = new OptionInstance[old.length + 1]; System.arraycopy(old, 0, options, 0, old.length); options[options.length - 1] = Animatica.CONFIG.getAnimatedTexturesOption(); return options; diff --git a/src/main/java/io/github/foundationgames/animatica/util/PropertyUtil.java b/src/main/java/io/github/foundationgames/animatica/util/PropertyUtil.java index e5ce8a5..5092a5d 100644 --- a/src/main/java/io/github/foundationgames/animatica/util/PropertyUtil.java +++ b/src/main/java/io/github/foundationgames/animatica/util/PropertyUtil.java @@ -4,10 +4,9 @@ import io.github.foundationgames.animatica.util.exception.InvalidPropertyException; import io.github.foundationgames.animatica.util.exception.MissingPropertyException; import io.github.foundationgames.animatica.util.exception.PropertyParseException; -import net.minecraft.util.Identifier; - import java.util.Map; import java.util.Properties; +import net.minecraft.resources.Identifier; public enum PropertyUtil {; public static String get(Identifier file, Properties properties, String key) throws PropertyParseException { diff --git a/src/main/java/io/github/foundationgames/animatica/util/TextureUtil.java b/src/main/java/io/github/foundationgames/animatica/util/TextureUtil.java index caeed89..b4772e0 100644 --- a/src/main/java/io/github/foundationgames/animatica/util/TextureUtil.java +++ b/src/main/java/io/github/foundationgames/animatica/util/TextureUtil.java @@ -1,8 +1,8 @@ package io.github.foundationgames.animatica.util; +import com.mojang.blaze3d.platform.NativeImage; import io.github.foundationgames.animatica.mixin.NativeImageAccessor; -import net.minecraft.client.texture.NativeImage; -import net.minecraft.util.math.MathHelper; +import net.minecraft.util.Mth; import org.lwjgl.system.MemoryUtil; public enum TextureUtil {; @@ -21,8 +21,8 @@ public enum TextureUtil {; * @param dv The v coordinate on the destination image to place the selection at */ public static void copy(NativeImage src, int u, int v, int w, int h, NativeImage dest, int du, int dv) { - w = MathHelper.clamp(dest.getWidth() - du, 0, w); - h = MathHelper.clamp(dest.getHeight() - dv, 0, h); + w = Mth.clamp(dest.getWidth() - du, 0, w); + h = Mth.clamp(dest.getHeight() - dv, 0, h); long srcPtr = ((NativeImageAccessor)(Object)src).getPointer(); long dstPtr = ((NativeImageAccessor)(Object)dest).getPointer(); @@ -55,8 +55,8 @@ public static void copy(NativeImage src, int u, int v, int w, int h, NativeImage * second (0 = solid first image, 1 = solid second image) */ public static void blendCopy(NativeImage src, int u0, int v0, int u1, int v1, int w, int h, NativeImage dest, int du, int dv, float blend) { - w = MathHelper.clamp(dest.getWidth() - du, 0, w); - h = MathHelper.clamp(dest.getHeight() - dv, 0, h); + w = Mth.clamp(dest.getWidth() - du, 0, w); + h = Mth.clamp(dest.getHeight() - dv, 0, h); long srcPtr = ((NativeImageAccessor)(Object)src).getPointer(); long dstPtr = ((NativeImageAccessor)(Object)dest).getPointer(); @@ -72,21 +72,21 @@ public static void blendCopy(NativeImage src, int u0, int v0, int u1, int v1, in var trgRow = MemoryUtil.memIntBuffer(dstPtr + (trgRowIdx * SIZEOF_INT), w); for (int col = 0; col < w; col++) { - trgRow.put(col, lerpColor(src.getFormat(), src0Row.get(col), src1Row.get(col), blend)); + trgRow.put(col, lerpColor(src.format(), src0Row.get(col), src1Row.get(col), blend)); } } } public static int lerpColor(NativeImage.Format format, int c1, int c2, float delta) { - int a1 = (c1 >> format.getAlphaOffset()) & 0xFF; - int r1 = (c1 >> format.getRedOffset()) & 0xFF; - int g1 = (c1 >> format.getGreenOffset()) & 0xFF; - int b1 = (c1 >> format.getBlueOffset()) & 0xFF; + int a1 = (c1 >> format.alphaOffset()) & 0xFF; + int r1 = (c1 >> format.redOffset()) & 0xFF; + int g1 = (c1 >> format.greenOffset()) & 0xFF; + int b1 = (c1 >> format.blueOffset()) & 0xFF; - int a2 = (c2 >> format.getAlphaOffset()) & 0xFF; - int r2 = (c2 >> format.getRedOffset()) & 0xFF; - int g2 = (c2 >> format.getGreenOffset()) & 0xFF; - int b2 = (c2 >> format.getBlueOffset()) & 0xFF; + int a2 = (c2 >> format.alphaOffset()) & 0xFF; + int r2 = (c2 >> format.redOffset()) & 0xFF; + int g2 = (c2 >> format.greenOffset()) & 0xFF; + int b2 = (c2 >> format.blueOffset()) & 0xFF; // If the first or second color is transparent, // don't lerp any leftover rgb values and instead @@ -101,11 +101,11 @@ public static int lerpColor(NativeImage.Format format, int c1, int c2, float del b2 = b1; } - int oa = MathHelper.lerp(delta, a1, a2); - int or = MathHelper.lerp(delta, r1, r2); - int og = MathHelper.lerp(delta, g1, g2); - int ob = MathHelper.lerp(delta, b1, b2); + int oa = Mth.lerpInt(delta, a1, a2); + int or = Mth.lerpInt(delta, r1, r2); + int og = Mth.lerpInt(delta, g1, g2); + int ob = Mth.lerpInt(delta, b1, b2); - return (oa << format.getAlphaOffset()) | (or << format.getRedOffset()) | (og << format.getGreenOffset()) | (ob << format.getBlueOffset()); + return (oa << format.alphaOffset()) | (or << format.redOffset()) | (og << format.greenOffset()) | (ob << format.blueOffset()); } } diff --git a/src/main/java/io/github/foundationgames/animatica/util/Utilities.java b/src/main/java/io/github/foundationgames/animatica/util/Utilities.java index a60d22a..0a828ca 100644 --- a/src/main/java/io/github/foundationgames/animatica/util/Utilities.java +++ b/src/main/java/io/github/foundationgames/animatica/util/Utilities.java @@ -1,6 +1,6 @@ package io.github.foundationgames.animatica.util; -import net.minecraft.util.Identifier; +import net.minecraft.resources.Identifier; public enum Utilities {; public static Identifier processPath(Identifier fileRelativeTo, Identifier path) { @@ -9,10 +9,10 @@ public static Identifier processPath(Identifier fileRelativeTo, Identifier path) if (lInd > 0) { var builder = new StringBuilder(fileRelativeTo.getPath()); builder.replace(lInd, builder.length(), path.getPath().replaceFirst("\\./", "/")); - return Identifier.of(fileRelativeTo.getNamespace(), builder.toString()); + return Identifier.fromNamespaceAndPath(fileRelativeTo.getNamespace(), builder.toString()); } } else if (path.getPath().startsWith("~/")) { - return Identifier.of(path.getNamespace(), path.getPath().replaceFirst("~/", "optifine/")); + return Identifier.fromNamespaceAndPath(path.getNamespace(), path.getPath().replaceFirst("~/", "optifine/")); } return path; } diff --git a/src/main/java/io/github/foundationgames/animatica/util/exception/InvalidPropertyException.java b/src/main/java/io/github/foundationgames/animatica/util/exception/InvalidPropertyException.java index a6ae2ff..d37d3d2 100644 --- a/src/main/java/io/github/foundationgames/animatica/util/exception/InvalidPropertyException.java +++ b/src/main/java/io/github/foundationgames/animatica/util/exception/InvalidPropertyException.java @@ -1,6 +1,6 @@ package io.github.foundationgames.animatica.util.exception; -import net.minecraft.util.Identifier; +import net.minecraft.resources.Identifier; public class InvalidPropertyException extends PropertyParseException { public InvalidPropertyException(Identifier file, String key, String expectedType) { diff --git a/src/main/java/io/github/foundationgames/animatica/util/exception/MissingPropertyException.java b/src/main/java/io/github/foundationgames/animatica/util/exception/MissingPropertyException.java index 2e39bfe..e32030f 100644 --- a/src/main/java/io/github/foundationgames/animatica/util/exception/MissingPropertyException.java +++ b/src/main/java/io/github/foundationgames/animatica/util/exception/MissingPropertyException.java @@ -1,6 +1,6 @@ package io.github.foundationgames.animatica.util.exception; -import net.minecraft.util.Identifier; +import net.minecraft.resources.Identifier; public class MissingPropertyException extends PropertyParseException { public MissingPropertyException(Identifier file, String key) { diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index aa28176..c8a7432 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -27,8 +27,7 @@ ], "depends": { "fabricloader": ">=0.11.3", - "fabric": "*", - "minecraft": ">=1.21.5", - "java": ">=21" + "minecraft": ">=26.1", + "java": ">=25" } }