diff options
Diffstat (limited to 'src/main/java/shcm/shsupercm/fabric/citresewn')
-rw-r--r-- | src/main/java/shcm/shsupercm/fabric/citresewn/mixin/AtlasPreparationMixin.java | 14 |
1 files changed, 4 insertions, 10 deletions
diff --git a/src/main/java/shcm/shsupercm/fabric/citresewn/mixin/AtlasPreparationMixin.java b/src/main/java/shcm/shsupercm/fabric/citresewn/mixin/AtlasPreparationMixin.java index 1cc8b54..7a6cfa1 100644 --- a/src/main/java/shcm/shsupercm/fabric/citresewn/mixin/AtlasPreparationMixin.java +++ b/src/main/java/shcm/shsupercm/fabric/citresewn/mixin/AtlasPreparationMixin.java @@ -1,28 +1,22 @@ package shcm.shsupercm.fabric.citresewn.mixin; import net.minecraft.client.render.model.SpriteAtlasManager; -import net.minecraft.client.texture.Sprite; import net.minecraft.util.Identifier; -import org.jetbrains.annotations.Nullable; 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 org.spongepowered.asm.mixin.injection.ModifyVariable; @Mixin(SpriteAtlasManager.AtlasPreparation.class) public abstract class AtlasPreparationMixin { - @Shadow public @Nullable abstract Sprite getSprite(Identifier id); - @Inject(method = "getSprite", cancellable = true, at = @At("HEAD")) - private void citresewn$unwrapTexturePaths(Identifier id, CallbackInfoReturnable<Sprite> cir) { + @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)); - - cir.setReturnValue(getSprite(id)); } + return id; } } |