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

43 lines
2.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 a6f93d020acff05bcda22293a96e4326edc54c22..5b5b82955e28162bde34d6d8781a6936c61320c8 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -4479,6 +4479,11 @@ public abstract class LivingEntity extends Entity implements Attackable {
public 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
if (foodinfo != null) {
world.playSound((net.minecraft.world.entity.player.Player) null, this.getX(), this.getY(), this.getZ(), this.getEatingSound(stack), SoundSource.NEUTRAL, 1.0F, 1.0F + (world.random.nextFloat() - world.random.nextFloat()) * 0.4F);
diff --git a/src/main/java/net/minecraft/world/food/Foods.java b/src/main/java/net/minecraft/world/food/Foods.java
index 60fd0e89552aeaa78b98dda32caa6766097d3108..7ced9d09ad09b53979214dae57a6347620e55569 100644
--- a/src/main/java/net/minecraft/world/food/Foods.java
+++ b/src/main/java/net/minecraft/world/food/Foods.java
@@ -36,6 +36,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)