Skip to content

Commit

Permalink
Merged with Master.
Browse files Browse the repository at this point in the history
  • Loading branch information
minheragon12345 committed Jan 3, 2024
1 parent abf33e4 commit da51613
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,14 @@ public class ManasCoreAttributes {
.applyTo(() -> EntityType.PLAYER)
.syncable()
.end();
public static final RegistrySupplier<RangedAttribute> STEP_HEIGHT_ADDITION = ManasCore.REGISTER.attribute("step_height_addition")
public static final RegistrySupplier<RangedAttribute> STEP_HEIGHT_ADDITION = ManasCore.REGISTER.attribute("step_height")
.withDefaultValue(0)
.withMinimumValue(-1024)
.withMaximumValue(1024)
.applyToAll()
.syncable()
.end();
public static final RegistrySupplier<RangedAttribute> SWIM_SPEED = ManasCore.REGISTER.attribute("swim_speed")
public static final RegistrySupplier<RangedAttribute> SWIM_SPEED_ADDITION = ManasCore.REGISTER.attribute("swim_speed")
.withDefaultValue(1)
.withMinimumValue(0)
.withMaximumValue(1024)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,15 @@ public float causeFallDamage(float fallDistance, float multiplier) {
@Inject(method = "jumpInLiquid", at = @At("HEAD"))
protected void jumpInLiquid(TagKey<Fluid> 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));
}

@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));
}
Expand All @@ -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());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit da51613

Please sign in to comment.