From da516135e7e74113d587b38bb5ef36d1d3f902b2 Mon Sep 17 00:00:00 2001 From: Minh Date: Thu, 4 Jan 2024 01:34:56 +0700 Subject: [PATCH] Merged with Master. --- .../manasmods/manascore/attribute/ManasCoreAttributes.java | 4 ++-- .../github/manasmods/manascore/core/MixinLivingEntity.java | 6 +++--- .../com/github/manasmods/manascore/core/MixinPlayer.java | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/common/src/main/java/com/github/manasmods/manascore/attribute/ManasCoreAttributes.java b/common/src/main/java/com/github/manasmods/manascore/attribute/ManasCoreAttributes.java index 278c2fe3..c75a8af6 100644 --- a/common/src/main/java/com/github/manasmods/manascore/attribute/ManasCoreAttributes.java +++ b/common/src/main/java/com/github/manasmods/manascore/attribute/ManasCoreAttributes.java @@ -48,14 +48,14 @@ public class ManasCoreAttributes { .applyTo(() -> EntityType.PLAYER) .syncable() .end(); - public static final RegistrySupplier STEP_HEIGHT_ADDITION = ManasCore.REGISTER.attribute("step_height_addition") + public static final RegistrySupplier STEP_HEIGHT_ADDITION = ManasCore.REGISTER.attribute("step_height") .withDefaultValue(0) .withMinimumValue(-1024) .withMaximumValue(1024) .applyToAll() .syncable() .end(); - public static final RegistrySupplier SWIM_SPEED = ManasCore.REGISTER.attribute("swim_speed") + public static final RegistrySupplier SWIM_SPEED_ADDITION = ManasCore.REGISTER.attribute("swim_speed") .withDefaultValue(1) .withMinimumValue(0) .withMaximumValue(1024) diff --git a/common/src/main/java/com/github/manasmods/manascore/core/MixinLivingEntity.java b/common/src/main/java/com/github/manasmods/manascore/core/MixinLivingEntity.java index 52014464..a84967ff 100644 --- a/common/src/main/java/com/github/manasmods/manascore/core/MixinLivingEntity.java +++ b/common/src/main/java/com/github/manasmods/manascore/core/MixinLivingEntity.java @@ -41,7 +41,7 @@ public float causeFallDamage(float fallDistance, float multiplier) { @Inject(method = "jumpInLiquid", at = @At("HEAD")) protected void jumpInLiquid(TagKey fluidTag, CallbackInfo ci) { LivingEntity entity = (LivingEntity) (Object) this; - AttributeInstance instance = entity.getAttribute(ManasCoreAttributes.SWIM_SPEED.get()); + AttributeInstance instance = entity.getAttribute(ManasCoreAttributes.SWIM_SPEED_ADDITION.get()); if (instance == null) return; entity.setDeltaMovement(entity.getDeltaMovement().add(0.0, 0.04 * instance.getValue() - 0.04, 0.0)); } @@ -49,7 +49,7 @@ protected void jumpInLiquid(TagKey fluidTag, CallbackInfo ci) { @Inject(method = "goDownInWater", at = @At("HEAD")) protected void goDownInWater(CallbackInfo ci) { LivingEntity entity = (LivingEntity) (Object) this; - AttributeInstance instance = entity.getAttribute(ManasCoreAttributes.SWIM_SPEED.get()); + AttributeInstance instance = entity.getAttribute(ManasCoreAttributes.SWIM_SPEED_ADDITION.get()); if (instance == null) return; entity.setDeltaMovement(entity.getDeltaMovement().add(0.0, 0.04 - 0.04 * instance.getValue(), 0.0)); } @@ -58,7 +58,7 @@ protected void goDownInWater(CallbackInfo ci) { target = "Lnet/minecraft/world/entity/LivingEntity;moveRelative(FLnet/minecraft/world/phys/Vec3;)V", ordinal = 0)) public float travel(float speed) { LivingEntity entity = (LivingEntity) (Object) this; - AttributeInstance instance = entity.getAttribute(ManasCoreAttributes.SWIM_SPEED.get()); + AttributeInstance instance = entity.getAttribute(ManasCoreAttributes.SWIM_SPEED_ADDITION.get()); if (instance == null) return speed; return (float) (speed * instance.getValue()); } diff --git a/common/src/main/java/com/github/manasmods/manascore/core/MixinPlayer.java b/common/src/main/java/com/github/manasmods/manascore/core/MixinPlayer.java index 4c0179c1..e3597992 100644 --- a/common/src/main/java/com/github/manasmods/manascore/core/MixinPlayer.java +++ b/common/src/main/java/com/github/manasmods/manascore/core/MixinPlayer.java @@ -38,7 +38,7 @@ private float getCritMultiplier(float multiplier) { @Redirect(method = "attack", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/entity/player/Player;distanceToSqr(Lnet/minecraft/world/entity/Entity;)D")) - private double getBlockInteractDistance(Player player, Entity entity) { + private double sweepDistanceCheck(Player player, Entity entity) { double reach = ManasCoreAttributeUtils.getEntityReachAddition(player); double reachSquared = reach * reach * (reach < 0 ? -1 : 1); return player.distanceToSqr(entity) - reachSquared;