From 51f491e47932dda70f370ee63fa9307c4f6afcf7 Mon Sep 17 00:00:00 2001 From: ev chang Date: Tue, 12 Nov 2024 11:35:23 -0500 Subject: [PATCH] Fix mixin compile errors / warnings --- .../mixins/accessors/EventBusAccessor.java | 2 +- .../accessors/optifine/ConfigAccessor.java | 2 +- .../optifine/CustomColorsAccessor.java | 2 +- .../BlockChestMixin_VanillaSlabChests.java | 2 +- .../forge/BlockMixin_VanillaSlabChests.java | 4 ++-- ...oveHeadRender_ReFixNametagPerspective.java | 4 ++-- .../RenderGlobalMixin_FixSkyVBOs.java | 4 ++-- ...GuiModListMixin_RemoveDummyPatcherMod.java | 2 +- .../features/ImageBufferDownload_EarsMod.java | 2 +- .../WorldMixin_CameraPerspective.java | 23 ++++++++++++++++--- .../EntityRendererMixin_LeftHandedness.java | 6 +++-- .../ItemRendererMixin_LeftHandedness.java | 2 ++ .../RenderFishMixin_LeftHandedness.java | 2 ++ ...Manager_OnlyRefreshNecessaryListeners.java | 2 +- ...tityRendererDispatcherMixin_BatchDraw.java | 4 ++-- .../FMLClientHandlerMixin_GetErrors.java | 18 ++++++++++----- .../forge/ModelLoader_SkipFirstBaking.java | 2 +- .../optifine/MathHelperMixin_OFFastMath.java | 6 ++--- 18 files changed, 59 insertions(+), 30 deletions(-) diff --git a/src/main/java/club/sk1er/patcher/mixins/accessors/EventBusAccessor.java b/src/main/java/club/sk1er/patcher/mixins/accessors/EventBusAccessor.java index ee9df14a1..16c4f4d96 100644 --- a/src/main/java/club/sk1er/patcher/mixins/accessors/EventBusAccessor.java +++ b/src/main/java/club/sk1er/patcher/mixins/accessors/EventBusAccessor.java @@ -6,6 +6,6 @@ @Mixin(EventBus.class) public interface EventBusAccessor { - @Accessor + @Accessor(remap = false) int getBusID(); } diff --git a/src/main/java/club/sk1er/patcher/mixins/accessors/optifine/ConfigAccessor.java b/src/main/java/club/sk1er/patcher/mixins/accessors/optifine/ConfigAccessor.java index 52eba63e6..8eea3c08d 100644 --- a/src/main/java/club/sk1er/patcher/mixins/accessors/optifine/ConfigAccessor.java +++ b/src/main/java/club/sk1er/patcher/mixins/accessors/optifine/ConfigAccessor.java @@ -9,7 +9,7 @@ @Mixin(targets = "Config") public interface ConfigAccessor { @Dynamic("OptiFine") - @Invoker + @Invoker(remap = false) static boolean invokeIsCustomColors() { throw new AssertionError("Mixin did not inject"); } diff --git a/src/main/java/club/sk1er/patcher/mixins/accessors/optifine/CustomColorsAccessor.java b/src/main/java/club/sk1er/patcher/mixins/accessors/optifine/CustomColorsAccessor.java index 6336021c2..2a32da34c 100644 --- a/src/main/java/club/sk1er/patcher/mixins/accessors/optifine/CustomColorsAccessor.java +++ b/src/main/java/club/sk1er/patcher/mixins/accessors/optifine/CustomColorsAccessor.java @@ -9,7 +9,7 @@ @Mixin(targets = "net.optifine.CustomColors") public interface CustomColorsAccessor { @Dynamic("OptiFine") - @Invoker + @Invoker(remap = false) public static int invokeGetTextColor(int index, int color) { throw new AssertionError("Mixin failed to inject into OptiFine"); } diff --git a/src/main/java/club/sk1er/patcher/mixins/bugfixes/forge/BlockChestMixin_VanillaSlabChests.java b/src/main/java/club/sk1er/patcher/mixins/bugfixes/forge/BlockChestMixin_VanillaSlabChests.java index 8d367564a..c2a25f1d1 100644 --- a/src/main/java/club/sk1er/patcher/mixins/bugfixes/forge/BlockChestMixin_VanillaSlabChests.java +++ b/src/main/java/club/sk1er/patcher/mixins/bugfixes/forge/BlockChestMixin_VanillaSlabChests.java @@ -12,7 +12,7 @@ @Mixin(BlockChest.class) public class BlockChestMixin_VanillaSlabChests { //#if MC<11200 - @Redirect(method = "isBelowSolidBlock", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/World;isSideSolid(Lnet/minecraft/util/BlockPos;Lnet/minecraft/util/EnumFacing;Z)Z")) + @Redirect(method = "isBelowSolidBlock", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/World;isSideSolid(Lnet/minecraft/util/BlockPos;Lnet/minecraft/util/EnumFacing;Z)Z", remap = false), remap = true) public boolean patcher$isBelowSolidBlock(World instance, BlockPos blockPos, EnumFacing enumFacing, boolean b) { return ((BlockExt) instance.getBlockState(blockPos).getBlock()).patcher$doesSideBlockChestOpening(instance, blockPos, enumFacing); } diff --git a/src/main/java/club/sk1er/patcher/mixins/bugfixes/forge/BlockMixin_VanillaSlabChests.java b/src/main/java/club/sk1er/patcher/mixins/bugfixes/forge/BlockMixin_VanillaSlabChests.java index 4437fd49e..7563ae28d 100644 --- a/src/main/java/club/sk1er/patcher/mixins/bugfixes/forge/BlockMixin_VanillaSlabChests.java +++ b/src/main/java/club/sk1er/patcher/mixins/bugfixes/forge/BlockMixin_VanillaSlabChests.java @@ -11,13 +11,13 @@ @Mixin(Block.class) public abstract class BlockMixin_VanillaSlabChests implements BlockExt { //#if MC<11200 - @Shadow + @Shadow(remap = false) public abstract String getRegistryName(); @Shadow public abstract boolean isNormalCube(); - @Shadow + @Shadow(remap = false) public abstract boolean isSideSolid(IBlockAccess par1, BlockPos par2, EnumFacing par3); public boolean patcher$doesSideBlockChestOpening(IBlockAccess world, BlockPos pos, EnumFacing side) { diff --git a/src/main/java/club/sk1er/patcher/mixins/bugfixes/levelhead/AboveHeadRender_ReFixNametagPerspective.java b/src/main/java/club/sk1er/patcher/mixins/bugfixes/levelhead/AboveHeadRender_ReFixNametagPerspective.java index 6165d0acf..3b35ee52f 100644 --- a/src/main/java/club/sk1er/patcher/mixins/bugfixes/levelhead/AboveHeadRender_ReFixNametagPerspective.java +++ b/src/main/java/club/sk1er/patcher/mixins/bugfixes/levelhead/AboveHeadRender_ReFixNametagPerspective.java @@ -8,11 +8,11 @@ import org.spongepowered.asm.mixin.injection.ModifyArg; @Pseudo -@Mixin(targets = "club.sk1er.mods.levelhead.render.AboveHeadRender") +@Mixin(targets = "club.sk1er.mods.levelhead.render.AboveHeadRender", remap = false) public class AboveHeadRender_ReFixNametagPerspective { @Dynamic("Levelhead") - @ModifyArg(method = "renderName", at = @org.spongepowered.asm.mixin.injection.At(value = "INVOKE", target = "Lgg/essential/universal/UGraphics$GL;rotate(FFFF)V", ordinal = 1), index = 0) + @ModifyArg(method = "renderName", at = @org.spongepowered.asm.mixin.injection.At(value = "INVOKE", target = "Lgg/essential/universal/UGraphics$GL;rotate(FFFF)V", ordinal = 1), index = 0, remap = false) private float patcher$fixNametagPerspective(float f) { GameSettings gameSettings = Minecraft.getMinecraft().gameSettings; if (gameSettings != null && gameSettings.thirdPersonView == 2) { diff --git a/src/main/java/club/sk1er/patcher/mixins/bugfixes/optifine/RenderGlobalMixin_FixSkyVBOs.java b/src/main/java/club/sk1er/patcher/mixins/bugfixes/optifine/RenderGlobalMixin_FixSkyVBOs.java index cdbc56b2d..4178e71eb 100644 --- a/src/main/java/club/sk1er/patcher/mixins/bugfixes/optifine/RenderGlobalMixin_FixSkyVBOs.java +++ b/src/main/java/club/sk1er/patcher/mixins/bugfixes/optifine/RenderGlobalMixin_FixSkyVBOs.java @@ -14,11 +14,11 @@ public class RenderGlobalMixin_FixSkyVBOs { @Dynamic("OptiFine") - @Shadow + @Shadow(remap = false) private int renderDistance; @Dynamic("OptiFine") - @Shadow + @Shadow(remap = false) private boolean vboEnabled = false; @Dynamic("OptiFine") diff --git a/src/main/java/club/sk1er/patcher/mixins/features/GuiModListMixin_RemoveDummyPatcherMod.java b/src/main/java/club/sk1er/patcher/mixins/features/GuiModListMixin_RemoveDummyPatcherMod.java index 79cb4b179..30fbe25df 100644 --- a/src/main/java/club/sk1er/patcher/mixins/features/GuiModListMixin_RemoveDummyPatcherMod.java +++ b/src/main/java/club/sk1er/patcher/mixins/features/GuiModListMixin_RemoveDummyPatcherMod.java @@ -14,7 +14,7 @@ @Mixin(GuiModList.class) public class GuiModListMixin_RemoveDummyPatcherMod { - @Shadow + @Shadow(remap = false) private ArrayList mods; @Inject(method = "", at = @At("RETURN")) diff --git a/src/main/java/club/sk1er/patcher/mixins/features/ImageBufferDownload_EarsMod.java b/src/main/java/club/sk1er/patcher/mixins/features/ImageBufferDownload_EarsMod.java index b601316df..f5e299b4d 100644 --- a/src/main/java/club/sk1er/patcher/mixins/features/ImageBufferDownload_EarsMod.java +++ b/src/main/java/club/sk1er/patcher/mixins/features/ImageBufferDownload_EarsMod.java @@ -12,7 +12,7 @@ public class ImageBufferDownload_EarsMod { @Dynamic("Ears Mod") - @Redirect(method = "parseUserSkin", at = @At(value = "INVOKE", target = "Lcom/unascribed/ears/Ears;preprocessSkin(Lnet/minecraft/client/renderer/ImageBufferDownload;Ljava/awt/image/BufferedImage;Ljava/awt/image/BufferedImage;)V")) + @Redirect(method = "parseUserSkin", at = @At(value = "INVOKE", target = "Lcom/unascribed/ears/Ears;preprocessSkin(Lnet/minecraft/client/renderer/ImageBufferDownload;Ljava/awt/image/BufferedImage;Ljava/awt/image/BufferedImage;)V", remap = false), remap = true) private void preprocessSkin(ImageBufferDownload subject, BufferedImage rawImg, BufferedImage img) { // this will never work because the way they find the locals is really really fragile and doesn't work with this mixin } diff --git a/src/main/java/club/sk1er/patcher/mixins/features/WorldMixin_CameraPerspective.java b/src/main/java/club/sk1er/patcher/mixins/features/WorldMixin_CameraPerspective.java index e15cf5727..ce349895a 100644 --- a/src/main/java/club/sk1er/patcher/mixins/features/WorldMixin_CameraPerspective.java +++ b/src/main/java/club/sk1er/patcher/mixins/features/WorldMixin_CameraPerspective.java @@ -26,9 +26,26 @@ public abstract class WorldMixin_CameraPerspective { Blocks.iron_bars ); - @Redirect(method = "rayTraceBlocks(Lnet/minecraft/util/Vec3;Lnet/minecraft/util/Vec3;ZZZ)Lnet/minecraft/util/MovingObjectPosition;", at = @At(value = "INVOKE", target = "Lnet/minecraft/block/Block;getCollisionBoundingBox(Lnet/minecraft/world/World;Lnet/minecraft/util/BlockPos;Lnet/minecraft/block/state/IBlockState;)Lnet/minecraft/util/AxisAlignedBB;", ordinal = 1)) - private AxisAlignedBB patcher$shouldCancel(Block instance, World world, BlockPos blockPos, IBlockState iBlockState) { + @Redirect(method = "rayTraceBlocks(Lnet/minecraft/util/Vec3;Lnet/minecraft/util/Vec3;ZZZ)Lnet/minecraft/util/MovingObjectPosition;", at = @At(value = "INVOKE", target = + //#if MC<=10809 + "Lnet/minecraft/block/Block;getCollisionBoundingBox(Lnet/minecraft/world/World;Lnet/minecraft/util/BlockPos;Lnet/minecraft/block/state/IBlockState;)Lnet/minecraft/util/AxisAlignedBB;" + //#else + //$$ "Lnet/minecraft/block/state/IBlockState;getCollisionBoundingBox(Lnet/minecraft/world/IBlockAccess;Lnet/minecraft/util/math/BlockPos;)Lnet/minecraft/util/math/AxisAlignedBB;" + //#endif + , ordinal = 1)) + private AxisAlignedBB patcher$shouldCancel( + //#if MC<=10809 + Block instance, World world, BlockPos blockPos, IBlockState iBlockState + //#else + //$$ IBlockState iBlockState, net.minecraft.world.IBlockAccess iBlockAccess, BlockPos blockPos + //#endif + ) { if (PatcherConfig.betterCamera && patcher$ignoredBlocks.contains(iBlockState.getBlock())) return null; - return instance.getCollisionBoundingBox(world, blockPos, iBlockState); + return + //#if MC<=10809 + instance.getCollisionBoundingBox(world, blockPos, iBlockState); + //#else + //$$ iBlockState.getCollisionBoundingBox(iBlockAccess, blockPos); + //#endif } } diff --git a/src/main/java/club/sk1er/patcher/mixins/features/lefthand/EntityRendererMixin_LeftHandedness.java b/src/main/java/club/sk1er/patcher/mixins/features/lefthand/EntityRendererMixin_LeftHandedness.java index f1781c258..8e1e2f3de 100644 --- a/src/main/java/club/sk1er/patcher/mixins/features/lefthand/EntityRendererMixin_LeftHandedness.java +++ b/src/main/java/club/sk1er/patcher/mixins/features/lefthand/EntityRendererMixin_LeftHandedness.java @@ -25,7 +25,8 @@ public class EntityRendererMixin_LeftHandedness { @Dynamic("OptiFine adds its own version of renderHand") @Inject( method = {"renderHand(FI)V", "renderHand(FIZZZ)V", "func_78476_b"}, - at = @At(value = "INVOKE", target = "Lnet/minecraft/client/renderer/EntityRenderer;enableLightmap()V", shift = At.Shift.AFTER) + at = @At(value = "INVOKE", target = "Lnet/minecraft/client/renderer/EntityRenderer;enableLightmap()V", shift = At.Shift.AFTER, remap = true), + remap = false ) private void patcher$flipHandSide(CallbackInfo ci) { ItemRendererHook.isRenderingItemInFirstPerson = true; @@ -41,7 +42,8 @@ public class EntityRendererMixin_LeftHandedness { @Dynamic("OptiFine adds its own version of renderHand") @Inject( method = {"renderHand(FI)V", "renderHand(FIZZZ)V", "func_78476_b"}, - at = @At(value = "INVOKE", target = "Lnet/minecraft/client/renderer/EntityRenderer;disableLightmap()V") + at = @At(value = "INVOKE", target = "Lnet/minecraft/client/renderer/EntityRenderer;disableLightmap()V", remap = true), + remap = false ) private void patcher$resetFrontFace(CallbackInfo ci) { if (PatcherConfig.leftHandInFirstPerson) { diff --git a/src/main/java/club/sk1er/patcher/mixins/features/lefthand/ItemRendererMixin_LeftHandedness.java b/src/main/java/club/sk1er/patcher/mixins/features/lefthand/ItemRendererMixin_LeftHandedness.java index 02a2685aa..983074276 100644 --- a/src/main/java/club/sk1er/patcher/mixins/features/lefthand/ItemRendererMixin_LeftHandedness.java +++ b/src/main/java/club/sk1er/patcher/mixins/features/lefthand/ItemRendererMixin_LeftHandedness.java @@ -8,8 +8,10 @@ @Mixin(ItemRenderer.class) public class ItemRendererMixin_LeftHandedness { + //#if MC==10809 @ModifyConstant(method = "rotateWithPlayerRotations", constant = @Constant(floatValue = 1f, ordinal = 1)) private float leftHandRotate(float constant) { return PatcherConfig.leftHandInFirstPerson ? -constant : constant; } + //#endif } diff --git a/src/main/java/club/sk1er/patcher/mixins/features/lefthand/RenderFishMixin_LeftHandedness.java b/src/main/java/club/sk1er/patcher/mixins/features/lefthand/RenderFishMixin_LeftHandedness.java index 46802ee02..76bfbbb05 100644 --- a/src/main/java/club/sk1er/patcher/mixins/features/lefthand/RenderFishMixin_LeftHandedness.java +++ b/src/main/java/club/sk1er/patcher/mixins/features/lefthand/RenderFishMixin_LeftHandedness.java @@ -9,6 +9,7 @@ @Mixin(RenderFish.class) public class RenderFishMixin_LeftHandedness { + //#if MC==10809 @ModifyVariable(method = "doRender(Lnet/minecraft/entity/projectile/EntityFishHook;DDDFF)V", at = @At(value = "STORE", ordinal = 0)) private Vec3 patcher$flipFishingLine(Vec3 original) { if (PatcherConfig.leftHandInFirstPerson) { @@ -16,4 +17,5 @@ public class RenderFishMixin_LeftHandedness { } return original; } + //#endif } diff --git a/src/main/java/club/sk1er/patcher/mixins/performance/SimpleReloadableResourceManager_OnlyRefreshNecessaryListeners.java b/src/main/java/club/sk1er/patcher/mixins/performance/SimpleReloadableResourceManager_OnlyRefreshNecessaryListeners.java index dfbdc5cb8..ac748adce 100644 --- a/src/main/java/club/sk1er/patcher/mixins/performance/SimpleReloadableResourceManager_OnlyRefreshNecessaryListeners.java +++ b/src/main/java/club/sk1er/patcher/mixins/performance/SimpleReloadableResourceManager_OnlyRefreshNecessaryListeners.java @@ -37,7 +37,7 @@ private List redirectNotifyReloadListeners(Simpl } } - @Inject(method = "notifyReloadListeners", at = @At(value = "INVOKE", target = "Lnet/minecraftforge/fml/common/ProgressManager;pop(Lnet/minecraftforge/fml/common/ProgressManager$ProgressBar;)V")) + @Inject(method = "notifyReloadListeners", at = @At(value = "INVOKE", target = "Lnet/minecraftforge/fml/common/ProgressManager;pop(Lnet/minecraftforge/fml/common/ProgressManager$ProgressBar;)V", remap = false), remap = true) private void callOptiFineLanguage(CallbackInfo ci) { if (ResourceReloadHooks.shouldLoadLanguage()) { ResourceReloadHooks.reloadOptiFineLanguage(); diff --git a/src/main/java/club/sk1er/patcher/mixins/performance/TileEntityRendererDispatcherMixin_BatchDraw.java b/src/main/java/club/sk1er/patcher/mixins/performance/TileEntityRendererDispatcherMixin_BatchDraw.java index 0f4245a69..b8ec6a487 100644 --- a/src/main/java/club/sk1er/patcher/mixins/performance/TileEntityRendererDispatcherMixin_BatchDraw.java +++ b/src/main/java/club/sk1er/patcher/mixins/performance/TileEntityRendererDispatcherMixin_BatchDraw.java @@ -25,12 +25,12 @@ public class TileEntityRendererDispatcherMixin_BatchDraw { patcher$drawingBatch = false; } - @Redirect(method = "renderTileEntity", at = @At(value = "INVOKE", target = "Lnet/minecraft/tileentity/TileEntity;hasFastRenderer()Z")) + @Redirect(method = "renderTileEntity", at = @At(value = "INVOKE", target = "Lnet/minecraft/tileentity/TileEntity;hasFastRenderer()Z", remap = false), remap = true) private boolean patcher$renderTileEntity(TileEntity instance) { return (!PatcherConfig.batchModelRendering || patcher$drawingBatch) && instance.hasFastRenderer(); } - @Redirect(method = "renderTileEntityAt(Lnet/minecraft/tileentity/TileEntity;DDDFI)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/tileentity/TileEntity;hasFastRenderer()Z")) + @Redirect(method = "renderTileEntityAt(Lnet/minecraft/tileentity/TileEntity;DDDFI)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/tileentity/TileEntity;hasFastRenderer()Z", remap = false), remap = true) private boolean patcher$renderTileEntityAt(TileEntity instance) { return (!PatcherConfig.batchModelRendering || patcher$drawingBatch) && instance.hasFastRenderer(); } diff --git a/src/main/java/club/sk1er/patcher/mixins/performance/forge/FMLClientHandlerMixin_GetErrors.java b/src/main/java/club/sk1er/patcher/mixins/performance/forge/FMLClientHandlerMixin_GetErrors.java index da460fac4..d203ef120 100644 --- a/src/main/java/club/sk1er/patcher/mixins/performance/forge/FMLClientHandlerMixin_GetErrors.java +++ b/src/main/java/club/sk1er/patcher/mixins/performance/forge/FMLClientHandlerMixin_GetErrors.java @@ -11,24 +11,30 @@ import org.spongepowered.asm.mixin.Shadow; @Mixin(FMLClientHandler.class) -public class FMLClientHandlerMixin_GetErrors implements FMLClientHandlerExt { - @Shadow +public class FMLClientHandlerMixin_GetErrors + //#if MC==10809 + implements FMLClientHandlerExt + //#endif +{ + //#if MC==10809 + @Shadow(remap = false) private MissingModsException modsMissing; - @Shadow + @Shadow(remap = false) private WrongMinecraftVersionException wrongMC; - @Shadow + @Shadow(remap = false) private CustomModLoadingErrorDisplayException customError; - @Shadow + @Shadow(remap = false) private DuplicateModsFoundException dupesFound; - @Shadow + @Shadow(remap = false) private ModSortingException modSorting; @Override public boolean patcher$hasErrors() { return this.modsMissing != null || this.wrongMC != null || this.customError != null || this.dupesFound != null || this.modSorting != null; } + //#endif } diff --git a/src/main/java/club/sk1er/patcher/mixins/performance/forge/ModelLoader_SkipFirstBaking.java b/src/main/java/club/sk1er/patcher/mixins/performance/forge/ModelLoader_SkipFirstBaking.java index 6d09dba1b..68dbf5de6 100644 --- a/src/main/java/club/sk1er/patcher/mixins/performance/forge/ModelLoader_SkipFirstBaking.java +++ b/src/main/java/club/sk1er/patcher/mixins/performance/forge/ModelLoader_SkipFirstBaking.java @@ -32,7 +32,7 @@ public class ModelLoader_SkipFirstBaking { //#if MC==10809 - @Shadow + @Shadow(remap = false) @Final private Map stateModels; @Unique diff --git a/src/main/java/club/sk1er/patcher/mixins/performance/optifine/MathHelperMixin_OFFastMath.java b/src/main/java/club/sk1er/patcher/mixins/performance/optifine/MathHelperMixin_OFFastMath.java index e1f398b20..69cbc5852 100644 --- a/src/main/java/club/sk1er/patcher/mixins/performance/optifine/MathHelperMixin_OFFastMath.java +++ b/src/main/java/club/sk1er/patcher/mixins/performance/optifine/MathHelperMixin_OFFastMath.java @@ -8,15 +8,15 @@ public class MathHelperMixin_OFFastMath { @Dynamic("OptiFine") - @Shadow + @Shadow(remap = false) private static float[] SIN_TABLE_FAST; @Dynamic("OptiFine") - @Shadow + @Shadow(remap = false) private static float radToIndex; @Dynamic("OptiFine") - @Shadow + @Shadow(remap = false) public static boolean fastMath; /**