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,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
```