aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/shcm
diff options
context:
space:
mode:
authorSHsuperCM <shsupercm@gmail.com>2023-01-02 13:14:11 +0200
committerSHsuperCM <shsupercm@gmail.com>2023-01-02 13:14:11 +0200
commit176af22c7615a8db08bb57cf295188000599423d (patch)
treeda271588398666b70d8c550d005c770285dcd4e3 /src/main/java/shcm
parentb15717a8cf4c80963750fba4fcac173cecdf8ab3 (diff)
downloadCITResewn-176af22c7615a8db08bb57cf295188000599423d.tar.gz
CITResewn-176af22c7615a8db08bb57cf295188000599423d.tar.bz2
CITResewn-176af22c7615a8db08bb57cf295188000599423d.zip
Unwrapping cleanup
Diffstat (limited to 'src/main/java/shcm')
-rw-r--r--src/main/java/shcm/shsupercm/fabric/citresewn/mixin/AtlasPreparationMixin.java14
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;
}
}