Void damage configuration API

This commit is contained in:
Axionize
2024-09-29 14:20:42 -07:00
parent 411498e394
commit 66e26ebe48
3 changed files with 125 additions and 75 deletions

View File

@@ -1356,6 +1356,15 @@
this.setHealth(0.0F);
this.die(this.damageSources().generic());
}
@@ -2083,7 +2704,7 @@
@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() {
@@ -2182,6 +2803,12 @@
public abstract ItemStack getItemBySlot(EquipmentSlot slot);
@@ -1755,7 +1764,7 @@
+ org.bukkit.inventory.EquipmentSlot hand = org.bukkit.craftbukkit.CraftEquipmentSlot.getHand(enumhand);
+ event = new PlayerItemConsumeEvent((Player) this.getBukkitEntity(), craftItem, hand); // Paper
+ this.level().getCraftServer().getPluginManager().callEvent(event);
+
+ if (event.isCancelled()) {
+ // Update client
+ Consumable consumable = this.useItem.get(DataComponents.CONSUMABLE);
@@ -1779,7 +1788,7 @@
+ }
+ // Paper end
+ // CraftBukkit end
+
if (itemstack != this.useItem) {
this.setItemInHand(enumhand, itemstack);
}