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/chunk/system/scheduling/ChunkHolderManager.java b/src/main/java/io/papermc/paper/chunk/system/scheduling/ChunkHolderManager.java index 8e52ebe8d12f5da3d877b0e4ff3723229fb47db1..b9a45dfd024c966ac93eaa15a42f4e2c5338829f 100644 --- a/src/main/java/io/papermc/paper/chunk/system/scheduling/ChunkHolderManager.java +++ b/src/main/java/io/papermc/paper/chunk/system/scheduling/ChunkHolderManager.java @@ -607,7 +607,7 @@ public final class ChunkHolderManager { // Delay unload chunk patch originally by Aikar, updated to 1.20 by jpenilla // these days, the patch is mostly useful to keep chunks ticking when players teleport // so that their pets can teleport with them as well. - final long delayTimeout = this.world.paperConfig().chunks.delayChunkUnloadsBy.ticks(); + final long delayTimeout = top.leavesmc.leaves.LeavesConfig.mcTechnicalMode ? 0 : this.world.paperConfig().chunks.delayChunkUnloadsBy.ticks(); // Leaves - mc technical survival mode final TicketType toAdd; final long timeout; if (type == RegionizedPlayerChunkLoader.REGION_PLAYER_TICKET && delayTimeout > 0) { diff --git a/src/main/java/io/papermc/paper/configuration/PaperConfigurations.java b/src/main/java/io/papermc/paper/configuration/PaperConfigurations.java index 9e8b8de907654050c51400286af971caca87d6bd..e39ecb625f13ebc37cb4c7e0da7077e054bb39f6 100644 --- a/src/main/java/io/papermc/paper/configuration/PaperConfigurations.java +++ b/src/main/java/io/papermc/paper/configuration/PaperConfigurations.java @@ -310,6 +310,7 @@ public class PaperConfigurations extends Configurations 0 && ++this.level().spigotConfig.currentPrimedTnt > this.level().spigotConfig.maxTntTicksPerTick) { return; } // Spigot + if (this.level().spigotConfig.maxTntTicksPerTick > 0 && ++this.level().spigotConfig.currentPrimedTnt > (top.leavesmc.leaves.LeavesConfig.mcTechnicalMode ? 2000 : this.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 f555e29c7f9ea4ddb243a018bdc93d2bf1950c3c..2ef2f27fd899c434c1c35b6fb354f47c7199ad23 100644 --- a/src/main/java/net/minecraft/world/entity/npc/Villager.java +++ b/src/main/java/net/minecraft/world/entity/npc/Villager.java @@ -1018,7 +1018,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 (this.level().paperConfig().fixes.fixCuringZombieVillagerDiscountExploit) { + if (!top.leavesmc.leaves.LeavesConfig.mcTechnicalMode && this.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/entity/projectile/Projectile.java b/src/main/java/net/minecraft/world/entity/projectile/Projectile.java index a90317100d32974e481e14476843f66997a2cf3a..34029cdf229ef8f78ddb0c8a2e5e0542628848d8 100644 --- a/src/main/java/net/minecraft/world/entity/projectile/Projectile.java +++ b/src/main/java/net/minecraft/world/entity/projectile/Projectile.java @@ -122,7 +122,7 @@ public abstract class Projectile extends Entity implements TraceableEntity { if (nbt.hasUUID("Owner")) { this.ownerUUID = nbt.getUUID("Owner"); this.cachedOwner = null; - if (this instanceof ThrownEnderpearl && this.level() != null && this.level().paperConfig().fixes.disableUnloadedChunkEnderpearlExploit) { this.ownerUUID = null; } // Paper - Don't store shooter name for pearls to block enderpearl travel exploit + if (this instanceof ThrownEnderpearl && this.level() != null && this.level().paperConfig().fixes.disableUnloadedChunkEnderpearlExploit && !top.leavesmc.leaves.LeavesConfig.mcTechnicalMode) { this.ownerUUID = null; } // Paper - Don't store shooter name for pearls to block enderpearl travel exploit // Leaves - mc technical mode } this.leftOwner = nbt.getBoolean("LeftOwner"); diff --git a/src/main/java/net/minecraft/world/level/NaturalSpawner.java b/src/main/java/net/minecraft/world/level/NaturalSpawner.java index 5eded2322d604c3a304194926a740818631f36de..797725f7472ed36bf5a1369a7dfe600a9749cbac 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 d0c7d3883723bcc0c4753170ddff766ef908250e..b5065d533c4fa0610bf936e036dc0d5ba37f63cf 100644 --- a/src/main/java/top/leavesmc/leaves/LeavesConfig.java +++ b/src/main/java/top/leavesmc/leaves/LeavesConfig.java @@ -2,6 +2,7 @@ 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; @@ -490,6 +491,14 @@ public final class LeavesConfig { 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; + GlobalConfiguration.get().itemValidation.resolveSelectorsInBooks = true; } }