9
0
mirror of https://github.com/LeavesMC/Leaves.git synced 2025-12-19 14:59:32 +00:00
Files
LeavesMC/leaves-server/minecraft-patches/features/0033-MC-Technical-Survival-Mode.patch
Lumine1909 f09fbb247d 1.21.5 (#470)
---------

Co-authored-by: violetc <58360096+s-yh-china@users.noreply.github.com>
Co-authored-by: Fortern <blueten.ki@gmail.com>
Co-authored-by: MC_XiaoHei <xor7xiaohei@gmail.com>
Co-authored-by: Helvetica Volubi <88063803+Suisuroru@users.noreply.github.com>
Co-authored-by: MC_XiaoHei <xiaohei.xor7@outlook.com>
2025-06-05 18:41:51 +08:00

82 lines
6.0 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/net/minecraft/server/level/ServerPlayer.java b/net/minecraft/server/level/ServerPlayer.java
index 988992a181e35a3856817419cb4941c73a9c31f2..66110486725de7967e55839043b9fc9690e4c0f5 100644
--- a/net/minecraft/server/level/ServerPlayer.java
+++ b/net/minecraft/server/level/ServerPlayer.java
@@ -1614,7 +1614,7 @@ public class ServerPlayer extends Player implements ca.spottedleaf.moonrise.patc
public boolean isInvulnerableTo(ServerLevel level, DamageSource damageSource) {
return (super.isInvulnerableTo(level, damageSource) // Paper - disable player cramming;
|| this.isChangingDimension() && !damageSource.is(DamageTypes.ENDER_PEARL)
- || !this.hasClientLoaded()) || (!this.level().paperConfig().collisions.allowPlayerCrammingDamage && damageSource.is(DamageTypes.CRAMMING)); // Paper - disable player cramming;
+ || !this.hasClientLoaded()) || (!org.leavesmc.leaves.LeavesConfig.modify.mcTechnicalMode && !this.level().paperConfig().collisions.allowPlayerCrammingDamage && damageSource.is(DamageTypes.CRAMMING)); // Paper - disable player cramming; // Leaves - mc technical survival mode
}
@Override
diff --git a/net/minecraft/world/entity/boss/enderdragon/EndCrystal.java b/net/minecraft/world/entity/boss/enderdragon/EndCrystal.java
index d813427cf20117014bc42af0eb7cdee037fbcd9c..35f8644a9b4704363f6fe1ca19135566a45ef835 100644
--- a/net/minecraft/world/entity/boss/enderdragon/EndCrystal.java
+++ b/net/minecraft/world/entity/boss/enderdragon/EndCrystal.java
@@ -64,7 +64,7 @@ public class EndCrystal extends Entity {
}
// Paper start - Fix invulnerable end crystals
- if (this.level().paperConfig().unsupportedSettings.fixInvulnerableEndCrystalExploit && this.generatedByDragonFight && this.isInvulnerable()) {
+ if (!org.leavesmc.leaves.LeavesConfig.modify.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.originWorld)
|| ((ServerLevel) this.level()).getDragonFight() == null
|| ((ServerLevel) this.level()).getDragonFight().respawnStage == null
diff --git a/net/minecraft/world/entity/item/PrimedTnt.java b/net/minecraft/world/entity/item/PrimedTnt.java
index 5d23d8754b304d5e2fd54400cc81c7fe5c14a804..0f28b1befd42a85ffa5462e86d5cde142f9d1196 100644
--- a/net/minecraft/world/entity/item/PrimedTnt.java
+++ b/net/minecraft/world/entity/item/PrimedTnt.java
@@ -101,7 +101,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.modify.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/net/minecraft/world/level/NaturalSpawner.java b/net/minecraft/world/level/NaturalSpawner.java
index 14a2514a408a66a83f7b5fb43b4c4dc8f23fd5f4..5427f5e1f0416a8dfa3e9c38c3ce69d6e2bd37a6 100644
--- a/net/minecraft/world/level/NaturalSpawner.java
+++ b/net/minecraft/world/level/NaturalSpawner.java
@@ -82,7 +82,7 @@ public final class NaturalSpawner {
MobCategory category = entity.getType().getCategory();
if (category != MobCategory.MISC) {
// Paper start - Only count natural spawns
- if (!entity.level().paperConfig().entities.spawning.countAllMobsForSpawning &&
+ if (!org.leavesmc.leaves.LeavesConfig.modify.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/net/minecraft/world/level/block/entity/HopperBlockEntity.java b/net/minecraft/world/level/block/entity/HopperBlockEntity.java
index 212a1a1410550a2456a88a948f377048447a1fc8..2d979850378c05ce569782d8e04a452f986612a7 100644
--- a/net/minecraft/world/level/block/entity/HopperBlockEntity.java
+++ b/net/minecraft/world/level/block/entity/HopperBlockEntity.java
@@ -275,7 +275,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.modify.mcTechnicalMode) { // Inventory was full - cooldown // Leaves
hopper.setCooldown(level.spigotConfig.hopperTransfer);
}
return false;
@@ -316,7 +316,7 @@ public class HopperBlockEntity extends RandomizableContainerBlockEntity implemen
}
origItemStack.setCount(originalItemCount);
- if (level.paperConfig().hopper.cooldownWhenFull) {
+ if (level.paperConfig().hopper.cooldownWhenFull && !org.leavesmc.leaves.LeavesConfig.modify.mcTechnicalMode) { // Leaves
applyCooldown(hopper);
}