Skip to content

Commit

Permalink
Stop using TrigMath class (GeyserMC#753)
Browse files Browse the repository at this point in the history
* Stop using TrigMath class

* Use MathUtils
  • Loading branch information
Heath123 authored Jun 9, 2020
1 parent 891490a commit 6e127ed
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@
import com.github.steveice10.packetlib.packet.Packet;
import com.github.steveice10.packetlib.tcp.TcpSessionFactory;
import com.nukkitx.math.GenericMath;
import com.nukkitx.math.TrigMath;
import com.nukkitx.math.vector.*;
import com.nukkitx.protocol.bedrock.BedrockPacket;
import com.nukkitx.protocol.bedrock.BedrockServerSession;
Expand Down Expand Up @@ -71,6 +70,7 @@
import org.geysermc.connector.network.translators.world.block.BlockTranslator;
import org.geysermc.connector.utils.ChunkUtils;
import org.geysermc.connector.utils.LocaleUtils;
import org.geysermc.connector.utils.MathUtils;
import org.geysermc.connector.utils.SkinUtils;
import org.geysermc.floodgate.util.BedrockData;
import org.geysermc.floodgate.util.EncryptionUtil;
Expand Down Expand Up @@ -462,7 +462,7 @@ public void sendForm(FormWindow window, int id) {
}

public void setRenderDistance(int renderDistance) {
renderDistance = GenericMath.ceil(++renderDistance * TrigMath.SQRT_OF_TWO); //square to circle
renderDistance = GenericMath.ceil(++renderDistance * MathUtils.SQRT_OF_TWO); //square to circle
if (renderDistance > 32) renderDistance = 32; // <3 u ViaVersion but I don't like crashing clients x)
this.renderDistance = renderDistance;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@

public class MathUtils {

public static final double SQRT_OF_TWO = Math.sqrt(2);

/**
* Round the given float to the next whole number
*
Expand Down

0 comments on commit 6e127ed

Please sign in to comment.