Mirror von
https://github.com/PaperMC/Paper.git
synchronisiert 2024-12-14 10:30:07 +01:00
c6aa61ee18
Updated Upstream (Bukkit/CraftBukkit/Spigot) Upstream has released updates that appear to apply and compile correctly. This update has not been tested by PaperMC and as with ANY update, please do your own testing Bukkit Changes: b9df8e9f SPIGOT-7933: Improve custom Minecart max speed fc496179 Fix InstrumentTest 7c0ec598 PR-1075: Make Art an interface c389f5a4 PR-1074: Make Sound an interface CraftBukkit Changes: df1efc0bb SPIGOT-7945: `Bukkit#dispatchCommand` throws `UnsupportedOperationException` 285df6e85 SPIGOT-7933: Improve custom Minecart max speed a0f3d4e50 SPIGOT-7940: Recipe book errors after reload 9e0618ec2 SPIGOT-7937: Cannot spawn minecart during world generation with minecart_improvements enabled 1eb4d28da SPIGOT-7941: Fix resistance over 4 amplify causing issues in damage 52b99158a PR-1504: Make Art an interface e18ae35f1 PR-1502: Make Sound an interface Spigot Changes: e65d67a7 SPIGOT-7934: Item entities start "bouncing" under certain conditions
94 Zeilen
4.7 KiB
Diff
94 Zeilen
4.7 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Axionize <154778082+Axionize@users.noreply.github.com>
|
|
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 7093a7383c93f172fb7674799d7efe4c563fc99c..ed276c599890d9db11130d8ae0844ca364a824a6 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
|
@@ -854,8 +854,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 99c98a91fe7471791fca8233acf6eeba516b10ed..4836b01323abb125289982ef3ceca09d6a9cfc3b 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
|
@@ -2701,7 +2701,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
|