diff options
author | Keuin <[email protected]> | 2020-12-28 22:53:31 +0800 |
---|---|---|
committer | Keuin <[email protected]> | 2020-12-28 22:53:31 +0800 |
commit | 4dad5fc27145593c14425b3e673b924155903585 (patch) | |
tree | 3573b6ddb9170126d47f75a10b91c140c6fd9e98 /src/main/java/com/keuin/ohmyvanillamc/OhMyVanillaMinecraft.java | |
parent | f287ea9dbb54b96c15f441b7f72e7d6527704ded (diff) |
Version 1.3.0: add switches for all disable features. Fixed the vanilla bug that the entity trackers sometimes spam in the console.
Diffstat (limited to 'src/main/java/com/keuin/ohmyvanillamc/OhMyVanillaMinecraft.java')
-rw-r--r-- | src/main/java/com/keuin/ohmyvanillamc/OhMyVanillaMinecraft.java | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/src/main/java/com/keuin/ohmyvanillamc/OhMyVanillaMinecraft.java b/src/main/java/com/keuin/ohmyvanillamc/OhMyVanillaMinecraft.java index c1dc4af..a3d5c90 100644 --- a/src/main/java/com/keuin/ohmyvanillamc/OhMyVanillaMinecraft.java +++ b/src/main/java/com/keuin/ohmyvanillamc/OhMyVanillaMinecraft.java @@ -1,10 +1,33 @@ package com.keuin.ohmyvanillamc; import net.fabricmc.api.ModInitializer; +import net.minecraft.server.network.EntityTrackerEntry; + +import java.lang.reflect.Field; public class OhMyVanillaMinecraft implements ModInitializer { public static boolean disableFishSchooling = true; + public static boolean disablePhantomSpawning = false; + public static boolean disableWanderingTraderSpawning = false; + + private static void disableEntityTrackerEntrySpamming() { + try { + //获取该类的字节码对象 + Class<EntityTrackerEntry> clazz = EntityTrackerEntry.class; + + //获取其私有成员 + Field name = clazz.getDeclaredField("LOGGER"); + + //暴力反射 + name.setAccessible(true); + + //重新赋值 参数一:实力 参数二:值 +// name.set(EntityTrackerEntry, "小鸭鸭"); + } catch (NoSuchFieldException ignored) { + // never mind + } + } @Override public void onInitialize() { @@ -13,5 +36,6 @@ public class OhMyVanillaMinecraft implements ModInitializer { // Proceed with mild caution. System.out.println("OhMyVanillaMinecraft is loading..."); + } } |