mirror of
https://github.com/LeavesMC/Leaves.git
synced 2025-12-19 14:59:32 +00:00
174 lines
12 KiB
Diff
174 lines
12 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/adventure/ChatProcessor.java b/src/main/java/io/papermc/paper/adventure/ChatProcessor.java
|
|
index 8fe9a0bf5a6c27d8a505afc2f51b3dccc905423b..979d70561c1a3b9b539f413ba689a89ab03e413f 100644
|
|
--- a/src/main/java/io/papermc/paper/adventure/ChatProcessor.java
|
|
+++ b/src/main/java/io/papermc/paper/adventure/ChatProcessor.java
|
|
@@ -331,14 +331,14 @@ public final class ChatProcessor {
|
|
}
|
|
|
|
static String legacyDisplayName(final CraftPlayer player) {
|
|
- if (((org.bukkit.craftbukkit.CraftWorld) player.getWorld()).getHandle().paperConfig().scoreboards.useVanillaWorldScoreboardNameColoring) {
|
|
+ if (((org.bukkit.craftbukkit.CraftWorld) player.getWorld()).getHandle().paperConfig().scoreboards.useVanillaWorldScoreboardNameColoring || org.leavesmc.leaves.LeavesConfig.mcTechnicalMode) { // Leaves - mc technical mode
|
|
return legacySection().serialize(player.teamDisplayName()) + ChatFormatting.RESET;
|
|
}
|
|
return player.getDisplayName();
|
|
}
|
|
|
|
static Component displayName(final CraftPlayer player) {
|
|
- if (((CraftWorld) player.getWorld()).getHandle().paperConfig().scoreboards.useVanillaWorldScoreboardNameColoring) {
|
|
+ if (((CraftWorld) player.getWorld()).getHandle().paperConfig().scoreboards.useVanillaWorldScoreboardNameColoring || org.leavesmc.leaves.LeavesConfig.mcTechnicalMode) { // Leaves - mc technical mode
|
|
return player.teamDisplayName();
|
|
}
|
|
return player.displayName();
|
|
diff --git a/src/main/java/io/papermc/paper/configuration/PaperConfigurations.java b/src/main/java/io/papermc/paper/configuration/PaperConfigurations.java
|
|
index 83a726bcf8b7dce73a361b0d79dbd63a0afc7a12..12cf1f7ba7d6c14b8b31d939b6f281bd2135656a 100644
|
|
--- a/src/main/java/io/papermc/paper/configuration/PaperConfigurations.java
|
|
+++ b/src/main/java/io/papermc/paper/configuration/PaperConfigurations.java
|
|
@@ -316,6 +316,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 75512c4217340c7a501f825f440ecb3229b1092e..0d157e461eeb5b97290fadc602ab179a68285eda 100644
|
|
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
|
|
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
|
@@ -2483,7 +2483,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 eee83b3e9bc409c987bf85970f9c2add052cbeb0..56dbb46edc04eb5feb1e1e49fa2866ea8c89ef03 100644
|
|
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
|
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
|
@@ -1635,7 +1635,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 5f7d152f41eb85f17bcded4bc8099b998e5a338b..cfc7edcf24646d1605d05c3782c7694bb9f7c435 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 189a6bd4967aba72e12170e091dbb5b779e752a0..f0713e797b7ddfd39ebf96712983244f0abcf543 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 b6a419ab08a8ee1ddffa234ddc07027ce5296ca8..23f77efe1a0a6ff6398308ce133be762da2a6d0c 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;
|
|
+ }
|
|
+}
|