mirror of
https://hub.spigotmc.org/stash/scm/spigot/craftbukkit.git
synced 2025-02-16 19:15:59 +00:00
32 lines
1.3 KiB
Diff
32 lines
1.3 KiB
Diff
--- a/net/minecraft/world/item/consume_effects/ApplyStatusEffectsConsumeEffect.java
|
|
+++ b/net/minecraft/world/item/consume_effects/ApplyStatusEffectsConsumeEffect.java
|
|
@@ -13,6 +13,10 @@
|
|
import net.minecraft.world.item.ItemStack;
|
|
import net.minecraft.world.level.World;
|
|
|
|
+// CraftBukkit start
|
|
+import org.bukkit.event.entity.EntityPotionEffectEvent;
|
|
+// CraftBukkit end
|
|
+
|
|
public record ApplyStatusEffectsConsumeEffect(List<MobEffect> effects, float probability) implements ConsumeEffect {
|
|
|
|
public static final MapCodec<ApplyStatusEffectsConsumeEffect> CODEC = RecordCodecBuilder.mapCodec((instance) -> {
|
|
@@ -38,7 +42,7 @@
|
|
}
|
|
|
|
@Override
|
|
- public boolean apply(World world, ItemStack itemstack, EntityLiving entityliving) {
|
|
+ public boolean apply(World world, ItemStack itemstack, EntityLiving entityliving, EntityPotionEffectEvent.Cause cause) { // CraftBukkit
|
|
if (entityliving.getRandom().nextFloat() >= this.probability) {
|
|
return false;
|
|
} else {
|
|
@@ -48,7 +52,7 @@
|
|
while (iterator.hasNext()) {
|
|
MobEffect mobeffect = (MobEffect) iterator.next();
|
|
|
|
- if (entityliving.addEffect(new MobEffect(mobeffect))) {
|
|
+ if (entityliving.addEffect(new MobEffect(mobeffect), cause)) { // CraftBukkit
|
|
flag = true;
|
|
}
|
|
}
|