aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSHsuperCM <shsupercm@gmail.com>2023-01-02 17:06:55 +0200
committerSHsuperCM <shsupercm@gmail.com>2023-01-02 17:06:55 +0200
commit797b4a8b1c1cf3bb84bf89d6892ee432929b9640 (patch)
tree693b2e08b805b23c23ad56d6e3b976865b3e5e20
parent7db6786ff1a300ef90265486add9b7f921959414 (diff)
downloadCITResewn-797b4a8b1c1cf3bb84bf89d6892ee432929b9640.tar.gz
CITResewn-797b4a8b1c1cf3bb84bf89d6892ee432929b9640.tar.bz2
CITResewn-797b4a8b1c1cf3bb84bf89d6892ee432929b9640.zip
Removed locals capture usage
-rw-r--r--src/main/java/shcm/shsupercm/fabric/citresewn/mixin/AtlasLoaderMixin.java12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/main/java/shcm/shsupercm/fabric/citresewn/mixin/AtlasLoaderMixin.java b/src/main/java/shcm/shsupercm/fabric/citresewn/mixin/AtlasLoaderMixin.java
index 786251b..ee5c125 100644
--- a/src/main/java/shcm/shsupercm/fabric/citresewn/mixin/AtlasLoaderMixin.java
+++ b/src/main/java/shcm/shsupercm/fabric/citresewn/mixin/AtlasLoaderMixin.java
@@ -7,12 +7,12 @@ 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 org.spongepowered.asm.mixin.injection.callback.LocalCapture;
-import shcm.shsupercm.fabric.citresewn.CITResewn;
import shcm.shsupercm.fabric.citresewn.pack.PackParser;
import java.util.List;
@@ -20,10 +20,12 @@ import java.util.Map;
@Mixin(AtlasLoader.class)
public class AtlasLoaderMixin {
- @Inject(method = "of", at = @At("RETURN"), locals = LocalCapture.CAPTURE_FAILSOFT)
- private static void citresewn$atlasSource(ResourceManager resourceManager, Identifier id, CallbackInfoReturnable<AtlasLoader> cir, Identifier identifier, List<AtlasSource> list) {
+ @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")) {
- list.add(new AtlasSource() {
+ ((AtlasLoaderMixin) (Object) cir.getReturnValue()).sources.add(new AtlasSource() {
@Override
public void load(ResourceManager resourceManager, SpriteRegions regions) {
for (String root : PackParser.ROOTS) {