mirror of
https://github.com/LeavesMC/Leaves.git
synced 2025-12-19 14:59:32 +00:00
153 lines
11 KiB
Diff
153 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/configuration/PaperConfigurations.java b/src/main/java/io/papermc/paper/configuration/PaperConfigurations.java
|
|
index 1029b6de6f36b08bf634b4056ef5701383f6f258..64bb056d409c19eca724caa8512e6a597623170e 100644
|
|
--- a/src/main/java/io/papermc/paper/configuration/PaperConfigurations.java
|
|
+++ b/src/main/java/io/papermc/paper/configuration/PaperConfigurations.java
|
|
@@ -318,6 +318,7 @@ public class PaperConfigurations extends Configurations<GlobalConfiguration, Wor
|
|
for (ServerLevel level : server.getAllLevels()) {
|
|
this.createWorldConfig(createWorldContextMap(level), reloader(this.worldConfigClass, level.paperConfig()));
|
|
}
|
|
+ org.leavesmc.leaves.util.McTechnicalModeHelper.doMcTechnicalModeIf(); // 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 2eb2f244ff8a69c606b49f208c934afe4ee5f59f..e8fa04e83aa80d8284aa58bf3899f5c81e4a2ef6 100644
|
|
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
|
|
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
|
@@ -2509,7 +2509,7 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf.
|
|
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 (!org.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/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
|
index b4ddddc0bf56ef1993d5db5727287cbeb19e6e53..b70ee2d80756e90c495c578ceb1c9235c6861a6e 100644
|
|
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
|
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
|
@@ -1632,7 +1632,7 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player imple
|
|
|
|
@Override
|
|
public boolean isInvulnerableTo(DamageSource damageSource) {
|
|
- return super.isInvulnerableTo(damageSource) || this.isChangingDimension() || !this.level().paperConfig().collisions.allowPlayerCrammingDamage && damageSource == damageSources().cramming(); // Paper - disable player cramming
|
|
+ return super.isInvulnerableTo(damageSource) || this.isChangingDimension() || !org.leavesmc.leaves.LeavesConfig.mcTechnicalMode && !this.level().paperConfig().collisions.allowPlayerCrammingDamage && damageSource == damageSources().cramming(); // Paper - disable player cramming // Leaves - mc technical survival mode
|
|
}
|
|
|
|
@Override
|
|
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 a33d89fe9ca9e343edab8bb1cc88c54130ddb4a7..5efedc1cadf31f2b944ca5401ce0c21131a4ab94 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
|
|
@@ -70,7 +70,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 (!org.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 42bd2d9a1528b6210e4dfb56233062fd97c9743b..8d494b549abb452bb554220060cc9c5beec5edf6 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java
|
|
@@ -95,7 +95,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 > (org.leavesmc.leaves.LeavesConfig.mcTechnicalMode ? 2000 : this.level().spigotConfig.maxTntTicksPerTick)) { return; } // Spigot // Leaves - mc technical survival mode
|
|
this.handlePortal();
|
|
this.applyGravity();
|
|
this.move(MoverType.SELF, this.getDeltaMovement());
|
|
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 10ade433c083851d9ea4797c6ec618db122229f9..dff461c78e3a613391601b4a948fe49e62332439 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/projectile/Projectile.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/projectile/Projectile.java
|
|
@@ -126,7 +126,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 - Reset pearls when they stop being ticked; Don't store shooter name for pearls to block enderpearl travel exploit
|
|
+ if (this instanceof ThrownEnderpearl && this.level() != null && this.level().paperConfig().fixes.disableUnloadedChunkEnderpearlExploit && !org.leavesmc.leaves.LeavesConfig.mcTechnicalMode) { this.ownerUUID = null; } // Paper - Reset pearls when they stop being ticked; 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 8205d34ed80781b2aab1fb2ef59986b9370f0198..c5b26fdb173a59280e790a5d5a687e0c0114bb74 100644
|
|
--- a/src/main/java/net/minecraft/world/level/NaturalSpawner.java
|
|
+++ b/src/main/java/net/minecraft/world/level/NaturalSpawner.java
|
|
@@ -90,7 +90,7 @@ public final class NaturalSpawner {
|
|
|
|
if (enumcreaturetype != MobCategory.MISC) {
|
|
// Paper start - Only count natural spawns
|
|
- if (!entity.level().paperConfig().entities.spawning.countAllMobsForSpawning &&
|
|
+ if (!org.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/net/minecraft/world/level/block/entity/HopperBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/HopperBlockEntity.java
|
|
index 5f394cda052271b6ecfafc325733e5ae0524822f..cee74a6c47cd56a17a8faf68405fee09d6fd4655 100644
|
|
--- a/src/main/java/net/minecraft/world/level/block/entity/HopperBlockEntity.java
|
|
+++ b/src/main/java/net/minecraft/world/level/block/entity/HopperBlockEntity.java
|
|
@@ -295,7 +295,7 @@ public class HopperBlockEntity extends RandomizableContainerBlockEntity implemen
|
|
origItemStack.setCount(originalItemCount);
|
|
}
|
|
}
|
|
- if (foundItem && level.paperConfig().hopper.cooldownWhenFull) { // Inventory was full - cooldown
|
|
+ if (foundItem && level.paperConfig().hopper.cooldownWhenFull && !org.leavesmc.leaves.LeavesConfig.mcTechnicalMode) { // Inventory was full - cooldown // Leaves
|
|
hopper.setCooldown(level.spigotConfig.hopperTransfer);
|
|
}
|
|
return false;
|
|
@@ -336,7 +336,7 @@ public class HopperBlockEntity extends RandomizableContainerBlockEntity implemen
|
|
}
|
|
origItemStack.setCount(originalItemCount);
|
|
|
|
- if (level.paperConfig().hopper.cooldownWhenFull) {
|
|
+ if (level.paperConfig().hopper.cooldownWhenFull && !org.leavesmc.leaves.LeavesConfig.mcTechnicalMode) { // Leaves
|
|
cooldownHopper(hopper);
|
|
}
|
|
|
|
diff --git a/src/main/java/org/leavesmc/leaves/util/McTechnicalModeHelper.java b/src/main/java/org/leavesmc/leaves/util/McTechnicalModeHelper.java
|
|
new file mode 100644
|
|
index 0000000000000000000000000000000000000000..2fdcb75a1fb85ab2fc6759050b2e7ffa601dcfa0
|
|
--- /dev/null
|
|
+++ b/src/main/java/org/leavesmc/leaves/util/McTechnicalModeHelper.java
|
|
@@ -0,0 +1,27 @@
|
|
+package org.leavesmc.leaves.util;
|
|
+
|
|
+import io.papermc.paper.configuration.GlobalConfiguration;
|
|
+import org.leavesmc.leaves.LeavesConfig;
|
|
+
|
|
+import java.util.Map;
|
|
+
|
|
+public class McTechnicalModeHelper {
|
|
+
|
|
+ public static void doMcTechnicalModeIf() {
|
|
+ if (LeavesConfig.mcTechnicalMode) {
|
|
+ doMcTechnicalMode();
|
|
+ }
|
|
+ }
|
|
+
|
|
+ public static void doMcTechnicalMode() {
|
|
+ GlobalConfiguration.get().unsupportedSettings.allowPistonDuplication = true;
|
|
+ GlobalConfiguration.get().unsupportedSettings.allowHeadlessPistons = true;
|
|
+ GlobalConfiguration.get().unsupportedSettings.allowPermanentBlockBreakExploits = true;
|
|
+ GlobalConfiguration.get().unsupportedSettings.allowUnsafeEndPortalTeleportation = 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().itemValidation.resolveSelectorsInBooks = true;
|
|
+ GlobalConfiguration.get().scoreboards.saveEmptyScoreboardTeams = true;
|
|
+ }
|
|
+}
|