### Create a Custom Hytale Plugin Source: https://rentry.co/gykiza2m/edit Demonstrates how to create a custom plugin by extending the `JavaPlugin` base class. This involves overriding setup, start, and shutdown methods. The `JavaPluginInit` object is passed to the constructor for initialization. ```kotlin import com.hypixel.hytale.server.core.plugin.JavaPlugin import com.hypixel.hytale.server.core.plugin.JavaPluginInit class MyPlugin(init: JavaPluginInit) : JavaPlugin(init) { override fun setup() { /* Called during plugin setup phase */ } override fun start() { /* Called when plugin enables */ } override fun shutdown() { /* Called when plugin disables */ } } ``` -------------------------------- ### Event Registration Example Source: https://rentry.co/gykiza2m/raw Provides an example of how to register an event listener in Kotlin. This snippet shows the structure for subscribing to a specific event, such as `PlayerConnectEvent`, and defining a callback function to handle it. ```kotlin override fun start() { eventRegistry.register(PlayerConnectEvent::class.java) { event -> // Handle event } } ``` -------------------------------- ### EntityStore Basic Information (Kotlin) Source: https://rentry.co/gykiza2m/edit Provides examples of retrieving basic information from an EntityStore, such as its parent world and the ability to get an entity reference by its UUID. These are fundamental operations for entity management. ```kotlin val world: World = entityStore.getWorld() val entityRef: Ref? = entityStore.getRefFromUUID(someUuid) ``` -------------------------------- ### Create and Manage a Hytale Plugin (Java/Kotlin) Source: https://rentry.co/gykiza2m/edit Demonstrates the basic structure of a Hytale plugin using Java or Kotlin. It shows how to extend the `JavaPlugin` class and implement lifecycle methods such as `setup`, `start`, and `shutdown`. Essential for any plugin development. ```kotlin import com.hypixel.hytale.server.core.plugin.JavaPlugin import com.hypixel.hytale.server.core.plugin.JavaPluginInit class MyPlugin(init: JavaPluginInit) : JavaPlugin(init) { override fun setup() { /* Called during plugin setup phase */ logger.info("MyPlugin setup complete.") } override fun start() { /* Called when plugin enables */ logger.info("MyPlugin started.") } override fun shutdown() { /* Called when plugin disables */ logger.info("MyPlugin shutting down.") } } ``` -------------------------------- ### Code Block with Python Example Source: https://rentry.co/gykiza2m/edit Demonstrates how to create a code block using triple backticks. Supports syntax highlighting for various languages. The example shows a simple Python script. ```python s = "Triple backticks ( ``` ) generate code block" print(s) ``` -------------------------------- ### Hytale ECS Component System Example (Kotlin) Source: https://rentry.co/gykiza2m/edit Demonstrates how to interact with the Entity-Component-System (ECS) in Hytale. It shows how to retrieve component types and resources from the world store. Requires the `com.hypixel.hytale.component` package. ```kotlin val componentType = PlayerSomnolence.getComponentType() val component = player.getComponent(componentType) val resourceType = WorldTimeResource.getResourceType() val resource = store.getResource(resourceType) ``` -------------------------------- ### Hytale Plugin System: JavaPlugin Base Class Source: https://rentry.co/gykiza2m/raw Demonstrates the structure of a custom plugin extending the JavaPlugin base class. It outlines the essential lifecycle methods (`setup`, `start`, `shutdown`) and highlights key properties available for plugin development, such as logging, registries, and data management. ```kotlin class MyPlugin(init: JavaPluginInit) : JavaPlugin(init) { override fun setup() { /* Called during plugin setup phase */ } override fun start() { /* Called when plugin enables */ } override fun shutdown() { /* Called when plugin disables */ } } ``` -------------------------------- ### Admonition Block Example Source: https://rentry.co/gykiza2m/edit Demonstrates the use of admonition blocks for highlighting important information. Supports types like 'note', 'info', 'warning', and 'danger'. The example shows an 'info' type admonition. ```markdown !!! info Title or text can be skipped ``` -------------------------------- ### Hytale Plugin System: Configuration Helper Source: https://rentry.co/gykiza2m/raw Illustrates how to create and manage configuration files for Hytale plugins using the `withConfig` helper function. It shows examples for default and custom-named configuration files, utilizing a provided `MyConfigClass.CODEC` for serialization. ```kotlin // Create a config file for your plugin val config: Config = withConfig(MyConfigClass.CODEC) val config: Config = withConfig("custom-name.json", MyConfigClass.CODEC) ``` -------------------------------- ### Manage Hytale Server Name and MOTD Source: https://rentry.co/gykiza2m/edit Provides examples of how to get and set the server's name and Message of the Day (MOTD) using the HytaleServerConfig class. These methods allow dynamic modification of server identification. ```kotlin fun getServerName(): String fun setServerName(String) fun getMotd(): String fun setMotd(String) ``` -------------------------------- ### Other Universe Utility Methods (Kotlin) Source: https://rentry.co/gykiza2m/edit Lists miscellaneous utility methods provided by the Universe class. This includes getting the universe directory path, accessing player storage, and initiating a server backup. ```kotlin // Other fun getPath(): Path // Universe directory path fun getPlayerStorage(): PlayerStorage fun runBackup(): CompletableFuture ``` -------------------------------- ### Basic Code Block Example Source: https://rentry.co/gykiza2m/edit Illustrates a simple code block without specific language syntax highlighting, useful for plain text or when the language is not critical. ```plaintext 1 2 ``` -------------------------------- ### World Basic Information and Control (Kotlin) Source: https://rentry.co/gykiza2m/edit Provides examples of retrieving basic information about a world, such as its name, alive status, logger, current tick, and configuration details. It also includes methods for controlling the world's paused and ticking states, and setting its TPS (ticks per second). ```kotlin // Basic info val name: String = world.getName() val isAlive: Boolean = world.isAlive() val logger: HytaleLogger = world.getLogger() val tick: Long = world.getTick() val worldConfig: WorldConfig = world.getWorldConfig() val deathConfig: DeathConfig = world.getDeathConfig() val daytimeDuration: Int = world.getDaytimeDurationSeconds() val nighttimeDuration: Int = world.getNighttimeDurationSeconds() // Pause/Tick control var isPaused: Boolean = world.isPaused() world.setPaused(true) var isTicking: Boolean = world.isTicking() world.setTicking(false) world.setTps(20) ``` -------------------------------- ### Implementing a Custom CommandSender in Kotlin Source: https://rentry.co/gykiza2m/raw Provides an example of creating a custom implementation of the CommandSender interface in Kotlin. This interface defines the context for command execution, including methods for sending messages, checking permissions, and identifying the sender. Useful for custom command logic. ```kotlin val sender = object : CommandSender { override fun getDisplayName(): String = "MyPlugin" override fun getUuid(): UUID = UUID(0, 0) override fun sendMessage(message: Message) { /* handle output */ } override fun hasPermission(permission: String): Boolean = true override fun hasPermission(permission: String, default: Boolean): Boolean = true } ``` -------------------------------- ### Player Respawn and Permissions (Kotlin) Source: https://rentry.co/gykiza2m/edit Details methods for handling player respawning, including getting the respawn position, and managing permissions. Players implement CommandSender and PermissionHolder. ```kotlin // Respawn static fun getRespawnPosition(Ref, worldName: String, ComponentAccessor): Transform // Permissions (CommandSender interface) fun sendMessage(Message) fun hasPermission(String): Boolean fun hasPermission(String, default: Boolean): Boolean ``` -------------------------------- ### Execute Server Commands Source: https://rentry.co/gykiza2m/edit Provides examples of common server commands for managing worlds, items, entities, weather, and server operations. These commands are typically executed via the server console or in-game chat. ```plaintext /give [quantity] /clear [item] /summon [x] [y] [z] /kill /weather clear /weather rain /weather storm /stop /save-all /reload ``` -------------------------------- ### Access EntityStore Resources (Kotlin) Source: https://rentry.co/gykiza2m/raw Shows how to get the resource store from an EntityStore and retrieve a specific resource by its type. This is useful for managing and accessing game entities. ```kotlin val store: Store = entityStore.store val resource = store.getResource(ResourceType) ``` -------------------------------- ### Access Universe and World Data (Kotlin) Source: https://rentry.co/gykiza2m/raw Provides examples of how to access the global Universe object, which serves as the main container for all worlds and players. It demonstrates retrieving lists of players, default worlds, and all loaded worlds. ```kotlin val universe = Universe.get() val players: List = universe.players val defaultWorld: World? = universe.defaultWorld val worlds: Map = universe.worlds ``` -------------------------------- ### World Entity Management (Kotlin) Source: https://rentry.co/gykiza2m/edit Demonstrates how to interact with entities within a world. This includes retrieving an entity by its UUID, getting a reference to an entity within the entity store, and spawning or adding new entities with specified positions and reasons. ```kotlin // Get entity by UUID val entity: Entity? = world.getEntity(someUuid) val entityRef: Ref? = world.getEntityRef(someUuid) // Spawn/Add entity val spawnedEntity: T = world.spawnEntity(entityToSpawn, position, rotation) val addedEntity: T = world.addEntity(entityToAdd, position, rotation, AddReason.PLAYER_SPAWN) ``` -------------------------------- ### World Player Management (Kotlin) Source: https://rentry.co/gykiza2m/edit Illustrates various methods for managing players within a world, including retrieving lists of players and player references, getting the player count, and asynchronously adding new players with or without a specific transform. It also covers tracking and untracking player references. ```kotlin // Get players val players: List = world.getPlayers() val playerRefs: Collection = world.getPlayerRefs() val playerCount: Int = world.getPlayerCount() // Add players val newPlayerRef: CompletableFuture = world.addPlayer(playerRefToAdd) val newPlayerWithTransform: CompletableFuture = world.addPlayer(playerRefToAdd, transform) // Track players world.trackPlayerRef(playerRefToTrack) world.untrackPlayerRef(playerRefToUntrack) ``` -------------------------------- ### Manage Player Properties and Network (Kotlin) Source: https://rentry.co/gykiza2m/raw Illustrates various methods for managing player references, including identity, components, position, and network interactions. It covers getting player components, updating their position, and transferring them between servers. ```kotlin // Identity fun getUuid(): UUID fun getUsername(): String fun getLanguage(): String fun setLanguage(String) // Components fun getHolder(): Holder? fun > getComponent(ComponentType): T? fun getReference(): Ref fun isValid(): Boolean // Position fun getTransform(): Transform fun getWorldUuid(): UUID fun getHeadRotation(): Vector3f fun updatePosition(World, Transform, Vector3f) // Messaging fun sendMessage(Message) // Network fun getPacketHandler(): PacketHandler fun getChunkTracker(): ChunkTracker fun getHiddenPlayersManager(): HiddenPlayersManager fun referToServer(host: String, port: Int) // Transfer to another server fun referToServer(host: String, port: Int, data: ByteArray) // Permissions (via hasPermission - inherited) // Kicking (via kick(Message) - if exposed) ``` -------------------------------- ### Accessing Components and Resources in Hytale ECS (Kotlin) Source: https://rentry.co/gykiza2m/raw Illustrates how to interact with the Entity-Component-System (ECS) in Hytale using Kotlin. It shows examples of retrieving a specific component from a player entity and accessing a resource from the world store. ```kotlin // Get a component from a player val componentType = PlayerSomnolence.getComponentType() val component = player.getComponent(componentType) // Get a resource from world store val resourceType = WorldTimeResource.getResourceType() val resource = store.getResource(resourceType) ``` -------------------------------- ### Define BuilderCodec for Config (Kotlin) Source: https://rentry.co/gykiza2m/raw Example of defining a BuilderCodec for a custom configuration class. This demonstrates how to map fields for serialization and deserialization using Hytale's codec system. ```kotlin // Define a codec for your config class companion object { val CODEC: BuilderCodec = BuilderCodec.builder(::MyConfig) .field("name", MyConfig::name, Codec.STRING) .field("count", MyConfig::count, Codec.INT) .build() } ``` -------------------------------- ### Access Hytale Universe Singleton Instance Source: https://rentry.co/gykiza2m/edit Illustrates how to get the singleton instance of the Universe, which serves as the main container for all worlds and players in the Hytale server. This is the entry point for managing server-wide entities. ```kotlin val universe = Universe.get() ``` -------------------------------- ### Register Events with EventRegistry in Kotlin Source: https://rentry.co/gykiza2m/edit Illustrates various ways to register events using the `EventRegistry` in Kotlin. It covers basic registration, registration with priority, keyed events, and asynchronous event handling. The examples demonstrate how to subscribe to different event types and process them. ```kotlin // Basic event registration eventRegistry.register(PlayerConnectEvent::class.java) { event -> val player = event.playerRef logger.info("Player connected: ${player.username}") } // With priority eventRegistry.register(EventPriority.HIGH, PlayerConnectEvent::class.java) { event -> // Handle with high priority } // With key (for keyed events) eventRegistry.register(SomeKeyedEvent::class.java, "myKey") { event -> // Only fires for events with this key } // Async event registration eventRegistry.registerAsync(PlayerChatEvent::class.java) { future -> future.thenApply { event -> // Process async event } } // Global registration (all keys) eventRegistry.registerGlobal(SomeKeyedEvent::class.java) { event -> // Fires for all keys } ``` -------------------------------- ### Living Entity Inventory Management in Kotlin Source: https://rentry.co/gykiza2m/edit Demonstrates how to get and set the inventory for LivingEntity instances, which include entities with health and inventory capabilities. This is crucial for item management within the game. ```kotlin val inventory: Inventory = livingEntity.inventory livingEntity.setInventory(newInventory) ``` -------------------------------- ### Manage Player HUD Elements with Kotlin Source: https://rentry.co/gykiza2m/edit Illustrates how to get the HUD manager in Kotlin to add and manage custom HUD elements for players. This is essential for creating custom in-game displays. ```kotlin val hudManager = player.getHudManager() // Add custom HUD elements ``` -------------------------------- ### PlayerRef Identity and Component Methods (Kotlin) Source: https://rentry.co/gykiza2m/edit Provides examples of key methods for PlayerRef related to identity (UUID, username, language) and accessing its components. PlayerRef implements Component and IMessageReceiver. ```kotlin // Identity fun getUuid(): UUID fun getUsername(): String fun getLanguage(): String fun setLanguage(String) // Components fun getHolder(): Holder? fun > getComponent(ComponentType): T? fun getReference(): Ref fun isValid(): Boolean ``` -------------------------------- ### Image with Size and Alignment Options Source: https://rentry.co/gykiza2m/edit Provides examples of embedding images with various options, including setting dimensions in pixels, percentages, or viewport units, adding title text, and floating the image to the left or right. ```markdown ![Alt Tag](https://i.imgur.com/PYV4crq.png){100px:100px} ![Alt Tag](https://i.imgur.com/PYV4crq.png "Title") ![Alt Tag](https://i.imgur.com/PYV4crq.png#left) ``` -------------------------------- ### Interact with Hytale World Properties and Control (Kotlin) Source: https://rentry.co/gykiza2m/index Provides examples of interacting with various aspects of a Hytale world, including its lifecycle, configuration, time, players, entities, and chunk management. It showcases methods for pausing, ticking, time dilation, player manipulation, entity spawning, and chunk loading. ```kotlin // Thread execution (REQUIRED for component access) world.execute { /* Run code on world thread */ } // Basic info val worldName: String = world.getName() val isWorldAlive: Boolean = world.isAlive() val logger = world.getLogger() val currentTick: Long = world.getTick() val worldConfig = world.getWorldConfig() val deathConfig = world.getDeathConfig() val daytimeDuration: Int = world.getDaytimeDurationSeconds() val nighttimeDuration: Int = world.getNighttimeDurationSeconds() // Pause/Tick control val isPaused: Boolean = world.isPaused() world.setPaused(true) val isTicking: Boolean = world.isTicking() world.setTicking(false) world.setTps(20) // Time dilation (slow-mo/speed-up) // static fun setTimeDilation(Float, ComponentAccessor) // Players val players: List = world.getPlayers() val playerRefs: Collection = world.getPlayerRefs() val playerCount: Int = world.getPlayerCount() // CompletableFuture addedPlayer = world.addPlayer(playerRef) // CompletableFuture addedPlayerWithTransform = world.addPlayer(playerRef, transform) world.trackPlayerRef(playerRef) world.untrackPlayerRef(playerRef) // Entities val entity: Entity? = world.getEntity(uuid) val entityRef: Ref? = world.getEntityRef(uuid) // T spawnedEntity = world.spawnEntity(entity, vector3d, vector3f) // T addedEntity = world.addEntity(entity, vector3d, vector3f, AddReason.DEFAULT) // Stores and systems val entityStore: EntityStore = world.getEntityStore() val chunkStore: ChunkStore = world.getChunkStore() val chunkLighting: ChunkLightingManager = world.getChunkLighting() val worldMapManager: WorldMapManager = world.getWorldMapManager() val worldPathConfig: WorldPathConfig = world.getWorldPathConfig() val notificationHandler: WorldNotificationHandler = world.getNotificationHandler() val eventRegistry: EventRegistry = world.getEventRegistry() // Messaging // world.sendMessage(message) // Chunks val chunkInMemory: WorldChunk? = world.getChunkIfInMemory(chunkPos) val chunkLoaded: WorldChunk? = world.getChunkIfLoaded(chunkPos) // CompletableFuture chunkAsync = world.getChunkAsync(chunkPos) val chunkLoadedFromMemory: WorldChunk? = world.loadChunkIfInMemory(chunkPos) // Compass val isCompassUpdating: Boolean = world.isCompassUpdating() world.setCompassUpdating(false) ``` -------------------------------- ### Creating and Registering Custom Commands in Kotlin Source: https://rentry.co/gykiza2m/raw Demonstrates how to define a new command by extending the Command class and implementing its methods in Kotlin. It also shows the process of registering this custom command with the command registry, making it available in the game. ```kotlin class MyCommand : Command { override fun getName(): String = "mycommand" override fun execute(sender: CommandSender, args: Array) { sender.sendMessage(Message.raw("Hello!")) } } // Register in plugin commandRegistry.registerCommand(MyCommand()) ``` -------------------------------- ### Create and Format Messages in Kotlin Source: https://rentry.co/gykiza2m/edit Demonstrates how to create simple, formatted, parameterized, and linked messages using the Message API. It also shows how to insert other messages and send them to players, the world, or the universe. ```kotlin val msg = Message.raw("Hello, world!") val styled = Message.raw("Important!") .color("red") .bold(true) .italic(false) .monospace(true) val parameterized = Message.raw("Welcome, {name}!") .param("name", "Player123") .param("count", 42) .param("enabled", true) val linked = Message.raw("Click here") .link("https://example.com") val combined = Message.raw("Prefix: ").insert(anotherMessage) player.sendMessage(msg) world.sendMessage(msg) Universe.get().sendMessage(msg) ``` -------------------------------- ### Get Hytale Universe Default World Source: https://rentry.co/gykiza2m/edit Provides a way to get the default World object from the Hytale Universe. This is often the primary world instance. ```kotlin fun getDefaultWorld(): World? ``` -------------------------------- ### Get Hytale World Entity Reference Source: https://rentry.co/gykiza2m/edit Illustrates how to get a Ref for an entity within a Hytale World using its UUID. This provides a reference to the entity within the entity store. ```kotlin fun getEntityRef(uuid: UUID): Ref? ``` -------------------------------- ### Get Hytale World Logger and Tick Count Source: https://rentry.co/gykiza2m/edit Illustrates how to obtain the logger instance for a Hytale World and get the current tick number. Useful for debugging and monitoring world activity. ```kotlin fun getLogger(): HytaleLogger fun getTick(): Long ``` -------------------------------- ### Create Hytale World with Configuration Source: https://rentry.co/gykiza2m/edit Demonstrates how to asynchronously create a new world with a specific name, file path, and WorldConfig. This provides detailed control over world creation parameters. ```kotlin fun makeWorld(name: String, path: Path, config: WorldConfig): CompletableFuture ``` -------------------------------- ### Get Hytale Universe Directory Path Source: https://rentry.co/gykiza2m/edit Illustrates how to get the file system path to the Hytale Universe's directory. This is useful for file operations related to the server's data. ```kotlin fun getPath(): Path ``` -------------------------------- ### Get Hytale Universe Player Count Source: https://rentry.co/gykiza2m/edit Demonstrates how to get the total number of players currently connected to the Hytale server through the Universe instance. This is a simple way to check server load. ```kotlin fun getPlayerCount(): Int ``` -------------------------------- ### Player UI and Position Management (Kotlin) Source: https://rentry.co/gykiza2m/edit Illustrates methods for managing the Player's user interface elements and their position within the game world. This includes accessing window managers and updating player location. ```kotlin // UI/Pages fun getWindowManager(): WindowManager fun getPageManager(): PageManager fun getHudManager(): HudManager fun getWorldMapTracker(): WorldMapTracker // Position fun moveTo(Ref, x: Double, y: Double, z: Double, ComponentAccessor) fun addLocationChange(Ref, x: Double, y: Double, z: Double, ComponentAccessor) ``` -------------------------------- ### Console Command Execution Source: https://rentry.co/gykiza2m/raw This Kotlin snippet demonstrates how to execute commands as if they were run from the console. It includes creating a mock `CommandSender` and using the `CommandManager` to handle the command. ```kotlin fun executeAsConsole(command: String) { val sender = object : CommandSender { override fun getDisplayName() = "MyPlugin" override fun getUuid() = UUID(0, 0) override fun sendMessage(msg: Message) { } override fun hasPermission(p: String) = true override fun hasPermission(p: String, d: Boolean) = true } CommandManager.get().handleCommand(sender, command) } ``` -------------------------------- ### Command Execution Best Practice in Kotlin Source: https://rentry.co/gykiza2m/edit Provides a method to execute commands as if they were sent by the console. Useful for scripting and administrative tasks within the game. ```kotlin fun executeAsConsole(command: String) { val sender = object : CommandSender { override fun getDisplayName() = "MyPlugin" override fun getUuid() = UUID(0, 0) override fun sendMessage(msg: Message) {} override fun hasPermission(p: String) = true override fun hasPermission(p: String, d: Boolean) = true } CommandManager.get().handleCommand(sender, command) } ``` -------------------------------- ### Component System (ECS) API Source: https://rentry.co/gykiza2m/index Explains Hytale's Entity-Component-System architecture and provides examples for accessing components and resources. ```APIDOC ## Component System (ECS) ### Description Hytale uses an Entity-Component-System architecture. ### Method N/A (Concept Documentation) ### Endpoint N/A (Concept Documentation) ### Parameters N/A ### Request Example N/A ### Response N/A ### Usage Examples ```kotlin // Get a component from a player val componentType = PlayerSomnolence.getComponentType() val component = player.getComponent(componentType) // Get a resource from world store val resourceType = WorldTimeResource.getResourceType() val resource = store.getResource(resourceType) ``` ``` -------------------------------- ### Event Registration Best Practice in Kotlin Source: https://rentry.co/gykiza2m/edit Shows how to register event listeners for specific event types, such as player connections. Allows for custom handling of game events. ```kotlin override fun start() { eventRegistry.register(PlayerConnectEvent::class.java) { event -> // Handle event } } ``` -------------------------------- ### Manage Weather Source: https://rentry.co/gykiza2m/raw Commands to control the in-game weather conditions, allowing for clearing weather, initiating rain, or starting storms. ```plaintext /weather clear - Clear weather /weather rain - Make it rain /weather storm - Start storm ``` -------------------------------- ### Access Per-World Configuration (Kotlin) Source: https://rentry.co/gykiza2m/raw Illustrates how to access the configuration specific to a particular world. This allows for fine-grained control over individual world settings. ```kotlin val worldConfig = world.worldConfig ``` -------------------------------- ### World Messaging (Kotlin) Source: https://rentry.co/gykiza2m/edit Provides an example of sending a message to all players within the world. This is a global communication method for broadcasting information. ```kotlin val messageToSend: Message = /* ... create message ... */ world.sendMessage(messageToSend) ``` -------------------------------- ### Access Hytale World Entity Store Source: https://rentry.co/gykiza2m/edit Illustrates how to get the EntityStore for a specific Hytale World. The EntityStore manages all entities within that world. ```kotlin val entityStore: EntityStore = world.entityStore ``` -------------------------------- ### Resource Access Pattern Source: https://rentry.co/gykiza2m/raw Illustrates a common pattern for accessing resources within the game world. It shows how to retrieve the default world, its entity store, and then a specific resource from the store. ```kotlin val world = Universe.get().defaultWorld ?: return val store = world.entityStore.store val resource = store.getResource(resourceType) ``` -------------------------------- ### Control Server Weather Source: https://rentry.co/gykiza2m/edit Commands to change the weather conditions on the server, including clearing weather, initiating rain, or starting a storm. ```Command Line /weather clear - Clear weather /weather rain - Make it rain /weather storm - Start storm ``` -------------------------------- ### Create and Inspect Item Stacks Source: https://rentry.co/gykiza2m/raw Demonstrates the creation of `ItemStack` objects with varying parameters (ID, quantity, metadata) and checking their properties like emptiness, validity, and durability. ```kotlin // Create item stacks val stack1 = ItemStack("item_id") val stack2 = ItemStack("item_id", 64) val stack3 = ItemStack("item_id", 64, metadata) // Check properties val isEmpty = stack.isEmpty() val isValid = stack.isValid() val isBroken = stack.isBroken() val isUnbreakable = stack.isUnbreakable() ``` -------------------------------- ### Get Hytale Universe Worlds Map Source: https://rentry.co/gykiza2m/edit Shows how to retrieve a map of all worlds managed by the Hytale Universe. This provides a comprehensive view of all available worlds. ```kotlin fun getWorlds(): Map ``` -------------------------------- ### Get Player Page Manager (Kotlin) Source: https://rentry.co/gykiza2m/raw Retrieves the page manager for a player, used to display custom UI pages. This is part of the UI System. ```kotlin val pageManager = player.getPageManager() // Use to show custom UI pages to players ``` -------------------------------- ### Hytale Store Operations (Kotlin) Source: https://rentry.co/gykiza2m/edit Shows how to perform operations on the Hytale `Store`, such as getting resources or components, and adding/removing components from entities. Requires the `com.hypixel.hytale.component` package. ```kotlin val store: Store = entityStore.store store.getResource(resourceType) store.getComponent(ref, componentType) store.addComponent(ref, componentType) store.removeComponent(ref, componentType) ``` -------------------------------- ### Image as a Link Source: https://rentry.co/gykiza2m/edit Illustrates how to make an image clickable by wrapping it within a standard Markdown link syntax. This allows users to navigate to a specified URL when the image is clicked. ```markdown [![Alt Tag](https://i.imgur.com/PYV4crq.png)](https://rentry.co) ``` -------------------------------- ### Item Container Interface Source: https://rentry.co/gykiza2m/index An interface for various item containers like inventories and chests, providing methods to get, set, add, remove, and clear items. ```APIDOC ## Item Container API ### Description The `ItemContainer` interface defines the contract for any object that holds items, such as player inventories or chests. It provides essential methods for interacting with the container's contents. ### Interface `com.hypixel.hytale.server.core.inventory.container.ItemContainer` ### Key Methods * `getSize(): Int`: Returns the total number of slots in the container. * `getItem(slot: Int): ItemStack?`: Retrieves the `ItemStack` at the specified slot index. Returns `null` if the slot is empty. * `setItem(slot: Int, item: ItemStack?)`: Sets the `ItemStack` at the specified slot index. Can be used to place an item or clear a slot by passing `null`. * `addItem(item: ItemStack): Boolean`: Attempts to add the given `ItemStack` to the container. Returns `true` if successful, `false` otherwise. * `removeItem(item: ItemStack): Boolean`: Attempts to remove the given `ItemStack` from the container. Returns `true` if successful, `false` otherwise. * `clear()`: Removes all items from the container. ### Container Types * `SimpleItemContainer`: A basic implementation of `ItemContainer`. * `CombinedItemContainer`: Allows combining multiple containers into a single logical unit. * `DelegateItemContainer`: A container that delegates its operations to another `ItemContainer`. * `EmptyItemContainer`: A singleton representing an empty container. ``` -------------------------------- ### Manage Player UI Windows with Kotlin Source: https://rentry.co/gykiza2m/edit Shows how to obtain and use the window manager in Kotlin for controlling various UI containers like inventory and crafting UIs. This is a core part of the UI System's window management. ```kotlin val windowManager = player.getWindowManager() // Manage inventory windows, crafting UIs, etc. ``` -------------------------------- ### Core Packages Source: https://rentry.co/gykiza2m/edit Overview of core server packages, including server, universe, entity, command, event, and more. ```APIDOC ## Core Packages ### Description Overview of core server packages, including server, universe, entity, command, event, and more. | Package | Description | |---------------------------------------------|-------------------------| | `com.hypixel.hytale.server.core` | Core server classes | | `com.hypixel.hytale.server.core.universe` | Universe, World, PlayerRef | | `com.hypixel.hytale.server.core.entity` | Entity system | | `com.hypixel.hytale.server.core.command` | Command system | | `com.hypixel.hytale.server.core.event` | Event system | | `com.hypixel.hytale.server.core.modules` | Server modules | | `com.hypixel.hytale.server.core.plugin` | Plugin API | | `com.hypixel.hytale.server.core.inventory` | Inventory system | | `com.hypixel.hytale.server.core.permissions`| Permissions | | `com.hypixel.hytale.server.core.task` | Task scheduling | ``` -------------------------------- ### Manage Hytale Server Modules Source: https://rentry.co/gykiza2m/edit Demonstrates how to retrieve all loaded modules and specific modules by name, as well as how to set or update modules for the Hytale server. This allows for dynamic module management. ```kotlin fun getModules(): Map fun getModule(String): Module fun setModules(Map) ``` -------------------------------- ### Manage Hytale Server Compression and Defaults Source: https://rentry.co/gykiza2m/edit Shows how to check if local compression is enabled and how to set default configurations for the Hytale server. This includes managing compression settings and applying default values. ```kotlin fun isLocalCompressionEnabled(): Boolean fun setLocalCompressionEnabled(Boolean) fun getDefaults(): Defaults fun setDefaults(Defaults) ``` -------------------------------- ### Get Hytale World Entity by UUID Source: https://rentry.co/gykiza2m/edit Shows how to retrieve an Entity object from a Hytale World using its unique identifier (UUID). Returns null if the entity is not found. ```kotlin fun getEntity(uuid: UUID): Entity? ``` -------------------------------- ### Table Formatting with Alignment and Newlines Source: https://rentry.co/gykiza2m/edit Shows how to create tables with adjustable column alignment (center, right) and how to insert newlines within cells and headers for multi-line content. ```markdown Header | Header ------ | ------ Cell | Cell line2 line3 Cell | Cell ``` -------------------------------- ### Get Hytale World Name and Status Source: https://rentry.co/gykiza2m/edit Shows how to retrieve the name of a Hytale World and check if it is currently alive or running. Basic information about the world's state. ```kotlin fun getName(): String fun isAlive(): Boolean ``` -------------------------------- ### Access Hytale Player Storage Source: https://rentry.co/gykiza2m/edit Shows how to get the PlayerStorage object from the Hytale Universe, which manages the persistence of player data. This is essential for saving and loading player information. ```kotlin fun getPlayerStorage(): PlayerStorage ``` -------------------------------- ### Access Hytale Server Core Systems (Kotlin) Source: https://rentry.co/gykiza2m/raw Demonstrates how to access the main Hytale server singleton to interact with core systems like the scheduled executor. This is essential for managing background tasks within the server environment. ```kotlin // Access the global scheduled executor for background tasks val executor: ScheduledExecutorService = HytaleServer.SCHEDULED_EXECUTOR // Schedule a repeating task executor.scheduleAtFixedRate({ // Your task code }, 0, 1, TimeUnit.SECONDS) ``` -------------------------------- ### Access Hytale Universe Default World Source: https://rentry.co/gykiza2m/edit Shows how to get a reference to the default world within the Hytale Universe. This is often the primary world instance players will interact with. ```kotlin val defaultWorld: World? = universe.defaultWorld ``` -------------------------------- ### Item Container Interface Source: https://rentry.co/gykiza2m/raw An interface for various item containers such as inventories and chests. It defines methods for getting, setting, adding, removing, and clearing items within a container. ```java int getSize() ItemStack getItem(int slot) void setItem(int slot, ItemStack item) boolean addItem(ItemStack item) boolean removeItem(ItemStack item) void clear() ``` -------------------------------- ### Access Hytale World Players List Source: https://rentry.co/gykiza2m/edit Demonstrates how to get a list of all Player objects currently present in a Hytale World. This provides access to players within a specific dimension. ```kotlin val players: List = world.players ``` -------------------------------- ### Get Player HUD Manager (Kotlin) Source: https://rentry.co/gykiza2m/raw Retrieves the HUD manager for a player, used for adding and managing custom UI elements on the Heads-Up Display. Part of the UI System. ```kotlin val hudManager = player.getHudManager() // Add custom HUD elements ``` -------------------------------- ### Access Hytale World Configuration Objects Source: https://rentry.co/gykiza2m/edit Demonstrates how to access various configuration objects for a Hytale World, including its main configuration, death configuration, and daytime settings. ```kotlin fun getWorldConfig(): WorldConfig fun getDeathConfig(): DeathConfig fun getDaytimeDurationSeconds(): Int fun getNighttimeDurationSeconds(): Int ``` -------------------------------- ### Creating and Inspecting ItemStacks in Kotlin Source: https://rentry.co/gykiza2m/edit Shows how to create ItemStack objects with varying levels of detail (ID, quantity, metadata) and how to check their properties like emptiness, validity, and breakability. Assumes a BsonDocument type for metadata. ```kotlin // Create item stacks val stack1 = ItemStack("item_id") val stack2 = ItemStack("item_id", 64) val stack3 = ItemStack("item_id", 64, metadata) // metadata is of type BsonDocument // Check properties val isEmpty = stack.isEmpty() val isValid = stack.isValid() val isBroken = stack.isBroken() val isUnbreakable = stack.isUnbreakable() ``` -------------------------------- ### Get Player Window Manager (Kotlin) Source: https://rentry.co/gykiza2m/raw Retrieves the window manager for a player, used for managing UI containers like inventory and crafting windows. Part of the UI System. ```kotlin val windowManager = player.getWindowManager() // Manage inventory windows, crafting UIs, etc. ``` -------------------------------- ### Server Events Source: https://rentry.co/gykiza2m/edit Handles core server lifecycle events, including booting, shutting down, and universe preparation. ```APIDOC ## Server Events ### Description Handles core server lifecycle events, including booting, shutting down, and universe preparation. ### Events | Event Name | |---| | `BootEvent` | | `ShutdownEvent` | | `PrepareUniverseEvent` | ### Description - `BootEvent`: Server is booting - `ShutdownEvent`: Server is shutting down - `PrepareUniverseEvent`: Universe preparing (can modify WorldConfigProvider) ``` -------------------------------- ### PlayerRef Position and Messaging Methods (Kotlin) Source: https://rentry.co/gykiza2m/edit Illustrates PlayerRef methods for managing position and sending messages. This includes getting transform data, updating position, and sending messages to the player. ```kotlin // Position fun getTransform(): Transform fun getWorldUuid(): UUID fun getHeadRotation(): Vector3f fun updatePosition(World, Transform, Vector3f) // Messaging fun sendMessage(Message) ``` -------------------------------- ### Creating Formatted Messages in Kotlin Source: https://rentry.co/gykiza2m/edit Demonstrates how to create and format messages using the Message class in Kotlin. It shows the creation of a simple raw text message and a more complex styled message with color, bold, italic, and monospace properties. ```kotlin // Simple text val msg = Message.raw("Hello, world!") // With formatting val styled = Message.raw("Important!") .color("red") .bold(true) .italic(false) .monospace(true) ```