mirror of
https://github.com/LeavesMC/Leaves.git
synced 2025-12-23 08:59:31 +00:00
128 lines
8.7 KiB
Diff
128 lines
8.7 KiB
Diff
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<GlobalConfiguration, Wor
|
|
for (ServerLevel level : server.getAllLevels()) {
|
|
this.createWorldConfig(createWorldContextMap(level), reloader(this.worldConfigClass, level.paperConfig()));
|
|
}
|
|
+ top.leavesmc.leaves.LeavesConfig.doMcTechnicalMode(); // Leaves - mc technical survival mode
|
|
} catch (Exception ex) {
|
|
throw new RuntimeException("Could not reload paper configuration files", ex);
|
|
}
|
|
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
|
|
index 893475f58f649a40e3962092a3608636c1a996e1..f5b777bc8da7917d67c72cad249a9648bf93953d 100644
|
|
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java
|
|
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
|
|
@@ -363,7 +363,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
|
configuredSpigotValue = spigotWorldConfig.monsterTrackingRange;
|
|
break;
|
|
case MISC:
|
|
- configuredSpigotValue = spigotWorldConfig.miscTrackingRange;
|
|
+ configuredSpigotValue = top.leavesmc.leaves.LeavesConfig.mcTechnicalMode ? 0 : spigotWorldConfig.miscTrackingRange; // Leaves - mc technical survival mode
|
|
break;
|
|
case OTHER:
|
|
configuredSpigotValue = spigotWorldConfig.otherTrackingRange;
|
|
diff --git a/src/main/java/net/minecraft/world/entity/boss/enderdragon/EndCrystal.java b/src/main/java/net/minecraft/world/entity/boss/enderdragon/EndCrystal.java
|
|
index 500500468c12d1d44ea6b83a9176b470a954f59a..1da1c130611f392ba957e0c893123f564d13dbff 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/boss/enderdragon/EndCrystal.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/boss/enderdragon/EndCrystal.java
|
|
@@ -66,7 +66,7 @@ public class EndCrystal extends Entity {
|
|
// CraftBukkit end
|
|
}
|
|
// Paper start - Fix invulnerable end crystals
|
|
- if (this.level.paperConfig().unsupportedSettings.fixInvulnerableEndCrystalExploit && this.generatedByDragonFight && this.isInvulnerable()) {
|
|
+ if (!top.leavesmc.leaves.LeavesConfig.mcTechnicalMode && this.level.paperConfig().unsupportedSettings.fixInvulnerableEndCrystalExploit && this.generatedByDragonFight && this.isInvulnerable()) { // Leaves - mc technical survival mode
|
|
if (!java.util.Objects.equals(((ServerLevel) this.level).uuid, this.getOriginWorld())
|
|
|| ((ServerLevel) this.level).dragonFight() == null
|
|
|| ((ServerLevel) this.level).dragonFight().respawnStage == null
|
|
diff --git a/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java b/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java
|
|
index bedee2c93bd0aff148f93dcf111e0fc3d9bce4a0..92aa71991c5dec8792ae8efa2502c2279c0f2bb6 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java
|
|
@@ -59,7 +59,7 @@ public class PrimedTnt extends Entity {
|
|
|
|
@Override
|
|
public void tick() {
|
|
- if (level.spigotConfig.maxTntTicksPerTick > 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;
|