From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: violetc <58360096+s-yh-china@users.noreply.github.com> Date: Thu, 19 Jan 2023 23:38:50 +0800 Subject: [PATCH] MC Technical Survival Mode Will automatically overwrite some configuration after startup diff --git a/src/main/java/io/papermc/paper/configuration/PaperConfigurations.java b/src/main/java/io/papermc/paper/configuration/PaperConfigurations.java index 9fde9ccb5d069ddce8dd837ef1bc68b93ce66434..0ceddb0ede644e082f82de6ecfa89eda6c420c1d 100644 --- a/src/main/java/io/papermc/paper/configuration/PaperConfigurations.java +++ b/src/main/java/io/papermc/paper/configuration/PaperConfigurations.java @@ -292,6 +292,7 @@ public class PaperConfigurations extends Configurations 0 && ++level.spigotConfig.currentPrimedTnt > level.spigotConfig.maxTntTicksPerTick) { return; } // Spigot + if (level.spigotConfig.maxTntTicksPerTick > 0 && ++level.spigotConfig.currentPrimedTnt > (top.leavesmc.leaves.LeavesConfig.mcTechnicalMode ? 2000 : level.spigotConfig.maxTntTicksPerTick)) { return; } // Spigot // Leaves - mc technical survival mode if (!this.isNoGravity()) { this.setDeltaMovement(this.getDeltaMovement().add(0.0D, -0.04D, 0.0D)); } diff --git a/src/main/java/net/minecraft/world/entity/npc/Villager.java b/src/main/java/net/minecraft/world/entity/npc/Villager.java index 18eac340386a396c9850f53f30d20a41c1437788..f80ad07e5cdc937b0afbfc7d084f314eb8effde8 100644 --- a/src/main/java/net/minecraft/world/entity/npc/Villager.java +++ b/src/main/java/net/minecraft/world/entity/npc/Villager.java @@ -989,7 +989,7 @@ public class Villager extends AbstractVillager implements ReputationEventHandler public void onReputationEventFrom(ReputationEventType interaction, Entity entity) { if (interaction == ReputationEventType.ZOMBIE_VILLAGER_CURED) { // Paper start - fix MC-181190 - if (level.paperConfig().fixes.fixCuringZombieVillagerDiscountExploit) { + if (!top.leavesmc.leaves.LeavesConfig.mcTechnicalMode && level.paperConfig().fixes.fixCuringZombieVillagerDiscountExploit) { // Leaves - mc technical survival mode final GossipContainer.EntityGossips playerReputation = this.getGossips().gossips.get(entity.getUUID()); if (playerReputation != null) { playerReputation.remove(GossipType.MAJOR_POSITIVE); diff --git a/src/main/java/net/minecraft/world/level/NaturalSpawner.java b/src/main/java/net/minecraft/world/level/NaturalSpawner.java index 429c54105978030f2a2275488f8f6bc0d077d312..57610e05b95d1dd911c192879f927ec090cc5411 100644 --- a/src/main/java/net/minecraft/world/level/NaturalSpawner.java +++ b/src/main/java/net/minecraft/world/level/NaturalSpawner.java @@ -95,7 +95,7 @@ public final class NaturalSpawner { if (enumcreaturetype != MobCategory.MISC) { // Paper start - Only count natural spawns - if (!entity.level.paperConfig().entities.spawning.countAllMobsForSpawning && + if (!top.leavesmc.leaves.LeavesConfig.mcTechnicalMode && !entity.level.paperConfig().entities.spawning.countAllMobsForSpawning && // Leaves - mc technical survival mode !(entity.spawnReason == org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.NATURAL || entity.spawnReason == org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.CHUNK_GEN)) { continue; diff --git a/src/main/java/top/leavesmc/leaves/LeavesConfig.java b/src/main/java/top/leavesmc/leaves/LeavesConfig.java index c9c8aca9210530fde712b0735b0f19347c82975c..7a57980a3e4dea0f0d1fe82b7ab9948719670797 100644 --- a/src/main/java/top/leavesmc/leaves/LeavesConfig.java +++ b/src/main/java/top/leavesmc/leaves/LeavesConfig.java @@ -2,11 +2,13 @@ package top.leavesmc.leaves; import com.destroystokyo.paper.util.SneakyThrow; import com.google.common.base.Throwables; +import io.papermc.paper.configuration.GlobalConfiguration; import net.minecraft.server.MinecraftServer; import org.bukkit.Bukkit; import org.bukkit.command.Command; import org.bukkit.configuration.ConfigurationSection; import org.bukkit.configuration.file.YamlConfiguration; +import org.spigotmc.SpigotConfig; import top.leavesmc.leaves.bot.BotCommand; import top.leavesmc.leaves.bot.agent.Actions; import top.leavesmc.leaves.util.MathUtils; @@ -458,6 +460,24 @@ public final class LeavesConfig { } } + public static boolean mcTechnicalMode = true; + private static void mcTechnicalMode() { + mcTechnicalMode = getBoolean("settings.modify.mc-technical-survival-mode", mcTechnicalMode); // TODO better name? + doMcTechnicalMode(); + } + + public static void doMcTechnicalMode() { + if (mcTechnicalMode) { + GlobalConfiguration.get().unsupportedSettings.allowPistonDuplication = true; + GlobalConfiguration.get().unsupportedSettings.allowHeadlessPistons = true; + GlobalConfiguration.get().unsupportedSettings.allowPermanentBlockBreakExploits = true; + GlobalConfiguration.get().packetLimiter.allPackets = new GlobalConfiguration.PacketLimiter.PacketLimit(GlobalConfiguration.get().packetLimiter.allPackets.interval(), + 5000.0, GlobalConfiguration.get().packetLimiter.allPackets.action()); + GlobalConfiguration.get().packetLimiter.overrides = Map.of(); + GlobalConfiguration.get().unsupportedSettings.allowGrindstoneOverstacking = true; + } + } + public static final class WorldConfig { public final String worldName;