This commit is contained in:
2026-01-20 20:33:59 +01:00
commit b16a40e431
583 changed files with 87339 additions and 0 deletions

View File

@@ -0,0 +1,83 @@
---
title: Reference
type: docs
weight: 7
---
Complete API reference and documentation for Hytale plugin development.
{{< cards >}}
{{< card link="manifest-schema" title="Manifest Schema" subtitle="Complete plugin.json specification" >}}
{{< card link="all-registries" title="All Registries" subtitle="Complete registry listing" >}}
{{< card link="buildertools" title="Builder Tools" subtitle="Creative mode construction tools" >}}
{{< /cards >}}
## API Overview
Hytale provides a comprehensive Java API for plugin development:
### Core Systems
- **PluginBase** - Base class for all plugins
- **Universe/World** - World management
- **Entity/Player** - Entity handling
- **Events** - Event system
- **Commands** - Command framework
### Registries
Access game systems through typed registries:
```java
public class MyPlugin extends PluginBase {
@Override
public void start() {
// All registries accessible via PluginBase
EventRegistry events = getEventRegistry();
CommandRegistry commands = getCommandRegistry();
TaskRegistry tasks = getTaskRegistry();
AssetRegistry assets = getAssetRegistry();
BlockStateRegistry blocks = getBlockStateRegistry();
CodecRegistry codecs = getCodecRegistry();
}
}
```
## Quick Reference
### Plugin Lifecycle
| Method | Called When |
|--------|-------------|
| `setup()` | Before start, for pre-initialization |
| `start()` | Plugin is enabled |
| `shutdown()` | Plugin is disabled |
### Event Priorities
| Priority | Value | Use Case |
|----------|-------|----------|
| FIRST | -21844 | Pre-processing, logging |
| EARLY | -10922 | Early modifications |
| NORMAL | 0 | Standard handlers |
| LATE | 10922 | Late modifications |
| LAST | 21844 | Final processing, cleanup |
### Common ArgTypes
| Type | Description |
|------|-------------|
| BOOLEAN | true/false |
| INTEGER | Whole numbers |
| DOUBLE | Decimal numbers |
| STRING | Single word text |
| GREEDY_STRING | Multi-word text |
| PLAYER_REF | Online player |
| WORLD | World name |
| ENTITY_ID | Entity UUID |
See [Command Arguments](/commands/arguments/) for the complete list.
## External Resources
- Hytale Official Website
- Plugin Development Forum
- Community Discord

View File

@@ -0,0 +1,81 @@
---
title: Référence
type: docs
weight: 7
---
Référence API complète et documentation pour le développement de plugins Hytale.
{{< cards >}}
{{< card link="manifest-schema" title="Schéma du Manifeste" subtitle="Spécification complète de plugin.json" >}}
{{< card link="all-registries" title="Tous les Registres" subtitle="Liste complète des registres" >}}
{{< card link="buildertools" title="Outils de Construction" subtitle="Outils de construction mode creatif" >}}
{{< /cards >}}
## Aperçu de l'API
Hytale fournit une API Java complète pour le développement de plugins :
### Systèmes Principaux
- **PluginBase** - Classe de base pour tous les plugins
- **Universe/World** - Gestion des mondes
- **Entity/Player** - Gestion des entités
- **Events** - Système d'événements
- **Commands** - Framework de commandes
### Registres
Accédez aux systèmes du jeu via des registres typés :
```java
public class MyPlugin extends PluginBase {
@Override
public void start() {
// Tous les registres accessibles via PluginBase
EventRegistry events = getEventRegistry();
CommandRegistry commands = getCommandRegistry();
TaskRegistry tasks = getTaskRegistry();
AssetRegistry assets = getAssetRegistry();
BlockStateRegistry blocks = getBlockStateRegistry();
CodecRegistry codecs = getCodecRegistry();
}
}
```
## Référence Rapide
### Cycle de Vie du Plugin
| Méthode | Appelée Quand |
|---------|---------------|
| `setup()` | Avant start, pour la pré-initialisation |
| `start()` | Le plugin est activé |
| `shutdown()` | Le plugin est désactivé |
### Priorités d'Événements
| Priorité | Valeur | Cas d'Usage |
|----------|--------|-------------|
| FIRST | -21844 | Pré-traitement, logging |
| EARLY | -10922 | Modifications précoces |
| NORMAL | 0 | Handlers standards |
| LATE | 10922 | Modifications tardives |
| LAST | 21844 | Traitement final, nettoyage |
### ArgTypes Courants
| Type | Description |
|------|-------------|
| BOOLEAN | true/false |
| INTEGER | Nombres entiers |
| DOUBLE | Nombres décimaux |
| STRING | Texte d'un mot |
| GREEDY_STRING | Texte multi-mots |
| PLAYER_REF | Joueur en ligne |
| WORLD | Nom du monde |
| ENTITY | Sélecteur d'entité |
## Ressources Externes
- Site Officiel Hytale
- Forum de Développement de Plugins
- Discord Communautaire

View File

@@ -0,0 +1,379 @@
---
title: All Registries
type: docs
weight: 2
---
Complete reference of all registries available in the Hytale Plugin API.
## Registry Overview
Registries are accessed through `PluginBase` methods:
```java
public class MyPlugin extends PluginBase {
@Override
public void start() {
EventRegistry events = getEventRegistry();
CommandRegistry commands = getCommandRegistry();
TaskRegistry tasks = getTaskRegistry();
AssetRegistry assets = getAssetRegistry();
BlockStateRegistry blocks = getBlockStateRegistry();
CodecRegistry codecs = getCodecRegistry();
EntityRegistry entities = getEntityRegistry();
}
}
```
## EventRegistry
Manages event listeners and dispatching.
### Methods
| Method | Description |
|--------|-------------|
| `register(Class, Consumer)` | Register event handler |
| `register(EventPriority, Class, Consumer)` | Register with priority |
| `registerGlobal(Class, Consumer)` | Register global handler |
| `registerAsync(Class, Function)` | Register async handler |
| `unregister(listener)` | Remove listener |
### Example
```java
import com.hypixel.hytale.event.EventRegistry;
import com.hypixel.hytale.event.EventPriority;
import com.hypixel.hytale.server.core.event.events.player.PlayerConnectEvent;
import com.hypixel.hytale.server.core.event.events.player.PlayerDisconnectEvent;
import com.hypixel.hytale.server.core.universe.PlayerRef;
import com.hypixel.hytale.server.core.Message;
import java.util.logging.Level;
EventRegistry events = getEventRegistry();
// Use getPlayerRef() - getPlayer() is deprecated
events.register(PlayerConnectEvent.class, event -> {
PlayerRef playerRef = event.getPlayerRef();
playerRef.sendMessage(Message.raw("Welcome!"));
});
events.register(EventPriority.FIRST, PlayerDisconnectEvent.class, event -> {
PlayerRef playerRef = event.getPlayerRef();
getLogger().at(Level.INFO).log(playerRef.getUsername() + " left");
});
```
## CommandRegistry
Manages command registration and execution.
### Methods
| Method | Description |
|--------|-------------|
| `registerCommand(AbstractCommand)` | Register a command |
### Example
```java
import com.hypixel.hytale.server.core.command.system.AbstractCommand;
import com.hypixel.hytale.server.core.command.system.CommandContext;
import com.hypixel.hytale.server.core.command.system.CommandRegistry;
import com.hypixel.hytale.server.core.Message;
import java.util.concurrent.CompletableFuture;
CommandRegistry commands = getCommandRegistry();
// Register a command - AbstractCommand.execute() returns CompletableFuture<Void>
commands.registerCommand(new AbstractCommand("hello", "my_plugin.commands.hello.description") {
@Override
protected CompletableFuture<Void> execute(CommandContext ctx) {
ctx.sender().sendMessage(Message.raw("Hello, World!"));
return null; // Return null for synchronous completion
}
});
```
{{< callout type="info" >}}
**Note:** Create a dedicated command class by extending `AbstractCommand` for complex commands. See [Creating Commands](/commands/creating-commands/) for details.
{{< /callout >}}
## TaskRegistry
Tracks asynchronous tasks for cleanup during plugin shutdown.
{{< callout type="warning" >}}
**Important:** TaskRegistry does NOT have `runAsync()`, `runSync()`, `runLater()`, or `runRepeating()` methods. Use Java's standard concurrency APIs instead.
{{< /callout >}}
### Methods
| Method | Description |
|--------|-------------|
| `registerTask(CompletableFuture<Void>)` | Register a CompletableFuture for tracking |
| `registerTask(ScheduledFuture<Void>)` | Register a ScheduledFuture for tracking |
### Example
```java
// Async operation
CompletableFuture<Void> task = CompletableFuture.runAsync(() -> {
// Background work
Data result = heavyComputation();
world.execute(() -> {
playerRef.sendMessage(Message.raw("Done: " + result));
});
});
getTaskRegistry().registerTask(task);
// Delayed operation (3 seconds)
CompletableFuture.delayedExecutor(3, TimeUnit.SECONDS)
.execute(() -> {
world.execute(() -> {
getLogger().at(Level.INFO).log("3 seconds passed!");
});
});
// Repeating operation
ScheduledExecutorService scheduler = Executors.newSingleThreadScheduledExecutor();
ScheduledFuture<?> repeating = scheduler.scheduleAtFixedRate(() -> {
broadcastTime();
}, 0, 5, TimeUnit.MINUTES);
getTaskRegistry().registerTask((ScheduledFuture<Void>) repeating);
```
## AssetRegistry
Registers custom asset stores with the game.
**Package:** `com.hypixel.hytale.server.core.plugin.registry`
{{< callout type="warning" >}}
**Important:** `AssetRegistry` does NOT provide `getItem()`, `getBlockType()`, etc. methods. To access assets, use the asset class's static methods directly.
{{< /callout >}}
### Methods
| Method | Description |
|--------|-------------|
| `register(AssetStore)` | Register a custom AssetStore |
### Accessing Assets
Assets are accessed via their class's static methods, not through AssetRegistry:
```java
import com.hypixel.hytale.assetstore.map.DefaultAssetMap;
import com.hypixel.hytale.server.core.asset.type.item.config.Item;
import com.hypixel.hytale.server.core.asset.type.blocktype.config.BlockType;
// Get items by string ID directly (DefaultAssetMap)
DefaultAssetMap<String, Item> itemMap = Item.getAssetMap();
Item sword = itemMap.getAsset("iron_sword");
// Get block types
DefaultAssetMap<String, BlockType> blockMap = BlockType.getAssetMap();
BlockType stone = blockMap.getAsset("stone");
```
{{< callout type="info" >}}
**Note:** Most assets like `Item` and `BlockType` use `DefaultAssetMap` where you can access by string key directly. Some assets like `Interaction` use `IndexedLookupTableAssetMap` which requires getting the index first.
{{< /callout >}}
### Custom Asset Store Registration
```java
AssetRegistry assets = getAssetRegistry();
// Register a custom asset store
assets.register(MyCustomAsset.getAssetStore());
```
## BlockStateRegistry
Manages block states and their properties.
### Methods
| Method | Description |
|--------|-------------|
| `getBlockState(BlockType)` | Get default state |
| `getBlockState(BlockType, Properties)` | Get state with properties |
### Example
```java
BlockStateRegistry blocks = getBlockStateRegistry();
BlockState stone = blocks.getBlockState(stoneType);
world.setBlockState(x, y, z, stone);
```
## Codec Registration
**Package:** `com.hypixel.hytale.server.core.plugin.registry`
{{< callout type="warning" >}}
**Important:** There is no simple `CodecRegistry` class. Instead, use the typed `getCodecRegistry()` methods with codec map parameters.
{{< /callout >}}
### Methods
| Method | Description |
|--------|-------------|
| `getCodecRegistry(StringCodecMapCodec)` | Get CodecMapRegistry for string-keyed codecs |
| `getCodecRegistry(AssetCodecMapCodec)` | Get CodecMapRegistry.Assets for asset codecs |
| `getCodecRegistry(MapKeyMapCodec)` | Get MapKeyMapRegistry for map-keyed codecs |
### Example
```java
import com.hypixel.hytale.codec.builder.BuilderCodec;
import com.hypixel.hytale.server.core.plugin.registry.CodecMapRegistry;
import com.hypixel.hytale.server.core.modules.interaction.interaction.config.Interaction;
// Register a custom interaction type using the Interaction CODEC
CodecMapRegistry.Assets<Interaction, ?> registry =
getCodecRegistry(Interaction.CODEC);
registry.register("MyCustomInteraction", MyCustomInteraction.class, MyCustomInteraction.CODEC);
```
For simple data serialization, use `BuilderCodec` directly:
```java
import com.hypixel.hytale.codec.builder.BuilderCodec;
import com.hypixel.hytale.codec.KeyedCodec;
import com.hypixel.hytale.codec.Codec;
// Define a codec for your data class
public static final BuilderCodec<PlayerData> CODEC = BuilderCodec.builder(PlayerData.class, PlayerData::new)
.append(new KeyedCodec<>("name", Codec.STRING),
(obj, val) -> obj.name = val,
obj -> obj.name)
.add()
.build();
```
## EntityRegistry
Registers custom entity types with the game.
**Package:** `com.hypixel.hytale.server.core.modules.entity`
{{< callout type="warning" >}}
**Important:** `EntityRegistry` is for registering custom entity types, NOT for spawning entities. To spawn entities, use `World.spawnEntity()`.
{{< /callout >}}
### Methods
| Method | Description |
|--------|-------------|
| `registerEntity(String, Class, Function, Codec)` | Register a custom entity type |
### Registering Custom Entities
```java
import com.hypixel.hytale.server.core.entity.Entity;
import com.hypixel.hytale.codec.DirectDecodeCodec;
EntityRegistry entities = getEntityRegistry();
// Register a custom entity type
entities.registerEntity(
"my_custom_entity",
MyCustomEntity.class,
world -> new MyCustomEntity(world),
MyCustomEntity.CODEC
);
```
### Spawning Entities
To spawn entities at runtime, use `World`:
```java
import com.hypixel.hytale.server.core.universe.world.World;
import com.hypixel.hytale.server.core.entity.Entity;
World world = player.getWorld();
// Spawn an entity
Entity entity = world.spawnEntity(entityClass, position);
```
## Registry Access Patterns
### Lazy Initialization
```java
public class MyPlugin extends PluginBase {
private EventRegistry events;
private CommandRegistry commands;
@Override
public void start() {
this.events = getEventRegistry();
this.commands = getCommandRegistry();
registerEvents();
registerCommands();
}
private void registerEvents() {
events.register(PlayerConnectEvent.class, this::onJoin);
}
private void registerCommands() {
commands.register(new MyCommand());
}
}
```
### Helper Methods
```java
public class MyPlugin extends JavaPlugin {
public void runOnWorldThread(World world, Runnable task) {
world.execute(task);
}
public void runAsync(Runnable task) {
CompletableFuture.runAsync(task);
}
public Item getItem(String id) {
return getAssetRegistry().getItem(id);
}
}
```
## Thread Safety
{{< callout type="warning" >}}
**Registry Thread Safety:**
- Most registries are designed for world thread access
- Each World runs on its own dedicated thread
- Use `world.execute()` when accessing from async code
- TaskRegistry is thread-safe for task registration
{{< /callout >}}
```java
// Safe async pattern
World world = player.getWorld();
PlayerRef playerRef = player.getPlayerRef();
CompletableFuture.runAsync(() -> {
// Background work
Data result = compute();
// Return to world thread for game state changes
world.execute(() -> {
// Access other registries here safely
EventRegistry events = getEventRegistry();
playerRef.sendMessage(Message.raw("Result: " + result));
});
});
```

View File

@@ -0,0 +1,379 @@
---
title: Tous les Registres
type: docs
weight: 2
---
Référence complète de tous les registres disponibles dans l'API Plugin Hytale.
## Aperçu des Registres
Les registres sont accessibles via les méthodes de `PluginBase` :
```java
public class MyPlugin extends PluginBase {
@Override
public void start() {
EventRegistry events = getEventRegistry();
CommandRegistry commands = getCommandRegistry();
TaskRegistry tasks = getTaskRegistry();
AssetRegistry assets = getAssetRegistry();
BlockStateRegistry blocks = getBlockStateRegistry();
CodecRegistry codecs = getCodecRegistry();
EntityRegistry entities = getEntityRegistry();
}
}
```
## EventRegistry
Gère les écouteurs d'événements et la diffusion.
### Méthodes
| Méthode | Description |
|---------|-------------|
| `register(Class, Consumer)` | Enregistrer un handler d'événement |
| `register(EventPriority, Class, Consumer)` | Enregistrer avec priorité |
| `registerGlobal(Class, Consumer)` | Enregistrer un handler global |
| `registerAsync(Class, Function)` | Enregistrer un handler async |
| `unregister(listener)` | Supprimer un écouteur |
### Exemple
```java
import com.hypixel.hytale.event.EventRegistry;
import com.hypixel.hytale.event.EventPriority;
import com.hypixel.hytale.server.core.event.events.player.PlayerConnectEvent;
import com.hypixel.hytale.server.core.event.events.player.PlayerDisconnectEvent;
import com.hypixel.hytale.server.core.universe.PlayerRef;
import com.hypixel.hytale.server.core.Message;
import java.util.logging.Level;
EventRegistry events = getEventRegistry();
// Utilisez getPlayerRef() - getPlayer() est déprécié
events.register(PlayerConnectEvent.class, event -> {
PlayerRef playerRef = event.getPlayerRef();
playerRef.sendMessage(Message.raw("Bienvenue !"));
});
events.register(EventPriority.FIRST, PlayerDisconnectEvent.class, event -> {
PlayerRef playerRef = event.getPlayerRef();
getLogger().at(Level.INFO).log(playerRef.getUsername() + " est parti");
});
```
## CommandRegistry
Gère l'enregistrement et l'exécution des commandes.
### Méthodes
| Méthode | Description |
|---------|-------------|
| `registerCommand(AbstractCommand)` | Enregistrer une commande |
### Exemple
```java
import com.hypixel.hytale.server.core.command.system.AbstractCommand;
import com.hypixel.hytale.server.core.command.system.CommandContext;
import com.hypixel.hytale.server.core.command.system.CommandRegistry;
import com.hypixel.hytale.server.core.Message;
import java.util.concurrent.CompletableFuture;
CommandRegistry commands = getCommandRegistry();
// Enregistrer une commande - AbstractCommand.execute() retourne CompletableFuture<Void>
commands.registerCommand(new AbstractCommand("hello", "my_plugin.commands.hello.description") {
@Override
protected CompletableFuture<Void> execute(CommandContext ctx) {
ctx.sender().sendMessage(Message.raw("Bonjour, Monde !"));
return null; // Retourner null pour une complétion synchrone
}
});
```
{{< callout type="info" >}}
**Note :** Créez une classe de commande dédiée en étendant `AbstractCommand` pour les commandes complexes. Voir [Créer des Commandes](/fr/commands/creating-commands/) pour les détails.
{{< /callout >}}
## TaskRegistry
Suit les tâches asynchrones pour le nettoyage lors de l'arrêt du plugin.
{{< callout type="warning" >}}
**Important :** TaskRegistry n'a PAS de méthodes `runAsync()`, `runSync()`, `runLater()`, ou `runRepeating()`. Utilisez les APIs de concurrence standard de Java à la place.
{{< /callout >}}
### Méthodes
| Méthode | Description |
|---------|-------------|
| `registerTask(CompletableFuture<Void>)` | Enregistrer un CompletableFuture pour le suivi |
| `registerTask(ScheduledFuture<Void>)` | Enregistrer un ScheduledFuture pour le suivi |
### Exemple
```java
// Opération async
CompletableFuture<Void> task = CompletableFuture.runAsync(() -> {
// Travail en arrière-plan
Data result = heavyComputation();
world.execute(() -> {
playerRef.sendMessage(Message.raw("Terminé : " + result));
});
});
getTaskRegistry().registerTask(task);
// Opération différée (3 secondes)
CompletableFuture.delayedExecutor(3, TimeUnit.SECONDS)
.execute(() -> {
world.execute(() -> {
getLogger().at(Level.INFO).log("3 secondes passées !");
});
});
// Opération répétitive
ScheduledExecutorService scheduler = Executors.newSingleThreadScheduledExecutor();
ScheduledFuture<?> repeating = scheduler.scheduleAtFixedRate(() -> {
broadcastTime();
}, 0, 5, TimeUnit.MINUTES);
getTaskRegistry().registerTask((ScheduledFuture<Void>) repeating);
```
## AssetRegistry
Enregistre les stores d'assets personnalisés avec le jeu.
**Package :** `com.hypixel.hytale.server.core.plugin.registry`
{{< callout type="warning" >}}
**Important :** `AssetRegistry` ne fournit PAS de méthodes `getItem()`, `getBlockType()`, etc. Pour accéder aux assets, utilisez directement les méthodes statiques de la classe d'asset.
{{< /callout >}}
### Méthodes
| Méthode | Description |
|---------|-------------|
| `register(AssetStore)` | Enregistrer un AssetStore personnalisé |
### Accéder aux Assets
Les assets sont accessibles via les méthodes statiques de leur classe, pas via AssetRegistry :
```java
import com.hypixel.hytale.assetstore.map.DefaultAssetMap;
import com.hypixel.hytale.server.core.asset.type.item.config.Item;
import com.hypixel.hytale.server.core.asset.type.blocktype.config.BlockType;
// Obtenir les objets par ID string directement (DefaultAssetMap)
DefaultAssetMap<String, Item> itemMap = Item.getAssetMap();
Item sword = itemMap.getAsset("iron_sword");
// Obtenir les types de blocs
DefaultAssetMap<String, BlockType> blockMap = BlockType.getAssetMap();
BlockType stone = blockMap.getAsset("stone");
```
{{< callout type="info" >}}
**Note :** La plupart des assets comme `Item` et `BlockType` utilisent `DefaultAssetMap` où vous pouvez accéder directement par clé string. Certains assets comme `Interaction` utilisent `IndexedLookupTableAssetMap` qui nécessite d'obtenir l'index d'abord.
{{< /callout >}}
### Enregistrement d'Asset Store Personnalisé
```java
AssetRegistry assets = getAssetRegistry();
// Enregistrer un asset store personnalisé
assets.register(MyCustomAsset.getAssetStore());
```
## BlockStateRegistry
Gère les états de blocs et leurs propriétés.
### Méthodes
| Méthode | Description |
|---------|-------------|
| `getBlockState(BlockType)` | Obtenir l'état par défaut |
| `getBlockState(BlockType, Properties)` | Obtenir l'état avec propriétés |
### Exemple
```java
BlockStateRegistry blocks = getBlockStateRegistry();
BlockState stone = blocks.getBlockState(stoneType);
world.setBlockState(x, y, z, stone);
```
## Enregistrement de Codecs
**Package :** `com.hypixel.hytale.server.core.plugin.registry`
{{< callout type="warning" >}}
**Important :** Il n'y a pas de classe `CodecRegistry` simple. Utilisez plutôt les méthodes typées `getCodecRegistry()` avec des paramètres de codec map.
{{< /callout >}}
### Méthodes
| Méthode | Description |
|---------|-------------|
| `getCodecRegistry(StringCodecMapCodec)` | Obtenir CodecMapRegistry pour codecs à clés string |
| `getCodecRegistry(AssetCodecMapCodec)` | Obtenir CodecMapRegistry.Assets pour codecs d'assets |
| `getCodecRegistry(MapKeyMapCodec)` | Obtenir MapKeyMapRegistry pour codecs à clés map |
### Exemple
```java
import com.hypixel.hytale.codec.builder.BuilderCodec;
import com.hypixel.hytale.server.core.plugin.registry.CodecMapRegistry;
import com.hypixel.hytale.server.core.modules.interaction.interaction.config.Interaction;
// Enregistrer un type d'interaction personnalisé utilisant le CODEC d'Interaction
CodecMapRegistry.Assets<Interaction, ?> registry =
getCodecRegistry(Interaction.CODEC);
registry.register("MyCustomInteraction", MyCustomInteraction.class, MyCustomInteraction.CODEC);
```
Pour la sérialisation simple de données, utilisez `BuilderCodec` directement :
```java
import com.hypixel.hytale.codec.builder.BuilderCodec;
import com.hypixel.hytale.codec.KeyedCodec;
import com.hypixel.hytale.codec.Codec;
// Définir un codec pour votre classe de données
public static final BuilderCodec<PlayerData> CODEC = BuilderCodec.builder(PlayerData.class, PlayerData::new)
.append(new KeyedCodec<>("name", Codec.STRING),
(obj, val) -> obj.name = val,
obj -> obj.name)
.add()
.build();
```
## EntityRegistry
Enregistre les types d'entités personnalisés avec le jeu.
**Package :** `com.hypixel.hytale.server.core.modules.entity`
{{< callout type="warning" >}}
**Important :** `EntityRegistry` sert à enregistrer des types d'entités personnalisés, PAS à faire apparaître des entités. Pour faire apparaître des entités, utilisez `World.spawnEntity()`.
{{< /callout >}}
### Méthodes
| Méthode | Description |
|---------|-------------|
| `registerEntity(String, Class, Function, Codec)` | Enregistrer un type d'entité personnalisé |
### Enregistrer des Entités Personnalisées
```java
import com.hypixel.hytale.server.core.entity.Entity;
import com.hypixel.hytale.codec.DirectDecodeCodec;
EntityRegistry entities = getEntityRegistry();
// Enregistrer un type d'entité personnalisé
entities.registerEntity(
"my_custom_entity",
MyCustomEntity.class,
world -> new MyCustomEntity(world),
MyCustomEntity.CODEC
);
```
### Faire Apparaître des Entités
Pour faire apparaître des entités à l'exécution, utilisez `World` :
```java
import com.hypixel.hytale.server.core.universe.world.World;
import com.hypixel.hytale.server.core.entity.Entity;
World world = player.getWorld();
// Faire apparaître une entité
Entity entity = world.spawnEntity(entityClass, position);
```
## Patterns d'Accès aux Registres
### Initialisation Différée
```java
public class MyPlugin extends PluginBase {
private EventRegistry events;
private CommandRegistry commands;
@Override
public void start() {
this.events = getEventRegistry();
this.commands = getCommandRegistry();
registerEvents();
registerCommands();
}
private void registerEvents() {
events.register(PlayerConnectEvent.class, this::onJoin);
}
private void registerCommands() {
commands.registerCommand(new MyCommand());
}
}
```
### Méthodes Helper
```java
public class MyPlugin extends JavaPlugin {
public void runOnWorldThread(World world, Runnable task) {
world.execute(task);
}
public void runAsync(Runnable task) {
CompletableFuture.runAsync(task);
}
public Item getItem(String id) {
return Item.getAssetMap().getAsset(id);
}
}
```
## Sécurité des Threads
{{< callout type="warning" >}}
**Sécurité des Threads des Registres :**
- La plupart des registres sont conçus pour l'accès sur le thread du monde
- Chaque World s'exécute sur son propre thread dédié
- Utilisez `world.execute()` lors de l'accès depuis du code async
- TaskRegistry est thread-safe pour l'enregistrement des tâches
{{< /callout >}}
```java
// Pattern async sûr
World world = player.getWorld();
PlayerRef playerRef = player.getPlayerRef();
CompletableFuture.runAsync(() -> {
// Travail en arrière-plan
Data result = compute();
// Retourner au thread du monde pour les changements d'état du jeu
world.execute(() -> {
// Accéder aux autres registres ici en sécurité
EventRegistry events = getEventRegistry();
playerRef.sendMessage(Message.raw("Résultat : " + result));
});
});
```

View File

@@ -0,0 +1,126 @@
---
title: Builder Tools
type: docs
weight: 3
---
The Builder Tools system provides world editing capabilities for creative mode, including selection operations, scripted brushes, and prefab editing.
**Package:** `com.hypixel.hytale.builtin.buildertools`
## Architecture
```
BuilderToolsPlugin
├── Commands (37+)
│ ├── Selection: /pos1, /pos2, /deselect, /expand, /contract, /shift
│ ├── Clipboard: /copy, /cut, /paste, /rotate, /flip
│ ├── Modification: /set, /fill, /replace, /walls, /hollow
│ ├── History: /undo, /redo, /clearhistory
│ └── Utilities: /stack, /move, /tint, /submerge
├── Scripted Brushes
│ ├── ScriptedBrushAsset - Brush definitions
│ ├── BrushOperation - Operation base classes
│ └── BrushConfigCommand - Brush configuration
├── Prefab Editor
│ ├── PrefabEditSession - Editing session
│ ├── PrefabAnchor - Anchor points
│ └── PrefabCommand - Prefab commands
├── Snapshots
│ ├── SelectionSnapshot - Selection history
│ ├── ClipboardContentsSnapshot - Clipboard data
│ └── EntityTransformSnapshot - Entity changes
├── Tool Operations
│ ├── PaintOperation - Paint blocks
│ └── ToolOperation - Base operations
└── Systems
├── BuilderToolsSystems - Main processing
└── BuilderToolsUserDataSystem - Per-user data
```
## Commands Overview
### Selection Commands
| Command | Description |
|---------|-------------|
| `/pos1` | Set selection point 1 |
| `/pos2` | Set selection point 2 |
| `/deselect` | Clear selection |
| `/expand <amount> [direction]` | Expand selection |
| `/contract <amount> [direction]` | Contract selection |
| `/shift <amount> [direction]` | Move selection |
| `/selectchunk` | Select entire chunk |
| `/selectchunksection` | Select chunk section |
### Clipboard Commands
| Command | Description |
|---------|-------------|
| `/copy` | Copy selection to clipboard |
| `/cut` | Cut selection to clipboard |
| `/paste` | Paste clipboard |
| `/rotate <angle>` | Rotate clipboard |
| `/flip <axis>` | Flip clipboard |
### Modification Commands
| Command | Description |
|---------|-------------|
| `/set <pattern>` | Fill selection with blocks |
| `/fill <pattern>` | Fill selection |
| `/replace <from> <to>` | Replace blocks |
| `/walls <pattern>` | Create walls around selection |
| `/hollow` | Hollow out selection |
| `/stack <count> [direction]` | Stack selection |
| `/move <direction> <amount>` | Move blocks |
### History Commands
| Command | Description |
|---------|-------------|
| `/undo [count]` | Undo operations |
| `/redo [count]` | Redo operations |
| `/clearedithistory` | Clear edit history |
| `/settoolhistorysize <size>` | Set history limit |
### Utility Commands
| Command | Description |
|---------|-------------|
| `/tint <color>` | Tint blocks |
| `/submerge <depth>` | Submerge selection |
| `/clearblocks` | Clear blocks |
| `/clearentities` | Clear entities |
| `/environment` | Set environment |
| `/globalmask` | Set global mask |
## Quick Start
```java
// Builder tools are enabled in creative mode
// Players can use selection and editing commands
// Programmatic access to builder tools data via ECS components
import com.hypixel.hytale.builtin.buildertools.BuilderToolsPlugin;
import com.hypixel.hytale.builtin.buildertools.BuilderToolsUserData;
import com.hypixel.hytale.component.CommandBuffer;
import com.hypixel.hytale.component.Ref;
// Get the component type
BuilderToolsPlugin builderTools = BuilderToolsPlugin.get();
ComponentType<EntityStore, BuilderToolsUserData> userDataType = builderTools.getUserDataComponentType();
// Access user data via command buffer
BuilderToolsUserData userData = commandBuffer.getComponent(playerRef, userDataType);
```
## Section Contents
{{< cards >}}
{{< card link="scripted-brushes" title="Scripted Brushes" subtitle="Programmable brush operations" icon="code" >}}
{{< card link="builder-commands" title="Builder Commands" subtitle="All building commands reference" icon="terminal" >}}
{{< card link="prefab-editor" title="Prefab Editor" subtitle="Create and edit prefabs" icon="cube" >}}
{{< card link="tool-operations" title="Tool Operations" subtitle="Block painting and editing" icon="pencil" >}}
{{< card link="snapshots" title="Snapshots" subtitle="Undo/redo and history" icon="clock" >}}
{{< /cards >}}

View File

@@ -0,0 +1,126 @@
---
title: Outils de Construction
type: docs
weight: 3
---
Le systeme d'outils de construction fournit des capacites d'edition de monde pour le mode creatif, incluant operations de selection, brosses scriptees et edition de prefabs.
**Package:** `com.hypixel.hytale.builtin.buildertools`
## Architecture
```
BuilderToolsPlugin
├── Commandes (37+)
│ ├── Selection: /pos1, /pos2, /deselect, /expand, /contract, /shift
│ ├── Presse-papiers: /copy, /cut, /paste, /rotate, /flip
│ ├── Modification: /set, /fill, /replace, /walls, /hollow
│ ├── Historique: /undo, /redo, /clearhistory
│ └── Utilitaires: /stack, /move, /tint, /submerge
├── Brosses Scriptees
│ ├── ScriptedBrushAsset - Definitions de brosses
│ ├── BrushOperation - Classes de base operations
│ └── BrushConfigCommand - Configuration brosses
├── Editeur Prefab
│ ├── PrefabEditSession - Session d'edition
│ ├── PrefabAnchor - Points d'ancrage
│ └── PrefabCommand - Commandes prefab
├── Snapshots
│ ├── SelectionSnapshot - Historique selection
│ ├── ClipboardContentsSnapshot - Donnees presse-papiers
│ └── EntityTransformSnapshot - Changements entites
├── Operations Outil
│ ├── PaintOperation - Peindre blocs
│ └── ToolOperation - Operations de base
└── Systemes
├── BuilderToolsSystems - Traitement principal
└── BuilderToolsUserDataSystem - Donnees par utilisateur
```
## Apercu des Commandes
### Commandes de Selection
| Commande | Description |
|----------|-------------|
| `/pos1` | Definir point de selection 1 |
| `/pos2` | Definir point de selection 2 |
| `/deselect` | Effacer selection |
| `/expand <montant> [direction]` | Etendre selection |
| `/contract <montant> [direction]` | Contracter selection |
| `/shift <montant> [direction]` | Deplacer selection |
| `/selectchunk` | Selectionner chunk entier |
| `/selectchunksection` | Selectionner section chunk |
### Commandes Presse-papiers
| Commande | Description |
|----------|-------------|
| `/copy` | Copier selection vers presse-papiers |
| `/cut` | Couper selection vers presse-papiers |
| `/paste` | Coller presse-papiers |
| `/rotate <angle>` | Pivoter presse-papiers |
| `/flip <axe>` | Retourner presse-papiers |
### Commandes de Modification
| Commande | Description |
|----------|-------------|
| `/set <pattern>` | Remplir selection avec blocs |
| `/fill <pattern>` | Remplir selection |
| `/replace <de> <vers>` | Remplacer blocs |
| `/walls <pattern>` | Creer murs autour selection |
| `/hollow` | Evider selection |
| `/stack <nombre> [direction]` | Empiler selection |
| `/move <direction> <montant>` | Deplacer blocs |
### Commandes Historique
| Commande | Description |
|----------|-------------|
| `/undo [nombre]` | Annuler operations |
| `/redo [nombre]` | Refaire operations |
| `/clearedithistory` | Effacer historique edition |
| `/settoolhistorysize <taille>` | Definir limite historique |
### Commandes Utilitaires
| Commande | Description |
|----------|-------------|
| `/tint <couleur>` | Teinter blocs |
| `/submerge <profondeur>` | Submerger selection |
| `/clearblocks` | Effacer blocs |
| `/clearentities` | Effacer entites |
| `/environment` | Definir environnement |
| `/globalmask` | Definir masque global |
## Demarrage Rapide
```java
// Les outils de construction sont actives en mode creatif
// Les joueurs peuvent utiliser les commandes de selection et edition
// Acces programmatique aux donnees outils construction via composants ECS
import com.hypixel.hytale.builtin.buildertools.BuilderToolsPlugin;
import com.hypixel.hytale.builtin.buildertools.BuilderToolsUserData;
import com.hypixel.hytale.component.CommandBuffer;
import com.hypixel.hytale.component.Ref;
// Obtenir le type de composant
BuilderToolsPlugin builderTools = BuilderToolsPlugin.get();
ComponentType<EntityStore, BuilderToolsUserData> userDataType = builderTools.getUserDataComponentType();
// Accéder aux données utilisateur via command buffer
BuilderToolsUserData userData = commandBuffer.getComponent(playerRef, userDataType);
```
## Contenu de la Section
{{< cards >}}
{{< card link="scripted-brushes" title="Brosses Scriptees" subtitle="Operations de brosses programmables" icon="code" >}}
{{< card link="builder-commands" title="Commandes Construction" subtitle="Reference de toutes les commandes" icon="terminal" >}}
{{< card link="prefab-editor" title="Editeur Prefab" subtitle="Creer et editer prefabs" icon="cube" >}}
{{< card link="tool-operations" title="Operations Outil" subtitle="Peinture et edition blocs" icon="pencil" >}}
{{< card link="snapshots" title="Snapshots" subtitle="Annuler/refaire et historique" icon="clock" >}}
{{< /cards >}}

View File

@@ -0,0 +1,394 @@
---
title: Builder Commands
type: docs
weight: 2
---
Complete reference for all builder tool commands available in creative mode.
**Package:** `com.hypixel.hytale.builtin.buildertools.commands`
## Selection Commands
### /pos1, /pos2
Set selection corners at current position or specified coordinates.
```
/pos1 [<x> <y> <z>]
/pos2 [<x> <y> <z>]
```
**Examples:**
- `/pos1` - Set pos1 at current position
- `/pos1 100 64 200` - Set pos1 at coordinates
- `/pos2 ~10 ~ ~10` - Set pos2 relative to current position
### /deselect
Clear the current selection.
```
/deselect
```
### /expand
Expand selection in a direction.
```
/expand <amount> [direction]
```
**Directions:** `up`, `down`, `north`, `south`, `east`, `west`, `all`
**Examples:**
- `/expand 10 up` - Expand 10 blocks upward
- `/expand 5 all` - Expand 5 blocks in all directions
### /contract
Contract selection from a direction.
```
/contract <amount> [direction]
```
### /shift
Move selection without affecting blocks.
```
/shift <amount> [direction]
```
### /selectchunk
Select the entire chunk at current position.
```
/selectchunk
```
### /selectchunksection
Select a 16x16x16 chunk section.
```
/selectchunksection
```
### /selectionhistory
Navigate selection history.
```
/selectionhistory undo
/selectionhistory redo
```
### /updateselection
Refresh selection display.
```
/updateselection
```
## Clipboard Commands
### /copy
Copy selection to clipboard.
```
/copy
```
### /cut
Cut selection to clipboard (removes blocks).
```
/cut
```
### /paste
Paste clipboard at current position.
```
/paste [flags]
```
**Flags:**
- `-a` - Ignore air blocks
- `-e` - Include entities
- `-o` - Paste at original location
### /rotate
Rotate clipboard contents.
```
/rotate <angle>
```
**Angles:** `90`, `180`, `270`
### /flip
Flip clipboard contents.
```
/flip <axis>
```
**Axes:** `x`, `y`, `z`
## Modification Commands
### /set
Fill selection with a block pattern.
```
/set <pattern>
```
**Examples:**
- `/set [Stone]` - Fill with stone
- `/set [50%Stone, 50%Dirt]` - Fill with weighted random
- `/set [Air]` - Clear selection
### /fill
Fill selection (alias for set).
```
/fill <pattern>
```
### /replace
Replace blocks matching a mask.
```
/replace <from> <to>
```
**Examples:**
- `/replace [Stone] [Dirt]` - Replace stone with dirt
- `/replace [!Air] [Glass]` - Replace all non-air with glass
### /walls
Create walls around selection.
```
/walls <pattern>
```
### /hollow
Hollow out the selection, leaving only walls.
```
/hollow [thickness]
```
### /stack
Stack selection multiple times.
```
/stack <count> [direction]
```
**Examples:**
- `/stack 5 up` - Stack 5 times upward
- `/stack 10 north` - Stack 10 times north
### /move
Move blocks in selection.
```
/move <direction> <amount>
```
## History Commands
### /undo
Undo previous operations.
```
/undo [count]
```
### /redo
Redo undone operations.
```
/redo [count]
```
### /clearedithistory
Clear all edit history.
```
/clearedithistory
```
### /settoolhistorysize
Set maximum history size.
```
/settoolhistorysize <size>
```
## Utility Commands
### /tint
Apply color tint to blocks.
```
/tint <color>
```
### /submerge
Submerge selection in fluid.
```
/submerge <depth>
```
### /clearblocks
Clear all blocks in selection.
```
/clearblocks
```
### /clearentities
Clear all entities in selection.
```
/clearentities
```
### /environment
Set environment for area.
```
/environment <environment_id>
```
### /globalmask
Set a global mask for all operations.
```
/globalmask <mask>
/globalmask clear
```
### /editline
Create a line of blocks.
```
/editline <pattern>
```
### /extendface
Extend a face of selection.
```
/extendface <direction> <amount>
```
### /hotbarswitch
Switch builder tool hotbar.
```
/hotbarswitch <slot>
```
### /repairfillers
Repair filler blocks.
```
/repairfillers
```
## Import Commands
### /imageimport
Import image as blocks.
```
/imageimport <file>
```
### /objimport
Import OBJ model as blocks.
```
/objimport <file>
```
## Prefab Commands
### /prefab
Manage prefabs.
```
/prefab save <name>
/prefab load <name>
/prefab list
/prefab delete <name>
```
### /prefabedit
Enter prefab editing mode.
```
/prefabedit <prefab_id>
```
## Block Patterns
Pattern syntax used by many commands:
| Syntax | Description | Example |
|--------|-------------|---------|
| `[Block]` | Single block | `[Stone]` |
| `[Block1, Block2]` | Equal weights | `[Stone, Dirt]` |
| `[N%Block]` | Weighted | `[70%Stone, 30%Dirt]` |
| `[!Block]` | Exclude | `[!Air]` |
| `[!^Tag]` | Exclude tag | `[!^Fluid]` |
## Permissions
Builder commands require creative mode or appropriate permissions:
```
buildertools.command.<command_name>
```

View File

@@ -0,0 +1,394 @@
---
title: Commandes Construction
type: docs
weight: 2
---
Reference complete pour toutes les commandes d'outils de construction disponibles en mode creatif.
**Package:** `com.hypixel.hytale.builtin.buildertools.commands`
## Commandes de Selection
### /pos1, /pos2
Definir les coins de selection a la position actuelle ou coordonnees specifiees.
```
/pos1 [<x> <y> <z>]
/pos2 [<x> <y> <z>]
```
**Exemples:**
- `/pos1` - Definir pos1 a la position actuelle
- `/pos1 100 64 200` - Definir pos1 aux coordonnees
- `/pos2 ~10 ~ ~10` - Definir pos2 relative a position actuelle
### /deselect
Effacer la selection actuelle.
```
/deselect
```
### /expand
Etendre la selection dans une direction.
```
/expand <montant> [direction]
```
**Directions:** `up`, `down`, `north`, `south`, `east`, `west`, `all`
**Exemples:**
- `/expand 10 up` - Etendre 10 blocs vers le haut
- `/expand 5 all` - Etendre 5 blocs dans toutes directions
### /contract
Contracter la selection depuis une direction.
```
/contract <montant> [direction]
```
### /shift
Deplacer la selection sans affecter les blocs.
```
/shift <montant> [direction]
```
### /selectchunk
Selectionner le chunk entier a la position actuelle.
```
/selectchunk
```
### /selectchunksection
Selectionner une section de chunk 16x16x16.
```
/selectchunksection
```
### /selectionhistory
Naviguer dans l'historique de selection.
```
/selectionhistory undo
/selectionhistory redo
```
### /updateselection
Rafraichir l'affichage de selection.
```
/updateselection
```
## Commandes Presse-papiers
### /copy
Copier la selection vers le presse-papiers.
```
/copy
```
### /cut
Couper la selection vers le presse-papiers (supprime les blocs).
```
/cut
```
### /paste
Coller le presse-papiers a la position actuelle.
```
/paste [flags]
```
**Flags:**
- `-a` - Ignorer les blocs d'air
- `-e` - Inclure les entites
- `-o` - Coller a l'emplacement original
### /rotate
Pivoter le contenu du presse-papiers.
```
/rotate <angle>
```
**Angles:** `90`, `180`, `270`
### /flip
Retourner le contenu du presse-papiers.
```
/flip <axe>
```
**Axes:** `x`, `y`, `z`
## Commandes de Modification
### /set
Remplir la selection avec un pattern de blocs.
```
/set <pattern>
```
**Exemples:**
- `/set [Stone]` - Remplir avec pierre
- `/set [50%Stone, 50%Dirt]` - Remplir avec aleatoire pondere
- `/set [Air]` - Effacer selection
### /fill
Remplir la selection (alias pour set).
```
/fill <pattern>
```
### /replace
Remplacer les blocs correspondant a un masque.
```
/replace <de> <vers>
```
**Exemples:**
- `/replace [Stone] [Dirt]` - Remplacer pierre par terre
- `/replace [!Air] [Glass]` - Remplacer tout non-air par verre
### /walls
Creer des murs autour de la selection.
```
/walls <pattern>
```
### /hollow
Evider la selection, ne laissant que les murs.
```
/hollow [epaisseur]
```
### /stack
Empiler la selection plusieurs fois.
```
/stack <nombre> [direction]
```
**Exemples:**
- `/stack 5 up` - Empiler 5 fois vers le haut
- `/stack 10 north` - Empiler 10 fois au nord
### /move
Deplacer les blocs dans la selection.
```
/move <direction> <montant>
```
## Commandes Historique
### /undo
Annuler les operations precedentes.
```
/undo [nombre]
```
### /redo
Refaire les operations annulees.
```
/redo [nombre]
```
### /clearedithistory
Effacer tout l'historique d'edition.
```
/clearedithistory
```
### /settoolhistorysize
Definir la taille maximale de l'historique.
```
/settoolhistorysize <taille>
```
## Commandes Utilitaires
### /tint
Appliquer une teinte de couleur aux blocs.
```
/tint <couleur>
```
### /submerge
Submerger la selection dans un fluide.
```
/submerge <profondeur>
```
### /clearblocks
Effacer tous les blocs dans la selection.
```
/clearblocks
```
### /clearentities
Effacer toutes les entites dans la selection.
```
/clearentities
```
### /environment
Definir l'environnement pour une zone.
```
/environment <environment_id>
```
### /globalmask
Definir un masque global pour toutes les operations.
```
/globalmask <masque>
/globalmask clear
```
### /editline
Creer une ligne de blocs.
```
/editline <pattern>
```
### /extendface
Etendre une face de la selection.
```
/extendface <direction> <montant>
```
### /hotbarswitch
Changer de hotbar outil de construction.
```
/hotbarswitch <slot>
```
### /repairfillers
Reparer les blocs de remplissage.
```
/repairfillers
```
## Commandes d'Import
### /imageimport
Importer une image en blocs.
```
/imageimport <fichier>
```
### /objimport
Importer un modele OBJ en blocs.
```
/objimport <fichier>
```
## Commandes Prefab
### /prefab
Gerer les prefabs.
```
/prefab save <nom>
/prefab load <nom>
/prefab list
/prefab delete <nom>
```
### /prefabedit
Entrer en mode edition prefab.
```
/prefabedit <prefab_id>
```
## Patterns de Blocs
Syntaxe de pattern utilisee par plusieurs commandes:
| Syntaxe | Description | Exemple |
|---------|-------------|---------|
| `[Bloc]` | Bloc unique | `[Stone]` |
| `[Bloc1, Bloc2]` | Poids egaux | `[Stone, Dirt]` |
| `[N%Bloc]` | Pondere | `[70%Stone, 30%Dirt]` |
| `[!Bloc]` | Exclure | `[!Air]` |
| `[!^Tag]` | Exclure tag | `[!^Fluid]` |
## Permissions
Les commandes de construction necessitent le mode creatif ou permissions appropriees:
```
buildertools.command.<nom_commande>
```

View File

@@ -0,0 +1,229 @@
---
title: Prefab Editor
type: docs
weight: 3
---
The prefab editor allows creating, editing, and managing prefabricated structures that can be placed in the world.
**Package:** `com.hypixel.hytale.builtin.buildertools.prefabeditor`
## Architecture
```
Prefab Editor
├── Session Management
│ ├── PrefabEditSession - Active edit session
│ └── PrefabEditSessionManager - Session coordinator
├── Components
│ ├── PrefabAnchor - Anchor point definitions
│ └── PrefabEditorCreationSettings
├── Interactions
│ ├── PrefabSelectionInteraction
│ └── PrefabSetAnchorInteraction
├── Systems
│ ├── PrefabDirtySystems - Track changes
│ └── PrefabMarkerProvider - Anchor markers
└── Commands
└── PrefabEditCommand
```
## Prefab Edit Session
### Starting a Session
```
/prefabedit <prefab_id>
```
This enters prefab editing mode where:
- Selection tools work within prefab bounds
- Changes are tracked separately
- Anchors can be set
### PrefabEditSession
```java
public class PrefabEditSession {
// Active editing session for a prefab
// Tracks modifications and anchors
}
```
### Session Manager
```java
PrefabEditSessionManager manager = BuilderToolsPlugin.get().getPrefabEditSessionManager();
// Check if player is editing
boolean isEditing = manager.isEditing(player);
// Get active session
PrefabEditSession session = manager.getSession(player);
```
## Prefab Anchors
Anchors define special points within a prefab:
### PrefabAnchor
```java
public class PrefabAnchor {
// Position relative to prefab origin
// Name identifier
// Anchor type
}
```
### Setting Anchors
Use the anchor interaction or command:
```
/prefab anchor set <name> [x y z]
/prefab anchor remove <name>
/prefab anchor list
```
### Anchor Types
| Type | Description |
|------|-------------|
| `origin` | Prefab placement origin |
| `spawn` | Entity spawn point |
| `connection` | Connection to other prefabs |
| `custom` | User-defined anchor |
## Prefab Commands
### /prefab
Main prefab management command:
```
/prefab save <name> Save selection as prefab
/prefab load <name> Load prefab to clipboard
/prefab list List available prefabs
/prefab delete <name> Delete a prefab
/prefab info <name> Show prefab information
```
### /prefabedit
Enter prefab editing mode:
```
/prefabedit <prefab_id> Edit existing prefab
/prefabedit exit Exit editing mode
/prefabedit save Save changes
/prefabedit discard Discard changes
```
## Interactions
### PrefabSelectionInteraction
Select prefabs in the world:
```java
// Registered interaction type
getCodecRegistry(Interaction.CODEC).register(
"PrefabSelection",
PrefabSelectionInteraction.class,
PrefabSelectionInteraction.CODEC
);
```
### PrefabSetAnchorInteraction
Set anchors via interaction:
```java
// Allows clicking to place anchors
getCodecRegistry(Interaction.CODEC).register(
"PrefabSetAnchor",
PrefabSetAnchorInteraction.class,
PrefabSetAnchorInteraction.CODEC
);
```
## Creation Settings
### PrefabEditorCreationSettings
Configuration for creating new prefabs:
```java
public class PrefabEditorCreationSettings {
// Settings for prefab creation
// Include entities flag
// Compression settings
}
```
## Systems
### PrefabDirtySystems
Tracks modifications to prefabs:
```java
// Marks prefab as modified when changes occur
// Prompts save on exit
```
### PrefabMarkerProvider
Provides visual markers for anchors:
```java
// Displays anchor positions in creative mode
// Shows connection points
```
## API Usage
### Save Selection as Prefab
```java
BuilderToolsPlugin tools = BuilderToolsPlugin.get();
// Selection must be defined first
// Use /prefab save command or API
```
### Load and Place Prefab
```java
// Load to clipboard
// /prefab load <name>
// Paste at location
// /paste
```
### Check Edit Mode
```java
PrefabEditSessionManager manager =
BuilderToolsPlugin.get().getPrefabEditSessionManager();
if (manager.isEditing(player)) {
PrefabEditSession session = manager.getSession(player);
// Work with session
}
```
## Prefab Storage
Prefabs are stored in the world data:
```
worlds/<world>/prefabs/<name>.prefab
```
Structure includes:
- Block data
- Entity data (if included)
- Anchor definitions
- Metadata

View File

@@ -0,0 +1,229 @@
---
title: Editeur Prefab
type: docs
weight: 3
---
L'editeur de prefabs permet de creer, editer et gerer des structures prefabriquees qui peuvent etre placees dans le monde.
**Package:** `com.hypixel.hytale.builtin.buildertools.prefabeditor`
## Architecture
```
Editeur Prefab
├── Gestion Sessions
│ ├── PrefabEditSession - Session d'edition active
│ └── PrefabEditSessionManager - Coordinateur sessions
├── Composants
│ ├── PrefabAnchor - Definitions points d'ancrage
│ └── PrefabEditorCreationSettings
├── Interactions
│ ├── PrefabSelectionInteraction
│ └── PrefabSetAnchorInteraction
├── Systemes
│ ├── PrefabDirtySystems - Suivi changements
│ └── PrefabMarkerProvider - Marqueurs d'ancrage
└── Commandes
└── PrefabEditCommand
```
## Session Edition Prefab
### Demarrer une Session
```
/prefabedit <prefab_id>
```
Cela entre en mode edition prefab ou:
- Les outils de selection fonctionnent dans les limites du prefab
- Les changements sont suivis separement
- Les ancres peuvent etre definies
### PrefabEditSession
```java
public class PrefabEditSession {
// Session d'edition active pour un prefab
// Suit modifications et ancres
}
```
### Gestionnaire de Sessions
```java
PrefabEditSessionManager manager = BuilderToolsPlugin.get().getPrefabEditSessionManager();
// Verifier si joueur edite
boolean isEditing = manager.isEditing(player);
// Obtenir session active
PrefabEditSession session = manager.getSession(player);
```
## Ancres Prefab
Les ancres definissent des points speciaux dans un prefab:
### PrefabAnchor
```java
public class PrefabAnchor {
// Position relative a l'origine prefab
// Identifiant nom
// Type d'ancre
}
```
### Definir des Ancres
Utiliser l'interaction d'ancrage ou commande:
```
/prefab anchor set <nom> [x y z]
/prefab anchor remove <nom>
/prefab anchor list
```
### Types d'Ancres
| Type | Description |
|------|-------------|
| `origin` | Origine placement prefab |
| `spawn` | Point de spawn entite |
| `connection` | Connexion vers autres prefabs |
| `custom` | Ancre definie par utilisateur |
## Commandes Prefab
### /prefab
Commande principale gestion prefabs:
```
/prefab save <nom> Sauver selection comme prefab
/prefab load <nom> Charger prefab vers presse-papiers
/prefab list Lister prefabs disponibles
/prefab delete <nom> Supprimer un prefab
/prefab info <nom> Afficher informations prefab
```
### /prefabedit
Entrer en mode edition prefab:
```
/prefabedit <prefab_id> Editer prefab existant
/prefabedit exit Quitter mode edition
/prefabedit save Sauvegarder changements
/prefabedit discard Abandonner changements
```
## Interactions
### PrefabSelectionInteraction
Selectionner prefabs dans le monde:
```java
// Type d'interaction enregistre
getCodecRegistry(Interaction.CODEC).register(
"PrefabSelection",
PrefabSelectionInteraction.class,
PrefabSelectionInteraction.CODEC
);
```
### PrefabSetAnchorInteraction
Definir ancres via interaction:
```java
// Permet de cliquer pour placer ancres
getCodecRegistry(Interaction.CODEC).register(
"PrefabSetAnchor",
PrefabSetAnchorInteraction.class,
PrefabSetAnchorInteraction.CODEC
);
```
## Parametres de Creation
### PrefabEditorCreationSettings
Configuration pour creer nouveaux prefabs:
```java
public class PrefabEditorCreationSettings {
// Parametres pour creation prefab
// Flag inclure entites
// Parametres compression
}
```
## Systemes
### PrefabDirtySystems
Suit les modifications aux prefabs:
```java
// Marque prefab comme modifie quand changements surviennent
// Demande sauvegarde a la sortie
```
### PrefabMarkerProvider
Fournit marqueurs visuels pour ancres:
```java
// Affiche positions d'ancrage en mode creatif
// Montre points de connexion
```
## Utilisation de l'API
### Sauver Selection comme Prefab
```java
BuilderToolsPlugin tools = BuilderToolsPlugin.get();
// La selection doit etre definie d'abord
// Utiliser commande /prefab save ou API
```
### Charger et Placer Prefab
```java
// Charger vers presse-papiers
// /prefab load <nom>
// Coller a l'emplacement
// /paste
```
### Verifier Mode Edition
```java
PrefabEditSessionManager manager =
BuilderToolsPlugin.get().getPrefabEditSessionManager();
if (manager.isEditing(player)) {
PrefabEditSession session = manager.getSession(player);
// Travailler avec session
}
```
## Stockage Prefab
Les prefabs sont stockes dans les donnees du monde:
```
worlds/<monde>/prefabs/<nom>.prefab
```
La structure inclut:
- Donnees de blocs
- Donnees d'entites (si incluses)
- Definitions d'ancres
- Metadonnees

View File

@@ -0,0 +1,387 @@
---
title: Scripted Brushes
type: docs
weight: 1
---
Scripted brushes allow creating complex, programmable brush operations through JSON asset definitions.
**Package:** `com.hypixel.hytale.builtin.buildertools.scriptedbrushes`
## Architecture
```
Scripted Brushes
├── Assets
│ └── ScriptedBrushAsset - Brush definitions
├── Operations
│ ├── BrushOperation - Base operation class
│ ├── SequenceBrushOperation - Sequential operations
│ └── GlobalBrushOperation - Global modifiers
├── Categories
│ ├── Shape Operations - Set, fill, shape
│ ├── Mask Operations - Mask, history mask
│ ├── Flow Control - Loops, jumps, conditions
│ ├── Material Operations - Pattern, replace
│ └── Transform Operations - Offset, dimensions
├── Config
│ ├── BrushConfig - Runtime configuration
│ └── BrushConfigEditStore - Edit state
└── Commands
└── BrushConfigCommand - /brushconfig
```
## ScriptedBrushAsset
Brush definitions loaded from JSON:
**Asset Location:** `BuilderTools/Brushes/`
```yaml
# BuilderTools/Brushes/terrain_sphere.json
{
"Id": "terrain_sphere",
"Operations": [
{
"Type": "Shape",
"Shape": "Sphere"
},
{
"Type": "Dimensions",
"Width": 5,
"Height": 5,
"Depth": 5
},
{
"Type": "Material",
"Pattern": "[Rock_Stone]"
},
{
"Type": "Set"
}
]
}
```
### Asset Access
```java
// Get brush asset
ScriptedBrushAsset brush = ScriptedBrushAsset.get("terrain_sphere");
// Get operations
List<BrushOperation> operations = brush.getOperations();
// Load into executor
brush.loadIntoExecutor(executor);
```
## Operation Types
### Shape Operations
| Operation | Description |
|-----------|-------------|
| `Set` | Apply blocks at positions |
| `Shape` | Define brush shape (Sphere, Cube, Cylinder) |
| `Delete` | Remove blocks |
| `Smooth` | Smooth terrain |
| `Erode` | Erode terrain |
| `Lift` | Raise terrain |
| `Melt` | Melt terrain |
```yaml
{
"Type": "Shape",
"Shape": "Sphere" // Sphere, Cube, Cylinder
}
```
### Dimension Operations
```yaml
{
"Type": "Dimensions",
"Width": 10,
"Height": 5,
"Depth": 10
}
```
```yaml
{
"Type": "RandomizeDimensions",
"MinWidth": 3,
"MaxWidth": 7,
"MinHeight": 3,
"MaxHeight": 7
}
```
### Material Operations
```yaml
{
"Type": "Material",
"Pattern": "[50%Rock_Stone, 50%Rock_Shale]"
}
```
```yaml
{
"Type": "BlockPattern",
"Pattern": "[Rock_Stone]"
}
```
```yaml
{
"Type": "Replace",
"From": "[Grass]",
"To": "[Dirt]"
}
```
### Mask Operations
```yaml
{
"Type": "Mask",
"Mask": "[!Air]"
}
```
```yaml
{
"Type": "AppendMask",
"Mask": "[!Water]"
}
```
```yaml
{
"Type": "HistoryMask"
// Only affect previously modified blocks
}
```
```yaml
{
"Type": "UseBrushMask"
// Use mask from tool arguments
}
```
### Offset Operations
```yaml
{
"Type": "Offset",
"X": 0,
"Y": 5,
"Z": 0
}
```
```yaml
{
"Type": "RandomOffset",
"MinX": -2,
"MaxX": 2,
"MinY": 0,
"MaxY": 5,
"MinZ": -2,
"MaxZ": 2
}
```
### Flow Control
#### Loops
```yaml
{
"Type": "Loop",
"Count": 5,
"StartIndex": 2,
"EndIndex": 6
}
```
```yaml
{
"Type": "LoopRandom",
"MinCount": 3,
"MaxCount": 8
}
```
```yaml
{
"Type": "CircleOffsetAndLoop",
"Radius": 5,
"Count": 8
}
```
#### Conditionals
```yaml
{
"Type": "JumpIfBlockType",
"BlockType": "Air",
"Index": 10,
"ElseIndex": 5
}
```
```yaml
{
"Type": "JumpIfClickType",
"ClickType": "Primary",
"Index": 3
}
```
```yaml
{
"Type": "JumpIfCompare",
"Variable": "height",
"Operator": ">",
"Value": 5,
"Index": 8
}
```
```yaml
{
"Type": "JumpToIndex",
"Index": 0
}
```
```yaml
{
"Type": "Exit"
// Stop brush execution
}
```
### Special Operations
```yaml
{
"Type": "Echo",
"Message": "Brush applied!"
}
```
```yaml
{
"Type": "RunCommand",
"Command": "/fill [Stone]"
}
```
```yaml
{
"Type": "PastePrefab",
"PrefabId": "tree_oak"
}
```
```yaml
{
"Type": "HeightmapLayer",
"Layer": 0
}
```
### Save/Load Operations
```yaml
{
"Type": "LoadOperationsFromAsset",
"AssetId": "common_setup"
}
```
```yaml
{
"Type": "SaveBrushConfig",
"Key": "my_config"
}
```
```yaml
{
"Type": "LoadBrushConfig",
"Key": "my_config"
}
```
## Global Operations
Operations that affect the entire brush:
```yaml
{
"Type": "Debug",
"Enabled": true
}
```
```yaml
{
"Type": "DisableHoldInteraction"
// Only trigger on click, not hold
}
```
```yaml
{
"Type": "IgnoreExistingBrushData"
}
```
## Brush Config Command
Manage brush configurations via command:
| Command | Description |
|---------|-------------|
| `/brushconfig` | Base brush config command |
| `/brushconfig load <id>` | Load brush config |
| `/brushconfig list` | List available brushes |
| `/brushconfig clear` | Clear current config |
| `/brushconfig exit` | Exit brush mode |
| `/brushconfig debugstep` | Step through operations |
## API Usage
### Load Brush
```java
ScriptedBrushAsset brush = ScriptedBrushAsset.get("terrain_sphere");
```
### Execute Brush
```java
BrushConfigCommandExecutor executor = new BrushConfigCommandExecutor();
brush.loadIntoExecutor(executor);
// Execute operations sequentially
```
### Access Operations
```java
List<BrushOperation> operations = brush.getOperations();
for (BrushOperation op : operations) {
if (op instanceof SequenceBrushOperation) {
// Sequential operation
} else if (op instanceof GlobalBrushOperation) {
// Global modifier
}
}
```

View File

@@ -0,0 +1,387 @@
---
title: Brosses Scriptees
type: docs
weight: 1
---
Les brosses scriptees permettent de creer des operations de brosse complexes et programmables via definitions d'assets JSON.
**Package:** `com.hypixel.hytale.builtin.buildertools.scriptedbrushes`
## Architecture
```
Brosses Scriptees
├── Assets
│ └── ScriptedBrushAsset - Definitions de brosses
├── Operations
│ ├── BrushOperation - Classe operation de base
│ ├── SequenceBrushOperation - Operations sequentielles
│ └── GlobalBrushOperation - Modificateurs globaux
├── Categories
│ ├── Operations Forme - Set, fill, shape
│ ├── Operations Masque - Mask, history mask
│ ├── Controle Flux - Boucles, sauts, conditions
│ ├── Operations Materiau - Pattern, replace
│ └── Operations Transform - Offset, dimensions
├── Config
│ ├── BrushConfig - Configuration runtime
│ └── BrushConfigEditStore - Etat edition
└── Commandes
└── BrushConfigCommand - /brushconfig
```
## ScriptedBrushAsset
Definitions de brosses chargees depuis JSON:
**Emplacement Asset:** `BuilderTools/Brushes/`
```yaml
# BuilderTools/Brushes/terrain_sphere.json
{
"Id": "terrain_sphere",
"Operations": [
{
"Type": "Shape",
"Shape": "Sphere"
},
{
"Type": "Dimensions",
"Width": 5,
"Height": 5,
"Depth": 5
},
{
"Type": "Material",
"Pattern": "[Rock_Stone]"
},
{
"Type": "Set"
}
]
}
```
### Acces Asset
```java
// Obtenir asset brosse
ScriptedBrushAsset brush = ScriptedBrushAsset.get("terrain_sphere");
// Obtenir operations
List<BrushOperation> operations = brush.getOperations();
// Charger dans executeur
brush.loadIntoExecutor(executor);
```
## Types d'Operations
### Operations de Forme
| Operation | Description |
|-----------|-------------|
| `Set` | Appliquer blocs aux positions |
| `Shape` | Definir forme brosse (Sphere, Cube, Cylinder) |
| `Delete` | Supprimer blocs |
| `Smooth` | Lisser terrain |
| `Erode` | Eroder terrain |
| `Lift` | Elever terrain |
| `Melt` | Fondre terrain |
```yaml
{
"Type": "Shape",
"Shape": "Sphere" // Sphere, Cube, Cylinder
}
```
### Operations de Dimension
```yaml
{
"Type": "Dimensions",
"Width": 10,
"Height": 5,
"Depth": 10
}
```
```yaml
{
"Type": "RandomizeDimensions",
"MinWidth": 3,
"MaxWidth": 7,
"MinHeight": 3,
"MaxHeight": 7
}
```
### Operations de Materiau
```yaml
{
"Type": "Material",
"Pattern": "[50%Rock_Stone, 50%Rock_Shale]"
}
```
```yaml
{
"Type": "BlockPattern",
"Pattern": "[Rock_Stone]"
}
```
```yaml
{
"Type": "Replace",
"From": "[Grass]",
"To": "[Dirt]"
}
```
### Operations de Masque
```yaml
{
"Type": "Mask",
"Mask": "[!Air]"
}
```
```yaml
{
"Type": "AppendMask",
"Mask": "[!Water]"
}
```
```yaml
{
"Type": "HistoryMask"
// Affecter uniquement blocs precedemment modifies
}
```
```yaml
{
"Type": "UseBrushMask"
// Utiliser masque des arguments outil
}
```
### Operations de Decalage
```yaml
{
"Type": "Offset",
"X": 0,
"Y": 5,
"Z": 0
}
```
```yaml
{
"Type": "RandomOffset",
"MinX": -2,
"MaxX": 2,
"MinY": 0,
"MaxY": 5,
"MinZ": -2,
"MaxZ": 2
}
```
### Controle de Flux
#### Boucles
```yaml
{
"Type": "Loop",
"Count": 5,
"StartIndex": 2,
"EndIndex": 6
}
```
```yaml
{
"Type": "LoopRandom",
"MinCount": 3,
"MaxCount": 8
}
```
```yaml
{
"Type": "CircleOffsetAndLoop",
"Radius": 5,
"Count": 8
}
```
#### Conditionnels
```yaml
{
"Type": "JumpIfBlockType",
"BlockType": "Air",
"Index": 10,
"ElseIndex": 5
}
```
```yaml
{
"Type": "JumpIfClickType",
"ClickType": "Primary",
"Index": 3
}
```
```yaml
{
"Type": "JumpIfCompare",
"Variable": "height",
"Operator": ">",
"Value": 5,
"Index": 8
}
```
```yaml
{
"Type": "JumpToIndex",
"Index": 0
}
```
```yaml
{
"Type": "Exit"
// Arreter execution brosse
}
```
### Operations Speciales
```yaml
{
"Type": "Echo",
"Message": "Brosse appliquee!"
}
```
```yaml
{
"Type": "RunCommand",
"Command": "/fill [Stone]"
}
```
```yaml
{
"Type": "PastePrefab",
"PrefabId": "tree_oak"
}
```
```yaml
{
"Type": "HeightmapLayer",
"Layer": 0
}
```
### Operations Sauvegarde/Chargement
```yaml
{
"Type": "LoadOperationsFromAsset",
"AssetId": "common_setup"
}
```
```yaml
{
"Type": "SaveBrushConfig",
"Key": "my_config"
}
```
```yaml
{
"Type": "LoadBrushConfig",
"Key": "my_config"
}
```
## Operations Globales
Operations qui affectent toute la brosse:
```yaml
{
"Type": "Debug",
"Enabled": true
}
```
```yaml
{
"Type": "DisableHoldInteraction"
// Declencher uniquement au clic, pas au maintien
}
```
```yaml
{
"Type": "IgnoreExistingBrushData"
}
```
## Commande Config Brosse
Gerer les configurations de brosse via commande:
| Commande | Description |
|----------|-------------|
| `/brushconfig` | Commande config brosse de base |
| `/brushconfig load <id>` | Charger config brosse |
| `/brushconfig list` | Lister brosses disponibles |
| `/brushconfig clear` | Effacer config actuelle |
| `/brushconfig exit` | Quitter mode brosse |
| `/brushconfig debugstep` | Executer pas a pas |
## Utilisation de l'API
### Charger une Brosse
```java
ScriptedBrushAsset brush = ScriptedBrushAsset.get("terrain_sphere");
```
### Executer une Brosse
```java
BrushConfigCommandExecutor executor = new BrushConfigCommandExecutor();
brush.loadIntoExecutor(executor);
// Executer operations sequentiellement
```
### Acceder aux Operations
```java
List<BrushOperation> operations = brush.getOperations();
for (BrushOperation op : operations) {
if (op instanceof SequenceBrushOperation) {
// Operation sequentielle
} else if (op instanceof GlobalBrushOperation) {
// Modificateur global
}
}
```

View File

@@ -0,0 +1,284 @@
---
title: Snapshots
type: docs
weight: 5
---
The snapshot system provides undo/redo functionality for builder tools by capturing and restoring state.
**Package:** `com.hypixel.hytale.builtin.buildertools.snapshot`
## Architecture
```
Snapshots
├── Base
│ └── SelectionSnapshot - Snapshot interface
├── Block Snapshots
│ └── BlockSelectionSnapshot - Block selection state
├── Clipboard Snapshots
│ ├── ClipboardSnapshot - Clipboard interface
│ ├── ClipboardContentsSnapshot - Clipboard contents
│ └── ClipboardBoundsSnapshot - Selection bounds
└── Entity Snapshots
├── EntitySnapshot - Entity interface
├── EntityAddSnapshot - Track entity addition
├── EntityRemoveSnapshot - Track entity removal
└── EntityTransformSnapshot - Track transform changes
```
## SelectionSnapshot Interface
Base interface for all snapshots:
```java
public interface SelectionSnapshot<T extends SelectionSnapshot<?>> {
// Restore to previous state
// Returns inverse snapshot for redo
T restore(Ref<EntityStore> ref, Player player, World world,
ComponentAccessor<EntityStore> accessor);
}
```
### How Undo/Redo Works
The snapshot pattern creates inverse operations:
1. Snapshot captures current state before operation
2. Operation modifies the state
3. Calling `restore()` reverts changes
4. `restore()` returns new snapshot for redo
## Block Selection Snapshots
### BlockSelectionSnapshot
Captures block selection state:
```java
public class BlockSelectionSnapshot implements SelectionSnapshot<BlockSelectionSnapshot> {
private final BlockSelection selection;
public BlockSelection getBlockSelection();
// Create copy of selection
public static BlockSelectionSnapshot copyOf(BlockSelection selection);
}
```
### Usage
```java
// Before modifying selection
BlockSelectionSnapshot snapshot = BlockSelectionSnapshot.copyOf(selection);
// Perform modifications...
// To undo - restore returns redo snapshot
BlockSelectionSnapshot redoSnapshot = snapshot.restore(ref, player, world, accessor);
```
## Clipboard Snapshots
### ClipboardSnapshot Interface
Extended interface for clipboard operations:
```java
public interface ClipboardSnapshot<T extends SelectionSnapshot<?>>
extends SelectionSnapshot<T> {
T restoreClipboard(Ref<EntityStore> ref, Player player, World world,
BuilderToolsPlugin.BuilderState state,
ComponentAccessor<EntityStore> accessor);
}
```
### ClipboardContentsSnapshot
Captures clipboard contents:
```java
public class ClipboardContentsSnapshot implements ClipboardSnapshot<ClipboardContentsSnapshot> {
private final BlockSelection selection;
// Create copy of clipboard contents
public static ClipboardContentsSnapshot copyOf(BlockSelection selection);
}
```
### ClipboardBoundsSnapshot
Captures selection bounds only:
```java
public class ClipboardBoundsSnapshot implements ClipboardSnapshot<ClipboardBoundsSnapshot> {
public static final ClipboardBoundsSnapshot EMPTY;
private final Vector3i min;
private final Vector3i max;
public ClipboardBoundsSnapshot(BlockSelection selection);
public ClipboardBoundsSnapshot(Vector3i min, Vector3i max);
public Vector3i getMin();
public Vector3i getMax();
}
```
## Entity Snapshots
### EntitySnapshot Interface
Interface for entity-related snapshots:
```java
public interface EntitySnapshot<T extends SelectionSnapshot<?>>
extends SelectionSnapshot<T> {
T restoreEntity(Player player, World world,
ComponentAccessor<EntityStore> accessor);
}
```
Entity snapshots handle thread safety automatically, ensuring restoration runs on the world's tick thread.
### EntityAddSnapshot
Tracks entity creation (undo removes entity):
```java
public class EntityAddSnapshot implements EntitySnapshot<EntityRemoveSnapshot> {
private final Ref<EntityStore> entityRef;
public Ref<EntityStore> getEntityRef();
// Restore removes the entity
// Returns EntityRemoveSnapshot for redo (re-add)
}
```
### EntityRemoveSnapshot
Tracks entity removal (undo adds entity back):
```java
public class EntityRemoveSnapshot implements EntitySnapshot<EntityAddSnapshot> {
private final Holder<EntityStore> holder;
public Holder<EntityStore> getHolder();
// Restore adds entity back
// Returns EntityAddSnapshot for redo (remove again)
}
```
The `Holder<EntityStore>` stores a complete copy of the entity and its components.
### EntityTransformSnapshot
Tracks entity position and rotation:
```java
public class EntityTransformSnapshot implements EntitySnapshot<EntityTransformSnapshot> {
private final Ref<EntityStore> ref;
private final Transform transform; // Position and rotation
private final Vector3f headRotation; // Head direction
// Stores current transform state
public EntityTransformSnapshot(Ref<EntityStore> ref,
ComponentAccessor<EntityStore> accessor);
// Restore returns snapshot of current state before restoration
}
```
## Snapshot Pairs
Snapshots come in complementary pairs:
| Add Operation | Undo (Remove) | Redo (Add) |
|---------------|---------------|------------|
| `EntityAddSnapshot` | Removes entity | `EntityRemoveSnapshot` |
| `EntityRemoveSnapshot` | Adds entity back | `EntityAddSnapshot` |
| Modification | Undo | Redo |
|--------------|------|------|
| `EntityTransformSnapshot` | Restores previous transform | Returns new snapshot |
| `BlockSelectionSnapshot` | Restores previous blocks | Returns new snapshot |
| `ClipboardContentsSnapshot` | Restores previous contents | Returns new snapshot |
| `ClipboardBoundsSnapshot` | Restores previous bounds | Returns new snapshot |
## Edit History Integration
Snapshots integrate with the edit history system:
```java
// History stores snapshots for each operation
// /undo command restores from history
// /redo command uses inverse snapshots
// Commands related to history:
// /undo [count]
// /redo [count]
// /clearedithistory
// /settoolhistorysize <size>
```
## Thread Safety
Entity snapshots automatically handle world thread requirements:
```java
// EntitySnapshot.restore() implementation
default T restore(...) {
if (!world.isInThread()) {
// Run on world tick thread
return CompletableFuture.supplyAsync(
() -> this.restoreEntity(player, world, store),
world
).join();
}
return this.restoreEntity(player, world, store);
}
```
## API Usage
### Working with Block Snapshots
```java
// Before operation
BlockSelectionSnapshot before = BlockSelectionSnapshot.copyOf(selection);
// Perform operation that modifies blocks
// ...
// Store snapshot in history for undo
```
### Working with Entity Snapshots
```java
// Before adding entity
Ref<EntityStore> newEntity = world.spawnEntity(...);
EntityAddSnapshot snapshot = new EntityAddSnapshot(newEntity);
// To undo (remove the entity)
EntityRemoveSnapshot inverse = snapshot.restore(ref, player, world, accessor);
// To redo (add entity back)
EntityAddSnapshot restored = inverse.restore(ref, player, world, accessor);
```
### Working with Transform Snapshots
```java
// Before moving entity
EntityTransformSnapshot before = new EntityTransformSnapshot(entityRef, accessor);
// Move entity
transformComponent.setPosition(newPosition);
// To undo (restore original position)
EntityTransformSnapshot after = before.restore(player, world, accessor);
```

View File

@@ -0,0 +1,284 @@
---
title: Snapshots
type: docs
weight: 5
---
Le systeme de snapshots fournit la fonctionnalite annuler/refaire pour les outils de construction en capturant et restaurant l'etat.
**Package:** `com.hypixel.hytale.builtin.buildertools.snapshot`
## Architecture
```
Snapshots
├── Base
│ └── SelectionSnapshot - Interface snapshot
├── Snapshots Blocs
│ └── BlockSelectionSnapshot - Etat selection blocs
├── Snapshots Presse-papiers
│ ├── ClipboardSnapshot - Interface presse-papiers
│ ├── ClipboardContentsSnapshot - Contenu presse-papiers
│ └── ClipboardBoundsSnapshot - Limites selection
└── Snapshots Entites
├── EntitySnapshot - Interface entite
├── EntityAddSnapshot - Suivi ajout entite
├── EntityRemoveSnapshot - Suivi suppression entite
└── EntityTransformSnapshot - Suivi changements transform
```
## Interface SelectionSnapshot
Interface de base pour tous les snapshots:
```java
public interface SelectionSnapshot<T extends SelectionSnapshot<?>> {
// Restaurer etat precedent
// Retourne snapshot inverse pour refaire
T restore(Ref<EntityStore> ref, Player player, World world,
ComponentAccessor<EntityStore> accessor);
}
```
### Fonctionnement Annuler/Refaire
Le pattern snapshot cree des operations inverses:
1. Le snapshot capture l'etat actuel avant l'operation
2. L'operation modifie l'etat
3. Appeler `restore()` annule les changements
4. `restore()` retourne nouveau snapshot pour refaire
## Snapshots Selection Blocs
### BlockSelectionSnapshot
Capture l'etat de selection de blocs:
```java
public class BlockSelectionSnapshot implements SelectionSnapshot<BlockSelectionSnapshot> {
private final BlockSelection selection;
public BlockSelection getBlockSelection();
// Creer copie de selection
public static BlockSelectionSnapshot copyOf(BlockSelection selection);
}
```
### Utilisation
```java
// Avant modification selection
BlockSelectionSnapshot snapshot = BlockSelectionSnapshot.copyOf(selection);
// Effectuer modifications...
// Pour annuler - restore retourne snapshot refaire
BlockSelectionSnapshot redoSnapshot = snapshot.restore(ref, player, world, accessor);
```
## Snapshots Presse-papiers
### Interface ClipboardSnapshot
Interface etendue pour operations presse-papiers:
```java
public interface ClipboardSnapshot<T extends SelectionSnapshot<?>>
extends SelectionSnapshot<T> {
T restoreClipboard(Ref<EntityStore> ref, Player player, World world,
BuilderToolsPlugin.BuilderState state,
ComponentAccessor<EntityStore> accessor);
}
```
### ClipboardContentsSnapshot
Capture le contenu du presse-papiers:
```java
public class ClipboardContentsSnapshot implements ClipboardSnapshot<ClipboardContentsSnapshot> {
private final BlockSelection selection;
// Creer copie du contenu presse-papiers
public static ClipboardContentsSnapshot copyOf(BlockSelection selection);
}
```
### ClipboardBoundsSnapshot
Capture uniquement les limites de selection:
```java
public class ClipboardBoundsSnapshot implements ClipboardSnapshot<ClipboardBoundsSnapshot> {
public static final ClipboardBoundsSnapshot EMPTY;
private final Vector3i min;
private final Vector3i max;
public ClipboardBoundsSnapshot(BlockSelection selection);
public ClipboardBoundsSnapshot(Vector3i min, Vector3i max);
public Vector3i getMin();
public Vector3i getMax();
}
```
## Snapshots Entites
### Interface EntitySnapshot
Interface pour snapshots lies aux entites:
```java
public interface EntitySnapshot<T extends SelectionSnapshot<?>>
extends SelectionSnapshot<T> {
T restoreEntity(Player player, World world,
ComponentAccessor<EntityStore> accessor);
}
```
Les snapshots d'entites gerent automatiquement la securite des threads, assurant que la restauration s'execute sur le thread de tick du monde.
### EntityAddSnapshot
Suit la creation d'entite (annuler supprime l'entite):
```java
public class EntityAddSnapshot implements EntitySnapshot<EntityRemoveSnapshot> {
private final Ref<EntityStore> entityRef;
public Ref<EntityStore> getEntityRef();
// Restore supprime l'entite
// Retourne EntityRemoveSnapshot pour refaire (re-ajouter)
}
```
### EntityRemoveSnapshot
Suit la suppression d'entite (annuler ajoute l'entite):
```java
public class EntityRemoveSnapshot implements EntitySnapshot<EntityAddSnapshot> {
private final Holder<EntityStore> holder;
public Holder<EntityStore> getHolder();
// Restore ajoute l'entite
// Retourne EntityAddSnapshot pour refaire (supprimer a nouveau)
}
```
Le `Holder<EntityStore>` stocke une copie complete de l'entite et ses composants.
### EntityTransformSnapshot
Suit la position et rotation d'entite:
```java
public class EntityTransformSnapshot implements EntitySnapshot<EntityTransformSnapshot> {
private final Ref<EntityStore> ref;
private final Transform transform; // Position et rotation
private final Vector3f headRotation; // Direction tete
// Stocke l'etat transform actuel
public EntityTransformSnapshot(Ref<EntityStore> ref,
ComponentAccessor<EntityStore> accessor);
// Restore retourne snapshot de l'etat actuel avant restauration
}
```
## Paires de Snapshots
Les snapshots viennent en paires complementaires:
| Operation Ajout | Annuler (Supprimer) | Refaire (Ajouter) |
|-----------------|---------------------|-------------------|
| `EntityAddSnapshot` | Supprime entite | `EntityRemoveSnapshot` |
| `EntityRemoveSnapshot` | Ajoute entite | `EntityAddSnapshot` |
| Modification | Annuler | Refaire |
|--------------|---------|---------|
| `EntityTransformSnapshot` | Restaure transform precedent | Retourne nouveau snapshot |
| `BlockSelectionSnapshot` | Restaure blocs precedents | Retourne nouveau snapshot |
| `ClipboardContentsSnapshot` | Restaure contenu precedent | Retourne nouveau snapshot |
| `ClipboardBoundsSnapshot` | Restaure limites precedentes | Retourne nouveau snapshot |
## Integration Historique Edition
Les snapshots s'integrent avec le systeme d'historique:
```java
// L'historique stocke les snapshots pour chaque operation
// Commande /undo restaure depuis l'historique
// Commande /redo utilise les snapshots inverses
// Commandes liees a l'historique:
// /undo [nombre]
// /redo [nombre]
// /clearedithistory
// /settoolhistorysize <taille>
```
## Securite des Threads
Les snapshots d'entites gerent automatiquement les exigences de thread du monde:
```java
// Implementation EntitySnapshot.restore()
default T restore(...) {
if (!world.isInThread()) {
// Executer sur thread tick du monde
return CompletableFuture.supplyAsync(
() -> this.restoreEntity(player, world, store),
world
).join();
}
return this.restoreEntity(player, world, store);
}
```
## Utilisation de l'API
### Travailler avec Snapshots Blocs
```java
// Avant operation
BlockSelectionSnapshot before = BlockSelectionSnapshot.copyOf(selection);
// Effectuer operation qui modifie les blocs
// ...
// Stocker snapshot dans historique pour annuler
```
### Travailler avec Snapshots Entites
```java
// Avant ajout entite
Ref<EntityStore> newEntity = world.spawnEntity(...);
EntityAddSnapshot snapshot = new EntityAddSnapshot(newEntity);
// Pour annuler (supprimer l'entite)
EntityRemoveSnapshot inverse = snapshot.restore(ref, player, world, accessor);
// Pour refaire (ajouter entite a nouveau)
EntityAddSnapshot restored = inverse.restore(ref, player, world, accessor);
```
### Travailler avec Snapshots Transform
```java
// Avant deplacement entite
EntityTransformSnapshot before = new EntityTransformSnapshot(entityRef, accessor);
// Deplacer entite
transformComponent.setPosition(newPosition);
// Pour annuler (restaurer position originale)
EntityTransformSnapshot after = before.restore(player, world, accessor);
```

View File

@@ -0,0 +1,205 @@
---
title: Tool Operations
type: docs
weight: 4
---
Tool operations handle the actual block editing mechanics when using builder tools.
**Package:** `com.hypixel.hytale.builtin.buildertools.tooloperations`
## Architecture
```
Tool Operations
├── Base
│ └── ToolOperation - Operation base class
├── Operations
│ ├── PaintOperation - Block painting
│ └── EditOperation - Edit tracking
├── Materials
│ └── Material - Block material wrapper
└── Utilities
└── CopyCutSettings - Copy/cut configuration
```
## ToolOperation
Base class for all tool operations:
```java
public class ToolOperation {
// Base operation that modifies blocks
// Tracked for undo/redo
}
```
## PaintOperation
Handles block painting with brush tools:
```java
public class PaintOperation extends ToolOperation {
// Applies blocks in brush shape
// Supports patterns and masks
}
```
### Usage
When a player uses a brush tool:
1. PaintOperation is created
2. Shape is calculated based on tool settings
3. Blocks are modified according to pattern
4. Operation is added to history
## EditOperation
Tracks changes for undo/redo:
```java
public class EditOperation {
// Records block changes
// Enables reversal
}
```
## Material System
### Material
Wrapper for block materials:
```java
public class Material {
// Block type reference
// Additional properties (rotation, tint)
}
```
### Block Patterns
Patterns define how blocks are selected:
| Pattern | Description |
|---------|-------------|
| `[Stone]` | Single block type |
| `[50%Stone, 50%Dirt]` | Weighted random |
| `[Stone, Dirt, Grass]` | Equal weights |
### Block Masks
Masks filter which blocks are affected:
| Mask | Description |
|------|-------------|
| `[Stone]` | Only affect stone |
| `[!Air]` | Affect non-air blocks |
| `[!^Fluid]` | Exclude fluid tagged blocks |
## Copy/Cut Settings
### CopyCutSettings
Configuration for copy and cut operations:
```java
public class CopyCutSettings {
// Include entities flag
// Include biome data flag
// Compression level
}
```
## Tool Arguments
Builder tools support configurable arguments:
### Argument Types
| Type | Class | Description |
|------|-------|-------------|
| Block | `BlockArg` | Block type selection |
| Bool | `BoolArg` | Boolean flag |
| Int | `IntArg` | Integer value |
| Float | `FloatArg` | Decimal value |
| Mask | `MaskArg` | Block mask |
| String | `StringArg` | Text value |
| BrushShape | `BrushShapeArg` | Sphere, Cube, etc. |
| BrushOrigin | `BrushOriginArg` | Center, Surface, etc. |
### Tool Argument Packets
Arguments sync via network packets:
```java
// BuilderToolArgUpdate packet
// Syncs tool argument changes to server
```
## Brush Configuration
### Brush Shape
```java
public enum BrushShape {
Sphere,
Cube,
Cylinder,
// ...
}
```
### Brush Origin
```java
public enum BrushOrigin {
Center, // Brush centered on click
Surface, // Brush on surface
Offset // Custom offset
}
```
### Brush Axis
```java
public enum BrushAxis {
Y, // Always vertical
View, // Follow view direction
Surface // Normal to surface
}
```
## API Usage
### Access Tool Settings
```java
BuilderToolsPlugin tools = BuilderToolsPlugin.get();
BuilderToolsUserData userData = tools.getUserData(player);
```
### Get Current Tool
```java
BuilderTool currentTool = userData.getCurrentTool();
BuilderToolData toolData = currentTool.getData();
```
## Tool State
### BuilderToolState
Tracks current tool state:
```java
// BuilderToolState packet
// Syncs tool state to client
```
### Brush Data
```java
// BuilderToolBrushData packet
// Contains brush size, shape, pattern
```

View File

@@ -0,0 +1,205 @@
---
title: Operations Outil
type: docs
weight: 4
---
Les operations d'outil gerent les mecaniques d'edition de blocs reelles lors de l'utilisation des outils de construction.
**Package:** `com.hypixel.hytale.builtin.buildertools.tooloperations`
## Architecture
```
Operations Outil
├── Base
│ └── ToolOperation - Classe de base operation
├── Operations
│ ├── PaintOperation - Peinture de blocs
│ └── EditOperation - Suivi d'edition
├── Materiaux
│ └── Material - Wrapper materiau bloc
└── Utilitaires
└── CopyCutSettings - Configuration copier/couper
```
## ToolOperation
Classe de base pour toutes les operations d'outil:
```java
public class ToolOperation {
// Operation de base qui modifie les blocs
// Suivie pour annuler/refaire
}
```
## PaintOperation
Gere la peinture de blocs avec outils brosse:
```java
public class PaintOperation extends ToolOperation {
// Applique blocs dans forme brosse
// Supporte patterns et masques
}
```
### Utilisation
Quand un joueur utilise un outil brosse:
1. PaintOperation est creee
2. La forme est calculee selon parametres outil
3. Les blocs sont modifies selon pattern
4. L'operation est ajoutee a l'historique
## EditOperation
Suit les changements pour annuler/refaire:
```java
public class EditOperation {
// Enregistre changements de blocs
// Permet l'inversion
}
```
## Systeme de Materiaux
### Material
Wrapper pour materiaux de blocs:
```java
public class Material {
// Reference type de bloc
// Proprietes additionnelles (rotation, teinte)
}
```
### Patterns de Blocs
Les patterns definissent comment les blocs sont selectionnes:
| Pattern | Description |
|---------|-------------|
| `[Stone]` | Type de bloc unique |
| `[50%Stone, 50%Dirt]` | Aleatoire pondere |
| `[Stone, Dirt, Grass]` | Poids egaux |
### Masques de Blocs
Les masques filtrent quels blocs sont affectes:
| Masque | Description |
|--------|-------------|
| `[Stone]` | Affecter uniquement pierre |
| `[!Air]` | Affecter blocs non-air |
| `[!^Fluid]` | Exclure blocs tagues fluide |
## Parametres Copier/Couper
### CopyCutSettings
Configuration pour operations copier et couper:
```java
public class CopyCutSettings {
// Flag inclure entites
// Flag inclure donnees biome
// Niveau compression
}
```
## Arguments Outil
Les outils de construction supportent des arguments configurables:
### Types d'Arguments
| Type | Classe | Description |
|------|--------|-------------|
| Block | `BlockArg` | Selection type bloc |
| Bool | `BoolArg` | Flag booleen |
| Int | `IntArg` | Valeur entiere |
| Float | `FloatArg` | Valeur decimale |
| Mask | `MaskArg` | Masque de blocs |
| String | `StringArg` | Valeur texte |
| BrushShape | `BrushShapeArg` | Sphere, Cube, etc. |
| BrushOrigin | `BrushOriginArg` | Center, Surface, etc. |
### Paquets Arguments Outil
Les arguments se synchronisent via paquets reseau:
```java
// Paquet BuilderToolArgUpdate
// Synchronise changements arguments vers serveur
```
## Configuration Brosse
### Forme Brosse
```java
public enum BrushShape {
Sphere,
Cube,
Cylinder,
// ...
}
```
### Origine Brosse
```java
public enum BrushOrigin {
Center, // Brosse centree sur clic
Surface, // Brosse sur surface
Offset // Decalage personnalise
}
```
### Axe Brosse
```java
public enum BrushAxis {
Y, // Toujours vertical
View, // Suivre direction vue
Surface // Normal a la surface
}
```
## Utilisation de l'API
### Acceder aux Parametres Outil
```java
BuilderToolsPlugin tools = BuilderToolsPlugin.get();
BuilderToolsUserData userData = tools.getUserData(player);
```
### Obtenir Outil Actuel
```java
BuilderTool currentTool = userData.getCurrentTool();
BuilderToolData toolData = currentTool.getData();
```
## Etat Outil
### BuilderToolState
Suit l'etat actuel de l'outil:
```java
// Paquet BuilderToolState
// Synchronise etat outil vers client
```
### Donnees Brosse
```java
// Paquet BuilderToolBrushData
// Contient taille brosse, forme, pattern
```

View File

@@ -0,0 +1,212 @@
---
title: Manifest Schema
type: docs
weight: 1
---
The `manifest.json` file defines your plugin's metadata and configuration.
## Basic Structure
```json
{
"name": "MyPlugin",
"version": "1.0.0",
"main": "com.example.MyPlugin",
"dependencies": []
}
```
## Required Fields
### name
**Type:** `string`
The unique identifier for your plugin. Used for logging and dependency resolution.
```json
{
"name": "MyAwesomePlugin"
}
```
### version
**Type:** `string`
The plugin version following semantic versioning (recommended).
```json
{
"version": "1.0.0"
}
```
### main
**Type:** `string`
The fully qualified class name of your main plugin class. This class must extend `JavaPlugin`.
```json
{
"main": "com.example.myplugin.MyPlugin"
}
```
## Optional Fields
### dependencies
**Type:** `string[]`
List of plugin names this plugin depends on. Dependent plugins will be loaded first.
```json
{
"dependencies": ["CoreLib", "DatabasePlugin"]
}
```
### description
**Type:** `string`
A brief description of your plugin.
```json
{
"description": "Adds awesome features to the server"
}
```
### author
**Type:** `string`
The plugin author or team name.
```json
{
"author": "YourName"
}
```
### authors
**Type:** `string[]`
List of plugin authors for team projects.
```json
{
"authors": ["Developer1", "Developer2"]
}
```
### website
**Type:** `string`
Plugin homepage or documentation URL.
```json
{
"website": "https://example.com/myplugin"
}
```
## Complete Example
```json
{
"name": "EconomyPlugin",
"version": "2.1.0",
"main": "com.example.economy.EconomyPlugin",
"description": "A comprehensive economy system for Hytale servers",
"author": "GameDev",
"authors": ["GameDev", "Contributor1"],
"website": "https://github.com/example/economy",
"dependencies": ["DatabaseLib"]
}
```
## File Location
The `manifest.json` must be placed in the root of your plugin JAR file:
```
MyPlugin.jar
├── manifest.json
├── com/
│ └── example/
│ └── myplugin/
│ └── MyPlugin.class
└── resources/
└── config.yml
```
## Validation
{{< callout type="warning" >}}
The server validates manifest.json on startup. Invalid manifests will prevent your plugin from loading.
Common issues:
- Missing required fields (name, version, main)
- Invalid JSON syntax
- Main class not found in JAR
- Circular dependencies
{{< /callout >}}
## Main Class Requirements
Your main class specified in `main` must:
1. Extend `JavaPlugin`
2. Have a public no-argument constructor
3. Be accessible in the JAR classpath
```java
package com.example.myplugin;
import com.hypixel.hytale.server.core.plugin.JavaPlugin;
public class MyPlugin extends JavaPlugin {
@Override
public void start() {
// Plugin enabled - register events, commands, etc.
getLogger().at(Level.INFO).log("Plugin started!");
}
@Override
public void shutdown() {
// Plugin disabled - cleanup resources
}
}
```
## Dependency Resolution
Dependencies are loaded in order:
1. All dependencies must be present and valid
2. Circular dependencies cause load failure
3. Missing dependencies cause load failure
```
LoadOrder:
1. DatabaseLib (no dependencies)
2. CoreLib (depends on DatabaseLib)
3. MyPlugin (depends on CoreLib)
```
## Version Compatibility
{{< callout type="info" >}}
Consider versioning your plugin API if other plugins depend on you:
- Major: Breaking changes
- Minor: New features, backward compatible
- Patch: Bug fixes
{{< /callout >}}
```json
{
"name": "MyAPI",
"version": "2.0.0"
}
```
Dependent plugins can then specify minimum versions in their documentation.

View File

@@ -0,0 +1,212 @@
---
title: Schéma du Manifeste
type: docs
weight: 1
---
Le fichier `manifest.json` définit les métadonnées et la configuration de votre plugin.
## Structure de Base
```json
{
"name": "MyPlugin",
"version": "1.0.0",
"main": "com.example.MyPlugin",
"dependencies": []
}
```
## Champs Requis
### name
**Type :** `string`
L'identifiant unique de votre plugin. Utilisé pour le logging et la résolution des dépendances.
```json
{
"name": "MyAwesomePlugin"
}
```
### version
**Type :** `string`
La version du plugin suivant le versioning sémantique (recommandé).
```json
{
"version": "1.0.0"
}
```
### main
**Type :** `string`
Le nom de classe pleinement qualifié de votre classe principale de plugin. Cette classe doit étendre `JavaPlugin`.
```json
{
"main": "com.example.myplugin.MyPlugin"
}
```
## Champs Optionnels
### dependencies
**Type :** `string[]`
Liste des noms de plugins dont ce plugin dépend. Les plugins dépendants seront chargés en premier.
```json
{
"dependencies": ["CoreLib", "DatabasePlugin"]
}
```
### description
**Type :** `string`
Une brève description de votre plugin.
```json
{
"description": "Ajoute des fonctionnalités géniales au serveur"
}
```
### author
**Type :** `string`
L'auteur du plugin ou le nom de l'équipe.
```json
{
"author": "VotreNom"
}
```
### authors
**Type :** `string[]`
Liste des auteurs du plugin pour les projets d'équipe.
```json
{
"authors": ["Développeur1", "Développeur2"]
}
```
### website
**Type :** `string`
Page d'accueil du plugin ou URL de documentation.
```json
{
"website": "https://example.com/myplugin"
}
```
## Exemple Complet
```json
{
"name": "EconomyPlugin",
"version": "2.1.0",
"main": "com.example.economy.EconomyPlugin",
"description": "Un système économique complet pour les serveurs Hytale",
"author": "GameDev",
"authors": ["GameDev", "Contributeur1"],
"website": "https://github.com/example/economy",
"dependencies": ["DatabaseLib"]
}
```
## Emplacement du Fichier
Le `manifest.json` doit être placé à la racine de votre fichier JAR de plugin :
```
MyPlugin.jar
├── manifest.json
├── com/
│ └── example/
│ └── myplugin/
│ └── MyPlugin.class
└── resources/
└── config.yml
```
## Validation
{{< callout type="warning" >}}
Le serveur valide manifest.json au démarrage. Les manifestes invalides empêcheront votre plugin de se charger.
Problèmes courants :
- Champs requis manquants (name, version, main)
- Syntaxe JSON invalide
- Classe principale non trouvée dans le JAR
- Dépendances circulaires
{{< /callout >}}
## Exigences de la Classe Principale
Votre classe principale spécifiée dans `main` doit :
1. Étendre `JavaPlugin`
2. Avoir un constructeur public sans argument
3. Être accessible dans le classpath du JAR
```java
package com.example.myplugin;
import com.hypixel.hytale.server.core.plugin.JavaPlugin;
public class MyPlugin extends JavaPlugin {
@Override
public void start() {
// Plugin activé - enregistrer événements, commandes, etc.
getLogger().at(Level.INFO).log("Plugin démarré !");
}
@Override
public void shutdown() {
// Plugin désactivé - nettoyage ressources
}
}
```
## Résolution des Dépendances
Les dépendances sont chargées dans l'ordre :
1. Toutes les dépendances doivent être présentes et valides
2. Les dépendances circulaires causent un échec de chargement
3. Les dépendances manquantes causent un échec de chargement
```
Ordre de Chargement :
1. DatabaseLib (pas de dépendances)
2. CoreLib (dépend de DatabaseLib)
3. MyPlugin (dépend de CoreLib)
```
## Compatibilité des Versions
{{< callout type="info" >}}
Considérez le versioning de l'API de votre plugin si d'autres plugins dépendent de vous :
- Majeur : Changements cassants
- Mineur : Nouvelles fonctionnalités, rétrocompatible
- Patch : Corrections de bugs
{{< /callout >}}
```json
{
"name": "MyAPI",
"version": "2.0.0"
}
```
Les plugins dépendants peuvent alors spécifier les versions minimales dans leur documentation.