From 4dad5fc27145593c14425b3e673b924155903585 Mon Sep 17 00:00:00 2001 From: Keuin Date: Mon, 28 Dec 2020 22:53:31 +0800 Subject: Version 1.3.0: add switches for all disable features. Fixed the vanilla bug that the entity trackers sometimes spam in the console. --- .../mixin/DisableWanderingTraderSpawning.java | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'src/main/java/com/keuin/ohmyvanillamc/mixin/DisableWanderingTraderSpawning.java') diff --git a/src/main/java/com/keuin/ohmyvanillamc/mixin/DisableWanderingTraderSpawning.java b/src/main/java/com/keuin/ohmyvanillamc/mixin/DisableWanderingTraderSpawning.java index c7049d8..040c352 100644 --- a/src/main/java/com/keuin/ohmyvanillamc/mixin/DisableWanderingTraderSpawning.java +++ b/src/main/java/com/keuin/ohmyvanillamc/mixin/DisableWanderingTraderSpawning.java @@ -1,18 +1,21 @@ package com.keuin.ohmyvanillamc.mixin; +import com.keuin.ohmyvanillamc.OhMyVanillaMinecraft; import net.minecraft.world.WanderingTraderManager; import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.Overwrite; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; @Mixin(WanderingTraderManager.class) public class DisableWanderingTraderSpawning { - /** - * @reason disable ticking + * Disable ticking * @author trueKeuin */ - @Overwrite - public void tick() { + @Inject(method = "tick", at = @At("HEAD"), cancellable = true) + public void tick(CallbackInfo ci) { + if (OhMyVanillaMinecraft.disableWanderingTraderSpawning) + ci.cancel(); } - } -- cgit v1.2.3