diff --git a/src/main/java/com/plusls/MasaGadget/mixin/mod_tweak/tweakeroo/inventoryPreviewSupportTradeOfferList/MixinAbstractVillager.java b/src/main/java/com/plusls/MasaGadget/mixin/mod_tweak/tweakeroo/inventoryPreviewSupportTradeOfferList/MixinAbstractVillager.java new file mode 100644 index 0000000..560a8cd --- /dev/null +++ b/src/main/java/com/plusls/MasaGadget/mixin/mod_tweak/tweakeroo/inventoryPreviewSupportTradeOfferList/MixinAbstractVillager.java @@ -0,0 +1,8 @@ +package com.plusls.MasaGadget.mixin.mod_tweak.tweakeroo.inventoryPreviewSupportTradeOfferList; + +import org.spongepowered.asm.mixin.Mixin; +import top.hendrixshen.magiclib.api.preprocess.DummyClass; + +@Mixin(DummyClass.class) +public class MixinAbstractVillager { +} diff --git a/src/main/resources/masa_gadget_mod.mixins.json b/src/main/resources/masa_gadget_mod.mixins.json index 1203be1..157cc37 100644 --- a/src/main/resources/masa_gadget_mod.mixins.json +++ b/src/main/resources/masa_gadget_mod.mixins.json @@ -58,5 +58,6 @@ "defaultRequire": 1 }, "mixins": [ + "mod_tweak.tweakeroo.inventoryPreviewSupportTradeOfferList.MixinAbstractVillager" ] } diff --git a/versions/1.21.0-fabric/src/main/java/com/plusls/MasaGadget/mixin/mod_tweak/tweakeroo/inventoryPreviewSupportTradeOfferList/MixinAbstractVillager.java b/versions/1.21.0-fabric/src/main/java/com/plusls/MasaGadget/mixin/mod_tweak/tweakeroo/inventoryPreviewSupportTradeOfferList/MixinAbstractVillager.java new file mode 100644 index 0000000..a72545a --- /dev/null +++ b/versions/1.21.0-fabric/src/main/java/com/plusls/MasaGadget/mixin/mod_tweak/tweakeroo/inventoryPreviewSupportTradeOfferList/MixinAbstractVillager.java @@ -0,0 +1,24 @@ +package com.plusls.MasaGadget.mixin.mod_tweak.tweakeroo.inventoryPreviewSupportTradeOfferList; + +import com.llamalad7.mixinextras.injector.wrapoperation.Operation; +import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation; +import com.plusls.MasaGadget.game.Configs; +import net.minecraft.world.entity.npc.AbstractVillager; +import net.minecraft.world.level.Level; +import org.jetbrains.annotations.NotNull; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; + +@Mixin(AbstractVillager.class) +public class MixinAbstractVillager { + @WrapOperation( + method = "getOffers", + at = @At( + value = "FIELD", + target = "Lnet/minecraft/world/level/Level;isClientSide:Z" + ) + ) + private boolean forgiveInvoke(Level instance, @NotNull Operation original) { + return original.call(instance) && !Configs.inventoryPreviewSupportTradeOfferList.getBooleanValue(); + } +}