From 913ec2c9ceb0b2fd384cb4828f6782f08093f126 Mon Sep 17 00:00:00 2001 From: FlorianMichael Date: Fri, 11 Oct 2024 10:37:27 +0200 Subject: [PATCH] Simplify eating whilst in creative fix --- .../mixin/fixes/minecraft/entity/MixinPlayerEntity.java | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/entity/MixinPlayerEntity.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/entity/MixinPlayerEntity.java index 73b5ae7b..39be9206 100644 --- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/entity/MixinPlayerEntity.java +++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/entity/MixinPlayerEntity.java @@ -31,7 +31,6 @@ import net.minecraft.entity.attribute.EntityAttributes; import net.minecraft.entity.damage.DamageSource; import net.minecraft.entity.effect.StatusEffect; import net.minecraft.entity.effect.StatusEffects; -import net.minecraft.entity.player.HungerManager; import net.minecraft.entity.player.PlayerAbilities; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerInventory; @@ -66,9 +65,6 @@ public abstract class MixinPlayerEntity extends LivingEntity { @Final PlayerInventory inventory; - @Shadow - protected HungerManager hungerManager; - @Unique private static final EntityDimensions viaFabricPlus$sneaking_dimensions_v1_13_2 = EntityDimensions.changing(0.6F, 1.65F).withEyeHeight(1.54F). withAttachments(EntityAttachments.builder().add(EntityAttachmentType.VEHICLE, PlayerEntity.VEHICLE_ATTACHMENT_POS)); @@ -127,8 +123,8 @@ public abstract class MixinPlayerEntity extends LivingEntity { @Inject(method = "canConsume", at = @At("HEAD"), cancellable = true) private void preventEatingFoodInCreative(boolean ignoreHunger, CallbackInfoReturnable cir) { - if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_14_4)) { - cir.setReturnValue(!this.abilities.invulnerable && (ignoreHunger || this.hungerManager.isNotFull())); + if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_14_4) && this.abilities.invulnerable) { + cir.setReturnValue(false); } }