Skip to content

Commit

Permalink
feat(1.20.1-forged): add #55
Browse files Browse the repository at this point in the history
when sprinting, you speed boost work
  • Loading branch information
cnlimiter committed Apr 5, 2024
1 parent 0354f96 commit c77f8fb
Showing 1 changed file with 8 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import committee.nova.mods.avaritia.util.AbilityUtil;
import committee.nova.mods.avaritia.util.PlayerUtil;
import net.minecraft.server.level.ServerPlayer;
import net.minecraft.util.Mth;
import net.minecraft.world.effect.MobEffectInstance;
import net.minecraft.world.effect.MobEffects;
import net.minecraft.world.entity.LivingEntity;
Expand Down Expand Up @@ -156,6 +157,12 @@ private static void handleBootsStateChange(Player player, String key, boolean ha
player.moveRelative(speed * 0.45f * Math.signum(player.xxa), new Vec3(1, 0, 0));
}
}

if (player.isSprinting()) {
float f = player.getYRot() * ((float)Math.PI / 180F);
player.setDeltaMovement(player.getDeltaMovement().add(-Mth.sin(f) * 0.2F, 0.0D, Mth.cos(f) * 0.2F));
}

} else {
entitiesWithBoots.add(key);
}
Expand Down Expand Up @@ -225,16 +232,10 @@ public static void onEntityDeath(LivingDeathEvent event) {

private static void stripAbilities(Player player) {
String key = player.getGameProfile().getName() + ":" + player.level().isClientSide;

entitiesWithHelmets.remove(key);

entitiesWithFlight.remove(key);

entitiesWithLeggings.remove(key);

if (entitiesWithBoots.remove(key)) {
player.setMaxUpStep(0.5F);
}
entitiesWithBoots.remove(key);
}


Expand Down

0 comments on commit c77f8fb

Please sign in to comment.