Replace Math with FastMath for improved performance.

FastMath is a drop in replacement for the native Java math class with improved performance and fall backs to the native Java math class if necessary.

https://commons.apache.org/proper/commons-math/javadocs/api-3.3/org/apache/commons/math3/util/FastMath.html

This requires further testing and might cause chunk borders due the FastMath giving slightly different results than the native Java math class.

I also added .idea/Terra.iml to the .gitignore
This commit is contained in:
Bud Gidiere
2020-11-18 17:23:09 -06:00
parent 19162a1924
commit 0a77487399
21 changed files with 73 additions and 52 deletions

View File

@@ -2,6 +2,7 @@ package com.dfsek.terra.util.structure;
import com.dfsek.terra.procgen.math.Vector2;
import com.dfsek.terra.structure.Rotation;
import org.apache.commons.math3.util.FastMath;
import org.bukkit.block.BlockFace;
import org.bukkit.block.data.BlockData;
import org.bukkit.block.data.Directional;
@@ -107,7 +108,7 @@ public final class RotationUtil {
* @return BlockFace represented by integer.
*/
public static BlockFace fromRotation(int r) {
switch(Math.floorMod(r, 16)) {
switch(FastMath.floorMod(r, 16)) {
case 0:
return BlockFace.NORTH;
case 1: