Documentation
¶
Index ¶
- Variables
- func GetWorldNames() []string
- func LoadWorlds()
- func TransferEntity(eH *world.EntityHandle, provider WorldProvider, worldName string, ...) error
- func TransferPlayer(p *player.Player, provider WorldProvider, worldName string, pos mgl64.Vec3) error
- type MWTp
- type MapWorldProvider
- type MultiWorldList
- type MultiWorldTp
- type WorldEnum
- type WorldProvider
Constants ¶
This section is empty.
Variables ¶
var Worlds = &MapWorldProvider{ Worlds: make(map[string]*world.World), }
Worlds is a global alias for the MapWorldProvider instance.
Functions ¶
func GetWorldNames ¶
func GetWorldNames() []string
GetWorldNames returns a slice of all loaded world names. Example usage: names := GetWorldNames()
func LoadWorlds ¶
func LoadWorlds()
LoadWorlds reads and loads all worlds from the "worlds" folder into memory. It creates the folder if it does not exist. Example usage: LoadWorlds()
func TransferEntity ¶
func TransferEntity(eH *world.EntityHandle, provider WorldProvider, worldName string, pos mgl64.Vec3) error
TransferEntity moves an entity (player or other) from its current world to another world at a given position. Example usage: TransferEntity(entityHandle, Worlds, "world2", mgl64.Vec3{0, 64, 0})
func TransferPlayer ¶
func TransferPlayer(p *player.Player, provider WorldProvider, worldName string, pos mgl64.Vec3) error
TransferPlayer is a helper function to move a player to another world at a given position. Example usage: TransferPlayer(playerObj, Worlds, "world2", mgl64.Vec3{0, 64, 0})
Types ¶
type MWTp ¶
type MWTp struct {
Tp cmd.SubCommand `cmd:"tp"`
WorldName cmd.Optional[WorldEnum] `cmd:"world,enum"`
}
MWTp is an alias command structure for teleporting (short form). Usage example: /world tp <world_name>
type MapWorldProvider ¶
MapWorldProvider is a simple implementation of WorldProvider using a map.
type MultiWorldList ¶
type MultiWorldList struct {
List cmd.SubCommand `cmd:"list"`
}
MultiWorldList is a command structure for listing all loaded worlds. Usage example: /world list
type MultiWorldTp ¶
type MultiWorldTp struct {
Teleport cmd.SubCommand `cmd:"teleport"`
WorldName cmd.Optional[WorldEnum] `cmd:"world,enum"`
}
MultiWorldTp is a command structure for teleporting to another world. Usage example: /world teleport <world_name>