81 lines
2.3 KiB
Java
81 lines
2.3 KiB
Java
package electrosphere.server.datacell.interfaces;
|
|
|
|
import java.util.List;
|
|
|
|
import org.joml.Vector3d;
|
|
import org.joml.Vector3i;
|
|
|
|
import electrosphere.net.server.player.Player;
|
|
import electrosphere.server.datacell.ServerDataCell;
|
|
|
|
/**
|
|
* Interface for manager class for creating and destroying cells with respect to spatial locations
|
|
*/
|
|
public interface DataCellManager {
|
|
|
|
/**
|
|
* Adds a player to the realm that this manager controls. Should do this intelligently based on the player's location
|
|
* @param player The player
|
|
*/
|
|
public void addPlayerToRealm(Player player);
|
|
|
|
/**
|
|
* Moves a player to a new position
|
|
* @param player The player
|
|
* @param newPosition The new position
|
|
*/
|
|
public void movePlayer(Player player, Vector3i newPosition);
|
|
|
|
/**
|
|
* Updates player positions based on the location of the player's current entity
|
|
* @return True if a player changed cell, false otherwise
|
|
*/
|
|
public boolean updatePlayerPositions();
|
|
|
|
/**
|
|
* Get data cell at a given real point in this realm
|
|
* @param point The real point
|
|
* @return Either the data cell if found, or null if not found
|
|
*/
|
|
public ServerDataCell getDataCellAtPoint(Vector3d point);
|
|
|
|
|
|
/**
|
|
* Gets the world position of a given data cell
|
|
* @param cell The data cell
|
|
* @return The world position
|
|
*/
|
|
public Vector3i getCellWorldPosition(ServerDataCell cell);
|
|
|
|
/**
|
|
* Tries to create a data cell at a given real point
|
|
* @param point The real point
|
|
* @return The data cell if created or if already exists, null if cannot create and does not already exist
|
|
*/
|
|
public ServerDataCell tryCreateCellAtPoint(Vector3d point);
|
|
|
|
/**
|
|
* Gets a data cell at a given world position
|
|
* @param position The world position
|
|
* @return The data cell if found, null otherwise
|
|
*/
|
|
public ServerDataCell getCellAtWorldPosition(Vector3i position);
|
|
|
|
/**
|
|
* Calls the simulate function on all loaded cells
|
|
*/
|
|
public void simulate();
|
|
|
|
/**
|
|
* Unloads playerless chunks. Strategy for doing this is defined per data cell manager.
|
|
*/
|
|
public void unloadPlayerlessChunks();
|
|
|
|
/**
|
|
* Saves the data cell manager
|
|
* @param saveName The name of the save
|
|
*/
|
|
public void save(String saveName);
|
|
|
|
}
|