Class World

java.lang.Object
fr.hytale.loader.api.World

public class World extends Object
Represents a Hytale world.
Since:
1.0.4
Version:
1.0.6
Author:
HytaleLoader
  • Constructor Details

    • World

      public World(com.hypixel.hytale.server.core.universe.world.World nativeWorld)
      Constructs a new World wrapper.
      Parameters:
      nativeWorld - the native Hytale world
  • Method Details

    • getNative

      public com.hypixel.hytale.server.core.universe.world.World getNative()
      Gets the native Hytale world object.
      Returns:
      the native world
    • getName

      public String getName()
      Gets the world name.
      Returns:
      the world name
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • getBlockIdentifier

      public String getBlockIdentifier(int x, int y, int z)
      Gets the identifier of the block at the specified coordinates.
      Parameters:
      x - The X coordinate
      y - The Y coordinate
      z - The Z coordinate
      Returns:
      The block identifier (e.g., "hytale:stone"), or "hytale:air" if not found
    • getBlockIdentifier

      public String getBlockIdentifier(Location location)
      Gets the identifier of the block at the specified location.
      Parameters:
      location - The location to check
      Returns:
      The block identifier
    • setBlock

      public void setBlock(int x, int y, int z, String blockId)
      Sets the block at the specified coordinates.
      Parameters:
      x - The X coordinate
      y - The Y coordinate
      z - The Z coordinate
      blockId - The block identifier (e.g., "hytale:stone")
    • setBlock

      public void setBlock(Location location, String blockId)
      Sets the block at the specified location.
      Parameters:
      location - The location where to set the block
      blockId - The block identifier
    • setBlock

      public void setBlock(Block block)
      Sets the block at the specified location in the block arguments.
      Parameters:
      block - The block to set
    • getBlockAt

      public Block getBlockAt(int x, int y, int z)
      Gets the Block object at the specified coordinates.
      Parameters:
      x - The X coordinate
      y - The Y coordinate
      z - The Z coordinate
      Returns:
      The Block object
    • getBlockAt

      public Block getBlockAt(Location location)
      Gets the Block object at the specified location.
      Parameters:
      location - The location
      Returns:
      The Block object, or null if location is invalid/different world
    • getEntity

      public Entity getEntity(int id)
      Gets an entity by its network ID.
      Parameters:
      id - The entity's network ID
      Returns:
      The Entity, or null if not found
    • getEntity

      public Entity getEntity(UUID uuid)
      Gets an entity by its UUID.
      Parameters:
      uuid - The entity's UUID
      Returns:
      The Entity, or null if not found
    • spawnEntity

      public Entity spawnEntity(Location location, String entityType)
      Spawns an entity at the specified location.
      Parameters:
      location - The location to spawn the entity
      entityType - The type of entity (e.g. "Antelope", "Bat_Ice")
      Returns:
      The spawned Entity, or null if failed
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • playSound

      public void playSound(Location location, String sound, float volume, float pitch)
      Plays a sound at a specific location for all nearby players.
      Parameters:
      location - The location to play the sound at
      sound - The sound identifier (e.g. "my.sound.effect")
      volume - The volume (1.0 is normal)
      pitch - The pitch (1.0 is normal)
    • playSound

      public void playSound(Location location, String sound, SoundCategory category, float volume, float pitch)
      Plays a sound at a specific location for all nearby players.
      Parameters:
      location - The location to play the sound at
      sound - The sound identifier
      category - The sound category
      volume - The volume
      pitch - The pitch
    • playParticle

      public void playParticle(Location location, String particleName)
      Plays a particle effect at a specific location for all nearby players.
      Parameters:
      location - The location to play the particle at
      particleName - The particle identifier (e.g. "lx_sparkle_01")
    • setWeather

      public void setWeather(WeatherType weather)
      Sets the weather for this world.
      Parameters:
      weather - The weather type to set (e.g. WeatherType.CLEAR). Pass null to reset to dynamic weather.
    • setWeather

      public void setWeather(String weatherName)
      Sets the weather for this world.
      Parameters:
      weatherName - The name of the weather asset (e.g. "Zone1_Sunny", "Zone1_Rain"). Pass null to reset to dynamic weather.
    • getWeatherName

      public String getWeatherName()
      Gets the current forced weather name for this world.
      Returns:
      The weather name, or null if dynamic weather is active.
    • getWeather

      public WeatherType getWeather()
      Gets the current forced weather type for this world.
      Returns:
      The WeatherType, or null if dynamic weather is active or the type is unknown to the API.
    • setTime

      public void setTime(Time time)
      Sets the time of day using a convenient enum.
      Parameters:
      time - The time preset to set (e.g. Time.NOON)
    • setTime

      public void setTime(float percent)
      Sets the time of day as a percentage (0.0 to 1.0). 0.0 is Midnight, 0.5 is Noon.
      Parameters:
      percent - The percentage of the day passed
    • setTimePaused

      public void setTimePaused(boolean paused)
      Sets whether the daylight cycle is paused.
      Parameters:
      paused - true to pause time, false to resume
    • getTimeHour

      public int getTimeHour()
      Gets the current hour of the day (0-23).
      Returns:
      the current hour
    • isDay

      public boolean isDay()
      Checks if it is currently day time (between 06:00 and 18:00).
      Returns:
      true if it is day, false if it is night.