mirror of
https://github.com/PolyhedralDev/Terra.git
synced 2026-04-19 06:40:12 +00:00
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:
@@ -5,6 +5,7 @@ import com.dfsek.terra.biome.BiomeZone;
|
||||
import com.dfsek.terra.biome.grid.TerraBiomeGrid;
|
||||
import com.dfsek.terra.config.base.ConfigUtil;
|
||||
import com.dfsek.terra.debug.gui.DebugGUI;
|
||||
import org.apache.commons.math3.util.FastMath;
|
||||
import org.bukkit.World;
|
||||
import org.polydev.gaea.biome.NormalizationUtil;
|
||||
|
||||
@@ -108,12 +109,12 @@ public class ImageLoader {
|
||||
NONE {
|
||||
@Override
|
||||
public int getRGB(BufferedImage image, int x, int y) {
|
||||
return image.getRGB(Math.floorMod(x, image.getWidth()), Math.floorMod(y, image.getHeight()));
|
||||
return image.getRGB(FastMath.floorMod(x, image.getWidth()), FastMath.floorMod(y, image.getHeight()));
|
||||
}
|
||||
};
|
||||
|
||||
private static int getRGBNoAlign(BufferedImage image, int x, int y) {
|
||||
return image.getRGB(Math.floorMod(x, image.getWidth()), Math.floorMod(y, image.getHeight()));
|
||||
return image.getRGB(FastMath.floorMod(x, image.getWidth()), FastMath.floorMod(y, image.getHeight()));
|
||||
}
|
||||
|
||||
public abstract int getRGB(BufferedImage image, int x, int y);
|
||||
|
||||
Reference in New Issue
Block a user