craftbukkit/nms-patches/net/minecraft/world/food/FoodInfo.patch

23 lines
1.2 KiB
Diff
Raw Normal View History

2024-10-23 02:15:00 +11:00
--- a/net/minecraft/world/food/FoodInfo.java
+++ b/net/minecraft/world/food/FoodInfo.java
2025-03-26 03:05:00 +11:00
@@ -19,6 +19,10 @@
2024-10-23 02:15:00 +11:00
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) -> {
2025-03-26 03:05:00 +11:00
@@ -32,7 +36,7 @@
2024-10-23 02:15:00 +11:00
2025-03-26 03:05:00 +11:00
world.playSound((Entity) null, entityliving.getX(), entityliving.getY(), entityliving.getZ(), (SoundEffect) consumable.sound().value(), SoundCategory.NEUTRAL, 1.0F, randomsource.triangle(1.0F, 0.4F));
2024-10-23 02:15:00 +11:00
if (entityliving instanceof EntityHuman entityhuman) {
- entityhuman.getFoodData().eat(this);
+ entityhuman.getFoodData().eat(this, itemstack, (EntityPlayer) entityhuman); // CraftBukkit
2025-03-26 03:05:00 +11:00
world.playSound((Entity) null, entityhuman.getX(), entityhuman.getY(), entityhuman.getZ(), SoundEffects.PLAYER_BURP, SoundCategory.PLAYERS, 0.5F, MathHelper.randomBetween(randomsource, 0.9F, 1.0F));
2024-10-23 02:15:00 +11:00
}