Skip to content

Commit

Permalink
Forgive more (#113 #118 #120)
Browse files Browse the repository at this point in the history
Signed-off-by: Hendrix-Shen <[email protected]>
  • Loading branch information
Hendrix-Shen committed Aug 2, 2024
1 parent e2b52c8 commit 92e6988
Showing 1 changed file with 14 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,19 @@
import net.minecraft.world.level.Level;
import org.jetbrains.annotations.NotNull;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Unique;
import org.spongepowered.asm.mixin.injection.At;

@Mixin(AbstractVillager.class)
public class MixinAbstractVillager {
@Unique
private static boolean masa_gadget_mod$shouldForgeInvoke() {
return Configs.inventoryPreviewSupportTradeOfferList.getBooleanValue() ||
Configs.renderNextRestockTime.getBooleanValue() ||
Configs.renderTradeEnchantedBook.getBooleanValue() ||
Configs.renderZombieVillagerConvertTime.getBooleanValue();
}

@WrapOperation(
method = "getOffers",
at = @At(
Expand All @@ -19,6 +28,10 @@ public class MixinAbstractVillager {
)
)
private boolean forgiveInvoke(Level instance, @NotNull Operation<Boolean> original) {
return original.call(instance) && !Configs.inventoryPreviewSupportTradeOfferList.getBooleanValue();
if (MixinAbstractVillager.masa_gadget_mod$shouldForgeInvoke()) {
return false;
}

return original.call(instance);
}
}

0 comments on commit 92e6988

Please sign in to comment.