mirror of
https://github.com/Samsuik/Sakura.git
synced 2025-12-23 16:59:16 +00:00
43 lines
2.3 KiB
Diff
43 lines
2.3 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 5da12031d773ec9325bf7c592a1c3c854281da72..4562a9c7327c6981e36cbeda88b53b44f1bbf20b 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
|
@@ -4538,6 +4538,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)
|