summaryrefslogtreecommitdiff
path: root/src/main/java/com/keuin/ohmyvanillamc/mixin
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/com/keuin/ohmyvanillamc/mixin')
-rw-r--r--src/main/java/com/keuin/ohmyvanillamc/mixin/DisableEntityTrackerEntrySpamming.java19
-rw-r--r--src/main/java/com/keuin/ohmyvanillamc/mixin/DisablePhantomSpawning.java22
-rw-r--r--src/main/java/com/keuin/ohmyvanillamc/mixin/DisableWanderingTraderSpawning.java15
3 files changed, 50 insertions, 6 deletions
diff --git a/src/main/java/com/keuin/ohmyvanillamc/mixin/DisableEntityTrackerEntrySpamming.java b/src/main/java/com/keuin/ohmyvanillamc/mixin/DisableEntityTrackerEntrySpamming.java
new file mode 100644
index 0000000..523aeed
--- /dev/null
+++ b/src/main/java/com/keuin/ohmyvanillamc/mixin/DisableEntityTrackerEntrySpamming.java
@@ -0,0 +1,19 @@
+package com.keuin.ohmyvanillamc.mixin;
+
+import com.keuin.ohmyvanillamc.DummyLogger;
+import net.minecraft.server.network.EntityTrackerEntry;
+import org.apache.logging.log4j.Logger;
+import org.spongepowered.asm.mixin.Mixin;
+import org.spongepowered.asm.mixin.gen.Accessor;
+
+@Mixin(EntityTrackerEntry.class)
+public class DisableEntityTrackerEntrySpamming {
+
+ private static final Logger DUMMY_LOGGER = new DummyLogger();
+
+ @Accessor("LOGGER")
+ private static Logger LOGGER() {
+ return DUMMY_LOGGER;
+ }
+
+}
diff --git a/src/main/java/com/keuin/ohmyvanillamc/mixin/DisablePhantomSpawning.java b/src/main/java/com/keuin/ohmyvanillamc/mixin/DisablePhantomSpawning.java
new file mode 100644
index 0000000..d5788c7
--- /dev/null
+++ b/src/main/java/com/keuin/ohmyvanillamc/mixin/DisablePhantomSpawning.java
@@ -0,0 +1,22 @@
+package com.keuin.ohmyvanillamc.mixin;
+
+import com.keuin.ohmyvanillamc.OhMyVanillaMinecraft;
+import net.minecraft.server.world.ServerWorld;
+import net.minecraft.world.gen.PhantomSpawner;
+import org.spongepowered.asm.mixin.Mixin;
+import org.spongepowered.asm.mixin.injection.At;
+import org.spongepowered.asm.mixin.injection.Inject;
+import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
+
+@Mixin(PhantomSpawner.class)
+public class DisablePhantomSpawning {
+ /**
+ * Disable phantom spawning
+ * @author trueKeuin
+ */
+ @Inject(method = "spawn", at = @At("HEAD"), cancellable = true)
+ public void spawn(ServerWorld serverWorld, boolean spawnMonsters, boolean spawnAnimals, CallbackInfo ci) {
+ if (OhMyVanillaMinecraft.disablePhantomSpawning)
+ ci.cancel();
+ }
+}
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();
}
-
}