From 797b4a8b1c1cf3bb84bf89d6892ee432929b9640 Mon Sep 17 00:00:00 2001 From: SHsuperCM Date: Mon, 2 Jan 2023 17:06:55 +0200 Subject: Removed locals capture usage --- .../shsupercm/fabric/citresewn/mixin/AtlasLoaderMixin.java | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'src/main/java/shcm/shsupercm/fabric/citresewn/mixin/AtlasLoaderMixin.java') 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 cir, Identifier identifier, List list) { + @Shadow @Final private List sources; + + @Inject(method = "of", at = @At("RETURN"), cancellable = true) + private static void citresewn$atlasSource(ResourceManager resourceManager, Identifier id, CallbackInfoReturnable 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) { -- cgit