From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Samsuik Date: Fri, 23 Feb 2024 14:40:32 +0000 Subject: [PATCH] Old enchanted golden apples diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java index 2f7e51b1509d3db78ed8dbd073e2f9ded820390b..a4b59cb05111aed52758061c314aafc56d75dc2d 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java @@ -4571,6 +4571,11 @@ public abstract class LivingEntity extends Entity implements Attackable { public final ItemStack eat(Level world, ItemStack stack) { FoodProperties foodinfo = (FoodProperties) stack.get(DataComponents.FOOD); + // Sakura start - old enchanted golden apple + if (this.level().sakuraConfig().players.combat.oldEnchantedGoldenApple && foodinfo == net.minecraft.world.food.Foods.ENCHANTED_GOLDEN_APPLE) { + foodinfo = net.minecraft.world.food.Foods.LEGACY_ENCHANTED_GOLDEN_APPLE; + } + // Sakura end - old enchanted golden apple return foodinfo != null ? this.eat(world, stack, foodinfo) : stack; } diff --git a/src/main/java/net/minecraft/world/food/Foods.java b/src/main/java/net/minecraft/world/food/Foods.java index e13d9ed48431b019b1f68aae315af74cec34fcee..c2e113016b233377f6e8b032336707a4c1b001f5 100644 --- a/src/main/java/net/minecraft/world/food/Foods.java +++ b/src/main/java/net/minecraft/world/food/Foods.java @@ -37,6 +37,15 @@ public class Foods { .effect(new MobEffectInstance(MobEffects.ABSORPTION, 2400, 3), 1.0F) .alwaysEdible() .build(); + public static final FoodProperties LEGACY_ENCHANTED_GOLDEN_APPLE = new FoodProperties.Builder() + .nutrition(4) + .saturationModifier(1.2F) + .effect(new MobEffectInstance(MobEffects.REGENERATION, 600, 4), 1.0F) + .effect(new MobEffectInstance(MobEffects.DAMAGE_RESISTANCE, 6000, 0), 1.0F) + .effect(new MobEffectInstance(MobEffects.FIRE_RESISTANCE, 6000, 0), 1.0F) + .effect(new MobEffectInstance(MobEffects.ABSORPTION, 2400, 0), 1.0F) + .alwaysEdible() + .build(); public static final FoodProperties GOLDEN_APPLE = new FoodProperties.Builder() .nutrition(4) .saturationModifier(1.2F)