mirror of
https://github.com/LeavesMC/Leaves.git
synced 2025-12-19 14:59:32 +00:00
138 lines
11 KiB
Diff
138 lines
11 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/chunk/system/scheduling/ChunkHolderManager.java b/src/main/java/io/papermc/paper/chunk/system/scheduling/ChunkHolderManager.java
|
|
index abd0217cf0bff183c8e262edc173a53403797c1a..f2659e1973e7ef5c5b64ba0bf3b27e5da1f53905 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<ChunkPos> 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 e471960e0443392f6f54732b052a4debf2a8fd97..08f61d48f3484cb04a94955b0b4b2981bf169358 100644
|
|
--- a/src/main/java/io/papermc/paper/configuration/PaperConfigurations.java
|
|
+++ b/src/main/java/io/papermc/paper/configuration/PaperConfigurations.java
|
|
@@ -295,6 +295,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/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
|
index c47df8d18be8ac7d32a16e6662dbbd850efc8e8a..4453664ac91eb727e340ace3b6bdb083541f816c 100644
|
|
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
|
|
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
|
@@ -2692,7 +2692,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
|
public void onTickingEnd(Entity entity) {
|
|
ServerLevel.this.entityTickList.remove(entity);
|
|
// Paper start - Reset pearls when they stop being ticked
|
|
- if (paperConfig().fixes.disableUnloadedChunkEnderpearlExploit && entity instanceof net.minecraft.world.entity.projectile.ThrownEnderpearl pearl) {
|
|
+ if (!top.leavesmc.leaves.LeavesConfig.mcTechnicalMode && paperConfig().fixes.disableUnloadedChunkEnderpearlExploit && entity instanceof net.minecraft.world.entity.projectile.ThrownEnderpearl pearl) { // Leaves - mc technical mode
|
|
pearl.cachedOwner = null;
|
|
pearl.ownerUUID = null;
|
|
}
|
|
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 ffc5b68c4246a7111845230a75552bb15875a209..990cdebf1b9e64a5001c71411e64f68108aef47f 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
|
|
@@ -67,7 +67,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()).getDragonFight() == null
|
|
|| ((ServerLevel) this.level()).getDragonFight().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 4ce3e69970dd9eb251d0538a2d233ca30e9e5e47..25a01ca42b8f2f0590965edbeca9c1f95cd66420 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java
|
|
@@ -63,7 +63,7 @@ public class PrimedTnt extends Entity implements TraceableEntity {
|
|
|
|
@Override
|
|
public void tick() {
|
|
- if (this.level().spigotConfig.maxTntTicksPerTick > 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 e30d5ae3e2900f43d7cafde71b8196f26e872841..79bfd7b5da13197c2d3f7dbf9c3154dd783d1ba8 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/npc/Villager.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/npc/Villager.java
|
|
@@ -1009,7 +1009,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 1b7cf6d06bdf36f146656727511a461f2520762e..0eb8c5dc84c3ca346dcaf6fd50c13d3b060f87d1 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/projectile/Projectile.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/projectile/Projectile.java
|
|
@@ -115,7 +115,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 9af07ebff3a510a4e3fc71ab4d08897db02b7299..81eaa7ead4821929f20e4c5fcb822504001f6f99 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 c707341fd8f878f77c132a5993ae94a18c259711..8545cfdc5a08e3f6f7c9a050867a3b45fd97bf39 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;
|
|
@@ -478,6 +479,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;
|
|
}
|
|
}
|
|
|