Fix food component not being updated correctly

This commit is contained in:
Sollace 2023-11-25 21:01:07 +00:00
parent c8dc41a68e
commit e44347e8ed
No known key found for this signature in database
GPG key ID: E52FACE7B5C773DB

View file

@ -58,6 +58,8 @@ abstract class MixinItem implements ItemDuck {
@Inject(method = "use", at = @At("HEAD"), cancellable = true)
private void use(World world, PlayerEntity user, Hand hand, CallbackInfoReturnable<TypedActionResult<ItemStack>> info) {
// ensure the food component is updated before attempting to use
getToxic(user.getStackInHand(hand), user);
TypedActionResult<ItemStack> result = FoodPoisoningStatusEffect.apply(this, user, hand);
if (result.getResult() != ActionResult.PASS) {
info.setReturnValue(result);