0
0
mirror of https://hub.spigotmc.org/stash/scm/spigot/craftbukkit.git synced 2024-11-22 10:06:16 +00:00
craftbukkit/nms-patches/net/minecraft/world/item/consume_effects/ConsumeEffect.patch
2024-10-23 02:15:00 +11:00

31 lines
1.2 KiB
Diff

--- a/net/minecraft/world/item/consume_effects/ConsumeEffect.java
+++ b/net/minecraft/world/item/consume_effects/ConsumeEffect.java
@@ -12,6 +12,10 @@
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.World;
+// CraftBukkit start
+import org.bukkit.event.entity.EntityPotionEffectEvent;
+// CraftBukkit end
+
public interface ConsumeEffect {
Codec<ConsumeEffect> CODEC = BuiltInRegistries.CONSUME_EFFECT_TYPE.byNameCodec().dispatch(ConsumeEffect::getType, ConsumeEffect.a::codec);
@@ -19,7 +23,15 @@
ConsumeEffect.a<? extends ConsumeEffect> getType();
- boolean apply(World world, ItemStack itemstack, EntityLiving entityliving);
+ // CraftBukkit start
+ default boolean apply(World world, ItemStack itemstack, EntityLiving entityliving) {
+ return this.apply(world, itemstack, entityliving, EntityPotionEffectEvent.Cause.UNKNOWN);
+ }
+
+ default boolean apply(World world, ItemStack itemstack, EntityLiving entityliving, EntityPotionEffectEvent.Cause cause) {
+ return this.apply(world, itemstack, entityliving);
+ }
+ // CraftBukkit end
public static record a<T extends ConsumeEffect>(MapCodec<T> codec, StreamCodec<RegistryFriendlyByteBuf, T> streamCodec) {