Skip to content

Commit

Permalink
Fix Beta 21
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexandra-Myers committed Aug 31, 2023
1 parent 49adeab commit 3e7320e
Showing 1 changed file with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ public void changeAttributes(ServerPlayer reciever) {
for (ClientboundUpdateAttributesPacket.AttributeSnapshot attributeSnapshot : attributes) {
if (attributeSnapshot.getAttribute() == Attributes.ATTACK_SPEED && Combatify.unmoddedPlayers.contains(reciever.getUUID())) {
double speed = calculateValue(attributeSnapshot.getBase(), attributeSnapshot.getModifiers(), attributeSnapshot.getAttribute());
for (double newSpeed = speed - 1.5F; newSpeed > 0; newSpeed -= 0.001F) {
if ((int) (vanillaMath(newSpeed + 1.5F)) == CTSMath(speed - 1.5F) * 2) {
for (double newSpeed = speed - 1.5; newSpeed > 0; newSpeed -= 0.001) {
if (vanillaMath(newSpeed) == CTSMath(speed) * 2) {
if (newSpeed - 2.5 != 0)
modifierMap.put(attributes.indexOf(attributeSnapshot), new AttributeModifier(BASE_ATTACK_SPEED_UUID, "Calculated client modifier", newSpeed - 2.5, AttributeModifier.Operation.ADDITION));
break;
Expand Down Expand Up @@ -81,9 +81,9 @@ private static int CTSMath(double attackSpeed) {
d = 1.0 / d * 20.0 + 0.5;
return (int) (d);
}
private static float vanillaMath(double attackSpeed) {
double d = attackSpeed - 1.5F;
d = 1.0F / d * 20.0F;
return (float) (d);
private static int vanillaMath(double attackSpeed) {
double d = attackSpeed;
d = 1.0 / d * 20.0;
return (int) (d);
}
}

0 comments on commit 3e7320e

Please sign in to comment.