diff options
author | Nassim Jahnke <[email protected]> | 2024-10-27 18:11:15 +0100 |
---|---|---|
committer | Nassim Jahnke <[email protected]> | 2024-10-27 18:39:30 +0100 |
commit | 02bca1e6558bf4ac0cbf928d48e90f497b10b0a3 (patch) | |
tree | 1144072e447f4c0b7e80b278fd769106227f016a /patches/server/1032-Void-damage-configuration-API.patch | |
parent | 12ed02105177f54906a7d4422b235929426bc264 (diff) | |
download | Paper-02bca1e6558bf4ac0cbf928d48e90f497b10b0a3.tar.gz Paper-02bca1e6558bf4ac0cbf928d48e90f497b10b0a3.zip |
Remove timings impl
Diffstat (limited to 'patches/server/1032-Void-damage-configuration-API.patch')
-rw-r--r-- | patches/server/1032-Void-damage-configuration-API.patch | 93 |
1 files changed, 93 insertions, 0 deletions
diff --git a/patches/server/1032-Void-damage-configuration-API.patch b/patches/server/1032-Void-damage-configuration-API.patch new file mode 100644 index 0000000000..0bebf02515 --- /dev/null +++ b/patches/server/1032-Void-damage-configuration-API.patch @@ -0,0 +1,93 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Axionize <[email protected]> +Date: Sun, 29 Sep 2024 14:20:42 -0700 +Subject: [PATCH] Void damage configuration API + + +diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java +index 6a0472eaae9ad890692862590b8d23110e48536d..7d16f9935407931823ad3e420f336c7ec69528b2 100644 +--- a/src/main/java/net/minecraft/world/entity/Entity.java ++++ b/src/main/java/net/minecraft/world/entity/Entity.java +@@ -853,8 +853,9 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess + } + + public void checkBelowWorld() { ++ if (!this.level.getWorld().isVoidDamageEnabled()) return; // Paper - check if void damage is enabled on the world + // Paper start - Configurable nether ceiling damage +- if (this.getY() < (double) (this.level.getMinY() - 64) || (this.level.getWorld().getEnvironment() == org.bukkit.World.Environment.NETHER ++ if (this.getY() < (double) (this.level.getMinY() + this.level.getWorld().getVoidDamageMinBuildHeightOffset()) || (this.level.getWorld().getEnvironment() == org.bukkit.World.Environment.NETHER // Paper - use configured min build height offset + && this.level.paperConfig().environment.netherCeilingVoidDamageHeight.test(v -> this.getY() >= v) + && (!(this instanceof Player player) || !player.getAbilities().invulnerable))) { + // Paper end - Configurable nether ceiling damage +diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java +index ceaba7b82e9ff73a14fdef046e63b07c4d0fd5e9..2914be5f6681c513bf2878a92c0c60ad997852dc 100644 +--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java ++++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java +@@ -2700,7 +2700,7 @@ public abstract class LivingEntity extends Entity implements Attackable { + + @Override + protected void onBelowWorld() { +- this.hurt(this.damageSources().fellOutOfWorld(), 4.0F); ++ this.hurt(this.damageSources().fellOutOfWorld(), this.level().getWorld().getVoidDamageAmount()); // Paper - use configured void damage amount + } + + protected void updateSwingTime() { +diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +index 7d360620bd78f28f366815a019c57e5058d9f2a3..6dc3fc701d1e16a51d99f934ea3dc192363a6762 100644 +--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java ++++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +@@ -167,6 +167,41 @@ public class CraftWorld extends CraftRegionAccessor implements World { + private final Object2IntOpenHashMap<SpawnCategory> spawnCategoryLimit = new Object2IntOpenHashMap<>(); + private final CraftPersistentDataContainer persistentDataContainer = new CraftPersistentDataContainer(CraftWorld.DATA_TYPE_REGISTRY); + private net.kyori.adventure.pointer.Pointers adventure$pointers; // Paper - implement pointers ++ // Paper start - void damage configuration ++ private boolean voidDamageEnabled; ++ private float voidDamageAmount; ++ private double voidDamageMinBuildHeightOffset; ++ ++ @Override ++ public boolean isVoidDamageEnabled() { ++ return this.voidDamageEnabled; ++ } ++ ++ @Override ++ public void setVoidDamageEnabled(final boolean enabled) { ++ this.voidDamageEnabled = enabled; ++ } ++ ++ @Override ++ public float getVoidDamageAmount() { ++ return this.voidDamageAmount; ++ } ++ ++ @Override ++ public void setVoidDamageAmount(float voidDamageAmount) { ++ this.voidDamageAmount = voidDamageAmount; ++ } ++ ++ @Override ++ public double getVoidDamageMinBuildHeightOffset() { ++ return this.voidDamageMinBuildHeightOffset; ++ } ++ ++ @Override ++ public void setVoidDamageMinBuildHeightOffset(double minBuildHeightOffset) { ++ this.voidDamageMinBuildHeightOffset = minBuildHeightOffset; ++ } ++ // Paper end - void damage configuration + + // Paper start - Provide fast information methods + @Override +@@ -275,6 +310,12 @@ public class CraftWorld extends CraftRegionAccessor implements World { + } + } + // Paper end - per world spawn limits ++ ++ // Paper start - per world void damage height ++ this.voidDamageEnabled = this.world.paperConfig().environment.voidDamageAmount.enabled(); ++ this.voidDamageMinBuildHeightOffset = this.world.paperConfig().environment.voidDamageMinBuildHeightOffset; ++ this.voidDamageAmount = (float) this.world.paperConfig().environment.voidDamageAmount.or(0); ++ // Paper end - per world void damage height + } + + @Override |