0
0
mirror of https://hub.spigotmc.org/stash/scm/spigot/craftbukkit.git synced 2024-11-25 03:26:14 +00:00
craftbukkit/nms-patches/net/minecraft/world/food/FoodInfo.patch
2024-10-23 02:15:00 +11:00

23 lines
1.2 KiB
Diff

--- a/net/minecraft/world/food/FoodInfo.java
+++ b/net/minecraft/world/food/FoodInfo.java
@@ -18,6 +18,10 @@
import net.minecraft.world.item.component.ConsumableListener;
import net.minecraft.world.level.World;
+// CraftBukkit start
+import net.minecraft.server.level.EntityPlayer;
+// CraftBukkit end
+
public record FoodInfo(int nutrition, float saturation, boolean canAlwaysEat) implements ConsumableListener {
public static final Codec<FoodInfo> DIRECT_CODEC = RecordCodecBuilder.create((instance) -> {
@@ -31,7 +35,7 @@
world.playSound((EntityHuman) null, entityliving.getX(), entityliving.getY(), entityliving.getZ(), (SoundEffect) consumable.sound().value(), SoundCategory.NEUTRAL, 1.0F, randomsource.triangle(1.0F, 0.4F));
if (entityliving instanceof EntityHuman entityhuman) {
- entityhuman.getFoodData().eat(this);
+ entityhuman.getFoodData().eat(this, itemstack, (EntityPlayer) entityhuman); // CraftBukkit
world.playSound((EntityHuman) null, entityhuman.getX(), entityhuman.getY(), entityhuman.getZ(), SoundEffects.PLAYER_BURP, SoundCategory.PLAYERS, 0.5F, MathHelper.randomBetween(randomsource, 0.9F, 1.0F));
}