9
0
mirror of https://github.com/Samsuik/Sakura.git synced 2025-12-28 03:09:07 +00:00
Files
SakuraMC/patches/server/0070-Old-enchanted-golden-apples.patch
2024-12-01 17:09:32 +00:00

48 lines
3.5 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Samsuik <kfian294ma4@gmail.com>
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 659cf60f5a1da5c13ebdf2dc315f538265ba4a39..7cb6e250bd1c14e557c359fe211d8a1f9b4de986 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -4411,7 +4411,13 @@ public abstract class LivingEntity extends Entity {
Item item = stack.getItem();
if (item.isEdible()) {
- List<Pair<MobEffectInstance, Float>> list = item.getFoodProperties().getEffects();
+ // Sakura start - old enchanted golden apple
+ FoodProperties food = item.getFoodProperties();
+ if (this.level.sakuraConfig().players.combat.oldEnchantedGoldenApple && item.getFoodProperties() == net.minecraft.world.food.Foods.ENCHANTED_GOLDEN_APPLE) {
+ food = net.minecraft.world.food.Foods.LEGACY_ENCHANTED_GOLDEN_APPLE;
+ }
+ List<Pair<MobEffectInstance, Float>> list = food.getEffects();
+ // Sakura end - old enchanted golden apple
Iterator iterator = list.iterator();
while (iterator.hasNext()) {
diff --git a/src/main/java/net/minecraft/world/food/Foods.java b/src/main/java/net/minecraft/world/food/Foods.java
index b16d9e2eaa589f19c563ee70b1a56d67dbcdecb0..5c6cec414d8b3f09cfbf9556a0b1c2a5adf5a9b4 100644
--- a/src/main/java/net/minecraft/world/food/Foods.java
+++ b/src/main/java/net/minecraft/world/food/Foods.java
@@ -24,6 +24,17 @@ public class Foods {
public static final FoodProperties COOKIE = (new FoodProperties.Builder()).nutrition(2).saturationMod(0.1F).build();
public static final FoodProperties DRIED_KELP = (new FoodProperties.Builder()).nutrition(1).saturationMod(0.3F).fast().build();
public static final FoodProperties ENCHANTED_GOLDEN_APPLE = (new FoodProperties.Builder()).nutrition(4).saturationMod(1.2F).effect(new MobEffectInstance(MobEffects.REGENERATION, 400, 1), 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, 3), 1.0F).alwaysEat().build();
+ // Sakura start
+ public static final FoodProperties LEGACY_ENCHANTED_GOLDEN_APPLE = new FoodProperties.Builder()
+ .nutrition(4)
+ .saturationMod(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)
+ .alwaysEat()
+ .build();
+ // Sakura end
public static final FoodProperties GOLDEN_APPLE = (new FoodProperties.Builder()).nutrition(4).saturationMod(1.2F).effect(new MobEffectInstance(MobEffects.REGENERATION, 100, 1), 1.0F).effect(new MobEffectInstance(MobEffects.ABSORPTION, 2400, 0), 1.0F).alwaysEat().build();
public static final FoodProperties GOLDEN_CARROT = (new FoodProperties.Builder()).nutrition(6).saturationMod(1.2F).build();
public static final FoodProperties HONEY_BOTTLE = (new FoodProperties.Builder()).nutrition(6).saturationMod(0.1F).build();