mirror of
https://github.com/Samsuik/Sakura.git
synced 2025-12-28 11:19:08 +00:00
Add legacy combat mechanics
This commit is contained in:
@@ -17,4 +17,8 @@ minecraft net.minecraft.world.level.block.piston.PistonHeadBlock
|
||||
minecraft net.minecraft.world.level.block.LadderBlock
|
||||
minecraft net.minecraft.world.level.block.Blocks
|
||||
minecraft net.minecraft.world.entity.projectile.ProjectileUtil
|
||||
minecraft net.minecraft.world.level.block.CarpetBlock
|
||||
minecraft net.minecraft.world.level.block.CarpetBlock
|
||||
minecraft net.minecraft.world.item.Item
|
||||
minecraft net.minecraft.world.item.SwordItem
|
||||
minecraft net.minecraft.world.item.DiggerItem
|
||||
minecraft net.minecraft.world.food.Foods
|
||||
@@ -647,10 +647,10 @@ index 0000000000000000000000000000000000000000..dd5a70f70c2e7bdc30b8f5655b0b7a08
|
||||
+}
|
||||
diff --git a/src/main/java/me/samsuik/sakura/configuration/WorldConfiguration.java b/src/main/java/me/samsuik/sakura/configuration/WorldConfiguration.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..bfac7683f768fbd27ba7f45cdbf964f1dcd0c174
|
||||
index 0000000000000000000000000000000000000000..c52187c77d1012e8be494c5171915af4d7c202e4
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/me/samsuik/sakura/configuration/WorldConfiguration.java
|
||||
@@ -0,0 +1,204 @@
|
||||
@@ -0,0 +1,217 @@
|
||||
+package me.samsuik.sakura.configuration;
|
||||
+
|
||||
+import com.mojang.logging.LogUtils;
|
||||
@@ -773,6 +773,15 @@ index 0000000000000000000000000000000000000000..bfac7683f768fbd27ba7f45cdbf964f1
|
||||
+
|
||||
+ public Players players;
|
||||
+ public class Players extends ConfigurationPart {
|
||||
+ public Combat combat = new Combat();
|
||||
+ public class Combat extends ConfigurationPart {
|
||||
+ public boolean legacyCombatMechanics = false;
|
||||
+ public boolean allowSweepAttacks = true;
|
||||
+ public boolean shieldDamageReduction = false;
|
||||
+ public boolean oldEnchantedGoldenApple = false;
|
||||
+ public boolean fastHealthRegen = true;
|
||||
+ }
|
||||
+
|
||||
+ public Knockback knockback = new Knockback();
|
||||
+ public class Knockback extends ConfigurationPart {
|
||||
+ public DoubleOr.Default knockbackVertical = DoubleOr.Default.USE_DEFAULT;
|
||||
@@ -790,6 +799,9 @@ index 0000000000000000000000000000000000000000..bfac7683f768fbd27ba7f45cdbf964f1
|
||||
+ public IntOr.Default knockbackDelay = IntOr.Default.USE_DEFAULT;
|
||||
+ }
|
||||
+
|
||||
+ @NestedSetting({"projectiles", "fishing-hooks-apply-knockback"})
|
||||
+ public boolean fishingHooksApplyKnockback;
|
||||
+
|
||||
+ @Comment("Knockback resistance attribute modifier")
|
||||
+ public double knockbackResistanceModifier = 1.0;
|
||||
+ @Comment("Received by attacking a shielded enemy")
|
||||
@@ -798,6 +810,7 @@ index 0000000000000000000000000000000000000000..bfac7683f768fbd27ba7f45cdbf964f1
|
||||
+
|
||||
+ @Comment("Prevents players swimming using elytra or riptide to enter holes")
|
||||
+ public boolean posesShrinkCollisionBox = true;
|
||||
+ public boolean fishingHooksPullEntities = true;
|
||||
+ }
|
||||
+
|
||||
+ public Entity entity;
|
||||
|
||||
@@ -115,3 +115,20 @@ index 74dcfabdc66ef289b8d6a5c6606579b5321af1db..ddf9acf79356d6fff5caa436f6764151
|
||||
}
|
||||
// CraftBukkit end
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/projectile/FishingHook.java b/src/main/java/net/minecraft/world/entity/projectile/FishingHook.java
|
||||
index 91497f5e6c07fcf1b05eca6846c51e1a15ed3bc0..ba906ceb807b21c01cf4d3c0122f626959f6e775 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/projectile/FishingHook.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/projectile/FishingHook.java
|
||||
@@ -298,6 +298,12 @@ public class FishingHook extends Projectile {
|
||||
this.setHookedEntity(entityHitResult.getEntity());
|
||||
}
|
||||
|
||||
+ // Sakura start - configure entity knockback
|
||||
+ if (this.level().sakuraConfig().players.knockback.fishingHooksApplyKnockback) {
|
||||
+ Entity entity = entityHitResult.getEntity();
|
||||
+ entity.hurt(this.damageSources().thrown(this, this.getOwner()), 0.0f);
|
||||
+ }
|
||||
+ // Sakura end - configure entity knockback
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
222
patches/server/0071-Legacy-player-combat-mechanics.patch
Normal file
222
patches/server/0071-Legacy-player-combat-mechanics.patch
Normal file
@@ -0,0 +1,222 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Samsuik <kfian294ma4@gmail.com>
|
||||
Date: Fri, 23 Feb 2024 01:48:08 +0000
|
||||
Subject: [PATCH] Legacy player combat mechanics
|
||||
|
||||
|
||||
diff --git a/src/main/java/me/samsuik/sakura/utils/CombatUtil.java b/src/main/java/me/samsuik/sakura/utils/CombatUtil.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..6cda6ba8e29587fd04b727ef188484760c4ccdbd
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/me/samsuik/sakura/utils/CombatUtil.java
|
||||
@@ -0,0 +1,37 @@
|
||||
+package me.samsuik.sakura.utils;
|
||||
+
|
||||
+import it.unimi.dsi.fastutil.objects.*;
|
||||
+import net.minecraft.core.registries.BuiltInRegistries;
|
||||
+import net.minecraft.world.item.*;
|
||||
+
|
||||
+public final class CombatUtil {
|
||||
+ private static final Reference2FloatMap<Item> LEGACY_ITEM_DAMAGE_MAP = new Reference2FloatOpenHashMap<>();
|
||||
+
|
||||
+ public static float getLegacyItemDamage(Item item) {
|
||||
+ return LEGACY_ITEM_DAMAGE_MAP.getFloat(item);
|
||||
+ }
|
||||
+
|
||||
+ private static float baseToolDamage(TieredItem item) {
|
||||
+ if (item instanceof SwordItem) return 4.0f;
|
||||
+ else if (item instanceof AxeItem) return 3.0f;
|
||||
+ else if (item instanceof PickaxeItem) return 2.0f;
|
||||
+ else if (item instanceof ShovelItem) return 1.0f;
|
||||
+ else return 0.0f;
|
||||
+ }
|
||||
+
|
||||
+ static {
|
||||
+ LEGACY_ITEM_DAMAGE_MAP.defaultReturnValue(Float.MIN_VALUE);
|
||||
+
|
||||
+ for (Item item : BuiltInRegistries.ITEM) {
|
||||
+ if (item instanceof TieredItem tieredItem) {
|
||||
+ LEGACY_ITEM_DAMAGE_MAP.put(item, baseToolDamage(tieredItem) + tieredItem.getTier().getAttackDamageBonus());
|
||||
+ }
|
||||
+
|
||||
+ if (item instanceof HoeItem) {
|
||||
+ LEGACY_ITEM_DAMAGE_MAP.put(item, 0.0f);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ //LEGACY_ITEM_DAMAGE_MAP.put(Items.TRIDENT, LEGACY_ITEM_DAMAGE_MAP.getFloat(Items.DIAMOND_SWORD));
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
index 9fa79ba7f50fa20f3794fd955db1a4cc0fa8ee02..532fef2f50a0904a7c64bac30aa61dc71fcfc7dd 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
@@ -276,6 +276,64 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
++this.noActionTime; // Above all the floats
|
||||
}
|
||||
// Spigot end
|
||||
+ // Sakura start - legacy combat mechanics
|
||||
+ private static final UUID LEGACY_COMBAT_MECHANICS_UUID = UUID.fromString("84ef96f8-9f48-4ae4-a26c-e04551324816");
|
||||
+ private static final AttributeModifier LEGACY_ATTACK_SPEED_MODIFIER = new AttributeModifier(LEGACY_COMBAT_MECHANICS_UUID, "Legacy attack speed", 100.0, AttributeModifier.Operation.ADDITION);
|
||||
+
|
||||
+ private void updateAttackSpeedModifier() {
|
||||
+ AttributeInstance attackSpeed = this.getAttribute(Attributes.ATTACK_SPEED);
|
||||
+ if (attackSpeed != null) {
|
||||
+ attackSpeed.removeModifier(LEGACY_ATTACK_SPEED_MODIFIER);
|
||||
+
|
||||
+ if (this.level().sakuraConfig().players.combat.legacyCombatMechanics) {
|
||||
+ attackSpeed.addTransientModifier(LEGACY_ATTACK_SPEED_MODIFIER);
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ protected final float getAttackDamageFromAttributes() {
|
||||
+ AttributeInstance attackDamage = this.getAttribute(Attributes.ATTACK_DAMAGE);
|
||||
+ AttributeModifier legacyModifier = null;
|
||||
+
|
||||
+ if (this.level().sakuraConfig().players.combat.legacyCombatMechanics) {
|
||||
+ legacyModifier = this.getLegacyAttackModifier();
|
||||
+ }
|
||||
+
|
||||
+ final double damage;
|
||||
+ if (attackDamage == null || legacyModifier == null) {
|
||||
+ damage = this.getAttributeValue(Attributes.ATTACK_DAMAGE);
|
||||
+ } else {
|
||||
+ attackDamage.addTransientModifier(legacyModifier);
|
||||
+ damage = this.getAttributeValue(Attributes.ATTACK_DAMAGE);
|
||||
+ attackDamage.removeModifier(legacyModifier);
|
||||
+ }
|
||||
+
|
||||
+ return (float) damage;
|
||||
+ }
|
||||
+
|
||||
+ private @Nullable AttributeModifier getLegacyAttackModifier() {
|
||||
+ ItemStack itemstack = this.getLastHandItem(EquipmentSlot.MAINHAND);
|
||||
+ qt: if (!itemstack.hasTag() || !itemstack.getTag().contains("AttributeModifiers", 9)) {
|
||||
+ Collection<AttributeModifier> defaultModifiers = itemstack.getAttributeModifiers(EquipmentSlot.MAINHAND).get(Attributes.ATTACK_DAMAGE);
|
||||
+ double baseAttack = 0.0f;
|
||||
+ for (AttributeModifier mod : defaultModifiers) {
|
||||
+ if (mod.getOperation() != AttributeModifier.Operation.ADDITION) {
|
||||
+ break qt;
|
||||
+ }
|
||||
+
|
||||
+ baseAttack += mod.getAmount();
|
||||
+ }
|
||||
+
|
||||
+ float legacyAttack = me.samsuik.sakura.utils.CombatUtil.getLegacyItemDamage(itemstack.getItem());
|
||||
+ double attackDifference = (double) legacyAttack - baseAttack;
|
||||
+
|
||||
+ if (baseAttack != 0.0f && legacyAttack != Float.MIN_VALUE) {
|
||||
+ return new AttributeModifier(LEGACY_COMBAT_MECHANICS_UUID, "Legacy attack damage", attackDifference, AttributeModifier.Operation.ADDITION);
|
||||
+ }
|
||||
+ }
|
||||
+ return null;
|
||||
+ }
|
||||
+ // Sakura end - legacy combat mechanics
|
||||
|
||||
protected LivingEntity(EntityType<? extends LivingEntity> type, Level world) {
|
||||
super(type, world);
|
||||
@@ -2145,7 +2203,16 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
protected float getDamageAfterArmorAbsorb(DamageSource source, float amount) {
|
||||
if (!source.is(DamageTypeTags.BYPASSES_ARMOR)) {
|
||||
// this.hurtArmor(damagesource, f); // CraftBukkit - Moved into actuallyHurt(DamageSource, float)
|
||||
+ // Sakura start - legacy combat mechanics
|
||||
+ if (!this.level().sakuraConfig().players.combat.legacyCombatMechanics) {
|
||||
amount = CombatRules.getDamageAfterAbsorb(amount, (float) this.getArmorValue(), (float) this.getAttributeValue(Attributes.ARMOR_TOUGHNESS));
|
||||
+ } else {
|
||||
+ // See: applyArmorModifier(DamageSource, float)
|
||||
+ int i = 25 - this.getArmorValue();
|
||||
+ float f1 = amount * (float) i;
|
||||
+ amount = f1 / 25.0F;
|
||||
+ }
|
||||
+ // Sakura end - legacy combat mechanics
|
||||
}
|
||||
|
||||
return amount;
|
||||
@@ -3201,6 +3268,12 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
if (!itemstack1.isEmpty()) {
|
||||
this.getAttributes().addTransientAttributeModifiers(itemstack1.getAttributeModifiers(enumitemslot));
|
||||
}
|
||||
+
|
||||
+ // Sakura start - legacy combat mechanics
|
||||
+ if (this instanceof ServerPlayer && enumitemslot == EquipmentSlot.MAINHAND) {
|
||||
+ this.updateAttackSpeedModifier();
|
||||
+ }
|
||||
+ // Sakura end - legacy combat mechanics
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3354,7 +3427,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
this.lastArmorItemStacks.set(slot.getIndex(), armor);
|
||||
}
|
||||
|
||||
- private ItemStack getLastHandItem(EquipmentSlot slot) {
|
||||
+ protected ItemStack getLastHandItem(EquipmentSlot slot) { // Sakura - legacy combat mechanics
|
||||
return (ItemStack) this.lastHandItemStacks.get(slot.getIndex());
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/player/Player.java b/src/main/java/net/minecraft/world/entity/player/Player.java
|
||||
index 8493566fec47ecef3fd7423b993d9e6e378df7e5..7f2b778706bdc1d24b97c53ac9278439a4a03d36 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/player/Player.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/player/Player.java
|
||||
@@ -1255,7 +1255,7 @@ public abstract class Player extends LivingEntity {
|
||||
if (playerAttackEntityEvent.callEvent() && willAttack) { // Logic moved to willAttack local variable.
|
||||
{
|
||||
// Paper end - PlayerAttackEntityEvent
|
||||
- float f = (float) this.getAttributeValue(Attributes.ATTACK_DAMAGE);
|
||||
+ float f = this.getAttackDamageFromAttributes(); // Sakura - legacy combat mechanics
|
||||
float f1;
|
||||
|
||||
if (target instanceof LivingEntity) {
|
||||
@@ -1266,8 +1266,14 @@ public abstract class Player extends LivingEntity {
|
||||
|
||||
float f2 = this.getAttackStrengthScale(0.5F);
|
||||
|
||||
+ // Sakura start - legacy combat mechanics
|
||||
+ if (!this.level().sakuraConfig().players.combat.legacyCombatMechanics) {
|
||||
f *= 0.2F + f2 * f2 * 0.8F;
|
||||
f1 *= f2;
|
||||
+ } else if (f1 != 0.0) {
|
||||
+ f1 += this.calculateLegacySharpnessDamage();
|
||||
+ }
|
||||
+ // Sakura end - legacy combat mechanics
|
||||
// this.resetAttackCooldown(); // CraftBukkit - Moved to EntityLiving to reset the cooldown after the damage is dealt
|
||||
if (f > 0.0F || f1 > 0.0F) {
|
||||
boolean flag = f2 > 0.9F;
|
||||
@@ -1284,7 +1290,7 @@ public abstract class Player extends LivingEntity {
|
||||
boolean flag2 = flag && this.fallDistance > 0.0F && !this.onGround() && !this.onClimbable() && !this.isInWater() && !this.hasEffect(MobEffects.BLINDNESS) && !this.isPassenger() && target instanceof LivingEntity; // Paper - Add critical damage API; diff on change
|
||||
|
||||
flag2 = flag2 && !this.level().paperConfig().entities.behavior.disablePlayerCrits; // Paper - Toggleable player crits
|
||||
- flag2 = flag2 && !this.isSprinting();
|
||||
+ flag2 = flag2 && (this.level().sakuraConfig().players.combat.legacyCombatMechanics || !this.isSprinting()); // Sakura - legacy combat mechanics
|
||||
if (flag2) {
|
||||
f *= 1.5F;
|
||||
}
|
||||
@@ -1476,6 +1482,27 @@ public abstract class Player extends LivingEntity {
|
||||
}
|
||||
}
|
||||
|
||||
+ // Sakura start - legacy combat mechanics
|
||||
+ private float calculateLegacySharpnessDamage() {
|
||||
+ ItemStack itemstack = this.getMainHandItem();
|
||||
+ Map<net.minecraft.world.item.enchantment.Enchantment, Integer> enchantments = EnchantmentHelper.getEnchantments(itemstack);
|
||||
+
|
||||
+ float legacy = 0.0f;
|
||||
+ float modern = 0.0f;
|
||||
+
|
||||
+ for (Map.Entry<net.minecraft.world.item.enchantment.Enchantment, Integer> entry : enchantments.entrySet()) {
|
||||
+ if (entry.getKey() instanceof net.minecraft.world.item.enchantment.DamageEnchantment dmgEnchant && dmgEnchant.type == 0) {
|
||||
+ // sharpness:
|
||||
+ int level = entry.getValue();
|
||||
+ legacy += (float) level * 1.25F;
|
||||
+ modern += dmgEnchant.getDamageBonus(level, MobType.UNDEFINED);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ return legacy - modern;
|
||||
+ }
|
||||
+ // Sakura end - legacy combat mechanics
|
||||
+
|
||||
@Override
|
||||
protected void doAutoAttackOnTouch(LivingEntity target) {
|
||||
this.attack(target);
|
||||
19
patches/server/0072-Allow-disabling-sweep-attacks.patch
Normal file
19
patches/server/0072-Allow-disabling-sweep-attacks.patch
Normal file
@@ -0,0 +1,19 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Samsuik <kfian294ma4@gmail.com>
|
||||
Date: Fri, 23 Feb 2024 01:49:20 +0000
|
||||
Subject: [PATCH] Allow disabling sweep attacks
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/player/Player.java b/src/main/java/net/minecraft/world/entity/player/Player.java
|
||||
index cef878d0876cf5eef8ce4bf220b50d21f64ad597..b613a0843a6a71ad80bdedb407d0402ec788a6f3 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/player/Player.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/player/Player.java
|
||||
@@ -1361,7 +1361,7 @@ public abstract class Player extends LivingEntity {
|
||||
// Paper end - Configurable sprint interruption on attack
|
||||
}
|
||||
|
||||
- if (flag3) {
|
||||
+ if (flag3 && this.level().sakuraConfig().players.combat.allowSweepAttacks) { // Sakura - allow disabling sweep attacks
|
||||
float f4 = 1.0F + EnchantmentHelper.getSweepingDamageRatio(this) * f;
|
||||
List<LivingEntity> list = this.level().getEntitiesOfClass(LivingEntity.class, target.getBoundingBox().inflate(1.0D, 0.25D, 1.0D));
|
||||
Iterator iterator = list.iterator();
|
||||
24
patches/server/0073-Change-shields-to-reduce-damage.patch
Normal file
24
patches/server/0073-Change-shields-to-reduce-damage.patch
Normal file
@@ -0,0 +1,24 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Samsuik <kfian294ma4@gmail.com>
|
||||
Date: Fri, 23 Feb 2024 02:07:03 +0000
|
||||
Subject: [PATCH] Change shields to reduce damage
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
index 532fef2f50a0904a7c64bac30aa61dc71fcfc7dd..0adf993b1b03b4e68d83e67872c0f592c2d7c91f 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
@@ -2279,7 +2279,13 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
Function<Double, Double> blocking = new Function<Double, Double>() {
|
||||
@Override
|
||||
public Double apply(Double f) {
|
||||
+ // Sakura start - shield damage reduction
|
||||
+ if (!level().sakuraConfig().players.combat.shieldDamageReduction || damagesource.getDirectEntity() instanceof AbstractArrow) {
|
||||
return -((LivingEntity.this.isDamageSourceBlocked(damagesource)) ? f : 0.0);
|
||||
+ } else {
|
||||
+ return -(LivingEntity.this.isBlocking() ? f * 0.5 : 0.0);
|
||||
+ }
|
||||
+ // Sakura end - shield damage reduction
|
||||
}
|
||||
};
|
||||
float blockingModifier = blocking.apply((double) f).floatValue();
|
||||
45
patches/server/0074-Old-enchanted-golden-apples.patch
Normal file
45
patches/server/0074-Old-enchanted-golden-apples.patch
Normal file
@@ -0,0 +1,45 @@
|
||||
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 0adf993b1b03b4e68d83e67872c0f592c2d7c91f..99bc5f6665524dfb42d7e7dd3f71fb45147b3b58 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
@@ -4523,7 +4523,13 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
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 4569cf30b33167a415256a8542820557ad38f89e..2851125fcb2c2ddade0d82b9a3d303c069a1a06f 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)
|
||||
.alwaysEat()
|
||||
.build();
|
||||
+ 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();
|
||||
public static final FoodProperties GOLDEN_APPLE = new FoodProperties.Builder()
|
||||
.nutrition(4)
|
||||
.saturationMod(1.2F)
|
||||
19
patches/server/0075-Configure-fast-health-regen.patch
Normal file
19
patches/server/0075-Configure-fast-health-regen.patch
Normal file
@@ -0,0 +1,19 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Samsuik <kfian294ma4@gmail.com>
|
||||
Date: Thu, 6 Jun 2024 18:18:28 +0100
|
||||
Subject: [PATCH] Configure fast health regen
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/food/FoodData.java b/src/main/java/net/minecraft/world/food/FoodData.java
|
||||
index c3448707fd8a632b457cc97b35d08a9c6933d5ee..4c7e4c463167ab17ff15236e08b84d7ef317c38d 100644
|
||||
--- a/src/main/java/net/minecraft/world/food/FoodData.java
|
||||
+++ b/src/main/java/net/minecraft/world/food/FoodData.java
|
||||
@@ -78,7 +78,7 @@ public class FoodData {
|
||||
|
||||
boolean flag = player.level().getGameRules().getBoolean(GameRules.RULE_NATURAL_REGENERATION);
|
||||
|
||||
- if (flag && this.saturationLevel > 0.0F && player.isHurt() && this.foodLevel >= 20) {
|
||||
+ if (flag && this.saturationLevel > 0.0F && player.isHurt() && this.foodLevel >= 20 && player.level().sakuraConfig().players.combat.fastHealthRegen) { // Sakura - configure fast health regen
|
||||
++this.tickTimer;
|
||||
if (this.tickTimer >= this.saturatedRegenRate) { // CraftBukkit
|
||||
float f = Math.min(this.saturationLevel, 6.0F);
|
||||
@@ -0,0 +1,19 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Samsuik <kfian294ma4@gmail.com>
|
||||
Date: Thu, 6 Jun 2024 20:34:29 +0100
|
||||
Subject: [PATCH] Add option for fishing hooks pulling entities
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/projectile/FishingHook.java b/src/main/java/net/minecraft/world/entity/projectile/FishingHook.java
|
||||
index ba906ceb807b21c01cf4d3c0122f626959f6e775..075a3b7ae760e73ef5674de80b6e37b5158f3e43 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/projectile/FishingHook.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/projectile/FishingHook.java
|
||||
@@ -598,7 +598,7 @@ public class FishingHook extends Projectile {
|
||||
public void pullEntity(Entity entity) {
|
||||
Entity entity1 = this.getOwner();
|
||||
|
||||
- if (entity1 != null) {
|
||||
+ if (entity1 != null && (this.level().sakuraConfig().players.fishingHooksPullEntities || entity instanceof ItemEntity)) { // Sakura - Add option for fishing hooks pulling entities
|
||||
Vec3 vec3d = (new Vec3(entity1.getX() - this.getX(), entity1.getY() - this.getY(), entity1.getZ() - this.getZ())).scale(0.1D);
|
||||
|
||||
entity.setDeltaMovement(entity.getDeltaMovement().add(vec3d));
|
||||
Reference in New Issue
Block a user