5.7 KiB
5.7 KiB
title, type, weight
| title | type | weight |
|---|---|---|
| Brosses Scriptees | docs | 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/
# 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
// 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 |
{
"Type": "Shape",
"Shape": "Sphere" // Sphere, Cube, Cylinder
}
Operations de Dimension
{
"Type": "Dimensions",
"Width": 10,
"Height": 5,
"Depth": 10
}
{
"Type": "RandomizeDimensions",
"MinWidth": 3,
"MaxWidth": 7,
"MinHeight": 3,
"MaxHeight": 7
}
Operations de Materiau
{
"Type": "Material",
"Pattern": "[50%Rock_Stone, 50%Rock_Shale]"
}
{
"Type": "BlockPattern",
"Pattern": "[Rock_Stone]"
}
{
"Type": "Replace",
"From": "[Grass]",
"To": "[Dirt]"
}
Operations de Masque
{
"Type": "Mask",
"Mask": "[!Air]"
}
{
"Type": "AppendMask",
"Mask": "[!Water]"
}
{
"Type": "HistoryMask"
// Affecter uniquement blocs precedemment modifies
}
{
"Type": "UseBrushMask"
// Utiliser masque des arguments outil
}
Operations de Decalage
{
"Type": "Offset",
"X": 0,
"Y": 5,
"Z": 0
}
{
"Type": "RandomOffset",
"MinX": -2,
"MaxX": 2,
"MinY": 0,
"MaxY": 5,
"MinZ": -2,
"MaxZ": 2
}
Controle de Flux
Boucles
{
"Type": "Loop",
"Count": 5,
"StartIndex": 2,
"EndIndex": 6
}
{
"Type": "LoopRandom",
"MinCount": 3,
"MaxCount": 8
}
{
"Type": "CircleOffsetAndLoop",
"Radius": 5,
"Count": 8
}
Conditionnels
{
"Type": "JumpIfBlockType",
"BlockType": "Air",
"Index": 10,
"ElseIndex": 5
}
{
"Type": "JumpIfClickType",
"ClickType": "Primary",
"Index": 3
}
{
"Type": "JumpIfCompare",
"Variable": "height",
"Operator": ">",
"Value": 5,
"Index": 8
}
{
"Type": "JumpToIndex",
"Index": 0
}
{
"Type": "Exit"
// Arreter execution brosse
}
Operations Speciales
{
"Type": "Echo",
"Message": "Brosse appliquee!"
}
{
"Type": "RunCommand",
"Command": "/fill [Stone]"
}
{
"Type": "PastePrefab",
"PrefabId": "tree_oak"
}
{
"Type": "HeightmapLayer",
"Layer": 0
}
Operations Sauvegarde/Chargement
{
"Type": "LoadOperationsFromAsset",
"AssetId": "common_setup"
}
{
"Type": "SaveBrushConfig",
"Key": "my_config"
}
{
"Type": "LoadBrushConfig",
"Key": "my_config"
}
Operations Globales
Operations qui affectent toute la brosse:
{
"Type": "Debug",
"Enabled": true
}
{
"Type": "DisableHoldInteraction"
// Declencher uniquement au clic, pas au maintien
}
{
"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
ScriptedBrushAsset brush = ScriptedBrushAsset.get("terrain_sphere");
Executer une Brosse
BrushConfigCommandExecutor executor = new BrushConfigCommandExecutor();
brush.loadIntoExecutor(executor);
// Executer operations sequentiellement
Acceder aux Operations
List<BrushOperation> operations = brush.getOperations();
for (BrushOperation op : operations) {
if (op instanceof SequenceBrushOperation) {
// Operation sequentielle
} else if (op instanceof GlobalBrushOperation) {
// Modificateur global
}
}