Merge branch 'dev-world-scripts' of https://github.com/Grasscutters/Grasscutter into development

This commit is contained in:
Melledy
2022-06-17 23:35:45 -07:00
80 changed files with 2871 additions and 837 deletions

View File

@@ -137,6 +137,9 @@ public class ConfigContainer {
public int bindPort = 22102;
/* This is the port used in the default region. */
public int accessPort = 0;
/* Entities within a certain range will be loaded for the player */
public int loadEntitiesForPlayerRange = 100;
public boolean enableScriptInBigWorld = false;
public boolean enableConsole = true;
public GameOptions gameOptions = new GameOptions();
public JoinOptions joinOptions = new JoinOptions();

View File

@@ -9,6 +9,7 @@ import java.net.URI;
import java.net.URISyntaxException;
import java.nio.charset.StandardCharsets;
import java.nio.file.*;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
@@ -103,7 +104,7 @@ public final class FileUtils {
result = Arrays.stream(f.listFiles()).map(File::toPath).toList();
}
return result;
}

View File

@@ -3,7 +3,7 @@ package emu.grasscutter.utils;
import java.io.Serializable;
import com.google.gson.annotations.SerializedName;
import com.github.davidmoten.rtreemulti.geometry.Point;
import dev.morphia.annotations.Entity;
import emu.grasscutter.net.proto.VectorOuterClass.Vector;
@@ -162,4 +162,20 @@ public class Position implements Serializable {
.setZ(this.getZ())
.build();
}
public Point toPoint(){
return Point.create(x,y,z);
}
/**
* To XYZ array for Spatial Index
*/
public double[] toDoubleArray(){
return new double[]{ x, y, z};
}
/**
* To XZ array for Spatial Index (Blocks)
*/
public double[] toXZDoubleArray(){
return new double[]{x, z};
}
}