9
0
mirror of https://github.com/LeavesMC/Leaves.git synced 2025-12-19 14:59:32 +00:00
Files
LeavesMC/leaves-api/paper-patches/features/0008-Fix-SculkCatalyst-exp-skip.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

94 lines
3.6 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: violetc <58360096+s-yh-china@users.noreply.github.com>
Date: Sun, 6 Apr 2025 10:42:47 +0800
Subject: [PATCH] Fix SculkCatalyst exp skip
diff --git a/src/main/java/org/bukkit/event/entity/EntityDeathEvent.java b/src/main/java/org/bukkit/event/entity/EntityDeathEvent.java
index 76c08499b704a6cb0cb95ce69b9a9248d69cc127..316bbf8c95e4803190897d66a0c7d8b4316f4164 100644
--- a/src/main/java/org/bukkit/event/entity/EntityDeathEvent.java
+++ b/src/main/java/org/bukkit/event/entity/EntityDeathEvent.java
@@ -28,6 +28,8 @@ public class EntityDeathEvent extends EntityEvent implements Cancellable {
private float deathSoundVolume;
private float deathSoundPitch;
+ private int rewardExp; // Leaves - exp fix
+
private boolean cancelled;
@ApiStatus.Internal
@@ -37,12 +39,19 @@ public class EntityDeathEvent extends EntityEvent implements Cancellable {
@ApiStatus.Internal
public EntityDeathEvent(@NotNull final LivingEntity livingEntity, @NotNull DamageSource damageSource, @NotNull final List<ItemStack> drops, final int droppedExp) {
+ // Leaves start - exp fix
+ this(livingEntity, damageSource, drops, droppedExp, droppedExp);
+ }
+
+ @ApiStatus.Internal
+ public EntityDeathEvent(@NotNull final LivingEntity livingEntity, @NotNull DamageSource damageSource, @NotNull final List<ItemStack> drops, final int droppedExp, final int rewardExp) {
super(livingEntity);
this.damageSource = damageSource;
this.drops = drops;
this.dropExp = droppedExp;
+ this.rewardExp = rewardExp;
}
-
+ // Leaves end - exp fix
@NotNull
@Override
public LivingEntity getEntity() {
@@ -81,6 +90,7 @@ public class EntityDeathEvent extends EntityEvent implements Cancellable {
*/
public void setDroppedExp(int exp) {
this.dropExp = exp;
+ this.rewardExp = exp; // Leaves - exp fix
}
/**
@@ -210,6 +220,16 @@ public class EntityDeathEvent extends EntityEvent implements Cancellable {
this.deathSoundPitch = pitch;
}
+ // Leaves start - exp fix
+ public int getRewardExp() {
+ return rewardExp;
+ }
+
+ public void setRewardExp(int rewardExp) {
+ this.rewardExp = rewardExp;
+ }
+ // Leaves end - exp fix
+
@Override
public boolean isCancelled() {
return this.cancelled;
diff --git a/src/main/java/org/bukkit/event/entity/PlayerDeathEvent.java b/src/main/java/org/bukkit/event/entity/PlayerDeathEvent.java
index 6316a2f1d2dc0314397e33e6dbd354fb8bc50541..16d4e3d42710be5eb87372d31c0ea9935d441de0 100644
--- a/src/main/java/org/bukkit/event/entity/PlayerDeathEvent.java
+++ b/src/main/java/org/bukkit/event/entity/PlayerDeathEvent.java
@@ -23,6 +23,7 @@ public class PlayerDeathEvent extends EntityDeathEvent {
private Component deathMessage;
private Component deathScreenMessageOverride = null;
private boolean doExpDrop;
+ private boolean useApiExpDropStatus = false; // Leaves - exp fix
private boolean keepLevel = false;
private boolean keepInventory = false;
@Deprecated
@@ -82,8 +83,15 @@ public class PlayerDeathEvent extends EntityDeathEvent {
this.showDeathMessages = true;
this.deathMessage = LegacyComponentSerializer.legacySection().deserializeOrNull(deathMessage);
this.doExpDrop = doExpDrop;
+ this.useApiExpDropStatus = true; // Leaves - exp fix
}
+ // Leaves start - exp fix
+ public boolean forceUseEventDropStatus() {
+ return this.useApiExpDropStatus;
+ }
+ // Leaves end - exp fix
+
@NotNull
@Override
public Player getEntity() {