Init
This commit is contained in:
112
content/world/entities/spawning/_index.en.md
Normal file
112
content/world/entities/spawning/_index.en.md
Normal file
@@ -0,0 +1,112 @@
|
||||
---
|
||||
title: Spawning
|
||||
type: docs
|
||||
weight: 6
|
||||
---
|
||||
|
||||
The spawning system provides comprehensive NPC spawn management through markers, beacons, world spawning, and suppression mechanics.
|
||||
|
||||
**Package:** `com.hypixel.hytale.server.spawning`
|
||||
|
||||
## Architecture
|
||||
|
||||
```
|
||||
SpawningPlugin
|
||||
├── Managers
|
||||
│ ├── WorldSpawnManager - World-level NPC spawning
|
||||
│ ├── BeaconSpawnManager - Beacon-based spawning
|
||||
│ └── SpawnManager<W, S> - Base spawn manager
|
||||
├── Assets
|
||||
│ ├── SpawnMarker - Marker spawn definitions
|
||||
│ ├── SpawnSuppression - Suppression zones
|
||||
│ ├── WorldNPCSpawn - World spawn configs
|
||||
│ └── BeaconNPCSpawn - Beacon spawn configs
|
||||
├── Components
|
||||
│ ├── SpawnMarkerEntity - Marker entity data
|
||||
│ ├── SpawnSuppressionComponent - Entity suppression
|
||||
│ ├── LocalSpawnController - Player-local spawning
|
||||
│ ├── WorldSpawnData - World spawn state
|
||||
│ └── ChunkSpawnData - Chunk spawn state
|
||||
├── Controllers
|
||||
│ ├── SpawnController - Base controller
|
||||
│ ├── BeaconSpawnController - Beacon controller
|
||||
│ └── LocalSpawnController - Local controller
|
||||
├── Systems
|
||||
│ ├── WorldSpawningSystem - World spawn logic
|
||||
│ ├── SpawnMarkerSystems - Marker processing
|
||||
│ ├── SpawnBeaconSystems - Beacon processing
|
||||
│ └── SpawnSuppressionSystems - Suppression logic
|
||||
├── Interactions
|
||||
│ └── TriggerSpawnMarkersInteraction
|
||||
└── Commands
|
||||
└── SpawnCommand (enable, disable, beacons, markers, populate, stats, suppression)
|
||||
```
|
||||
|
||||
## Spawn Types
|
||||
|
||||
### Spawn Markers
|
||||
|
||||
Static spawn points that spawn NPCs with configurable respawn timing:
|
||||
|
||||
```java
|
||||
SpawnMarker marker = SpawnMarker.getAssetMap().getAsset("village_guard");
|
||||
IWeightedMap<SpawnConfiguration> npcs = marker.getWeightedConfigurations();
|
||||
```
|
||||
|
||||
**Asset Location:** `NPC/Spawn/Markers/`
|
||||
|
||||
### Spawn Beacons
|
||||
|
||||
Dynamic spawn points associated with entities that trigger spawning in a radius:
|
||||
|
||||
```java
|
||||
BeaconSpawnManager manager = SpawningPlugin.get().getBeaconSpawnManager();
|
||||
List<BeaconSpawnWrapper> beacons = manager.getBeaconSpawns(environmentId);
|
||||
```
|
||||
|
||||
**Asset Location:** `NPC/Spawn/Beacons/`
|
||||
|
||||
### World Spawning
|
||||
|
||||
Ambient NPC spawning based on environment and biome:
|
||||
|
||||
```java
|
||||
WorldSpawnManager manager = SpawningPlugin.get().getWorldSpawnManager();
|
||||
```
|
||||
|
||||
**Asset Location:** `NPC/Spawn/World/`
|
||||
|
||||
### Spawn Suppression
|
||||
|
||||
Zones that prevent NPC spawning within a radius:
|
||||
|
||||
```java
|
||||
SpawnSuppression suppression = SpawnSuppression.getAssetMap().getAsset("safe_zone");
|
||||
double radius = suppression.getRadius();
|
||||
int[] suppressedGroups = suppression.getSuppressedGroupIds();
|
||||
```
|
||||
|
||||
**Asset Location:** `NPC/Spawn/Suppression/`
|
||||
|
||||
## Commands
|
||||
|
||||
| Command | Description |
|
||||
|---------|-------------|
|
||||
| `/spawning enable [world]` | Enable NPC spawning in world |
|
||||
| `/spawning disable [world]` | Disable NPC spawning in world |
|
||||
| `/spawning beacons` | Beacon spawn management |
|
||||
| `/spawning markers` | Spawn marker management |
|
||||
| `/spawning populate` | Force spawn population |
|
||||
| `/spawning stats` | View spawning statistics |
|
||||
| `/spawning suppression` | Suppression zone management |
|
||||
|
||||
**Alias:** `/sp`
|
||||
|
||||
## Section Contents
|
||||
|
||||
{{< cards >}}
|
||||
{{< card link="world-spawning" title="World Spawning" subtitle="Environment-based NPC spawning" icon="globe" >}}
|
||||
{{< card link="spawn-suppression" title="Spawn Suppression" subtitle="Prevent spawns in areas" icon="shield-exclamation" >}}
|
||||
{{< card link="local-spawning" title="Local Spawning" subtitle="Player-proximity spawning" icon="user" >}}
|
||||
{{< card link="spawner-assets" title="Spawner Assets" subtitle="Markers and beacons configuration" icon="document-text" >}}
|
||||
{{< /cards >}}
|
||||
112
content/world/entities/spawning/_index.fr.md
Normal file
112
content/world/entities/spawning/_index.fr.md
Normal file
@@ -0,0 +1,112 @@
|
||||
---
|
||||
title: Spawning
|
||||
type: docs
|
||||
weight: 6
|
||||
---
|
||||
|
||||
Le systeme de spawning fournit une gestion complete du spawn de NPCs via des marqueurs, beacons, spawning mondial et mecaniques de suppression.
|
||||
|
||||
**Package:** `com.hypixel.hytale.server.spawning`
|
||||
|
||||
## Architecture
|
||||
|
||||
```
|
||||
SpawningPlugin
|
||||
├── Managers
|
||||
│ ├── WorldSpawnManager - Spawning NPC niveau monde
|
||||
│ ├── BeaconSpawnManager - Spawning base sur beacons
|
||||
│ └── SpawnManager<W, S> - Manager de spawn de base
|
||||
├── Assets
|
||||
│ ├── SpawnMarker - Definitions de spawn marqueur
|
||||
│ ├── SpawnSuppression - Zones de suppression
|
||||
│ ├── WorldNPCSpawn - Configs spawn monde
|
||||
│ └── BeaconNPCSpawn - Configs spawn beacon
|
||||
├── Composants
|
||||
│ ├── SpawnMarkerEntity - Donnees entite marqueur
|
||||
│ ├── SpawnSuppressionComponent - Suppression entite
|
||||
│ ├── LocalSpawnController - Spawning local joueur
|
||||
│ ├── WorldSpawnData - Etat spawn monde
|
||||
│ └── ChunkSpawnData - Etat spawn chunk
|
||||
├── Controleurs
|
||||
│ ├── SpawnController - Controleur de base
|
||||
│ ├── BeaconSpawnController - Controleur beacon
|
||||
│ └── LocalSpawnController - Controleur local
|
||||
├── Systemes
|
||||
│ ├── WorldSpawningSystem - Logique spawn monde
|
||||
│ ├── SpawnMarkerSystems - Traitement marqueurs
|
||||
│ ├── SpawnBeaconSystems - Traitement beacons
|
||||
│ └── SpawnSuppressionSystems - Logique suppression
|
||||
├── Interactions
|
||||
│ └── TriggerSpawnMarkersInteraction
|
||||
└── Commandes
|
||||
└── SpawnCommand (enable, disable, beacons, markers, populate, stats, suppression)
|
||||
```
|
||||
|
||||
## Types de Spawn
|
||||
|
||||
### Marqueurs de Spawn
|
||||
|
||||
Points de spawn statiques qui font apparaitre des NPCs avec timing de reapparition configurable:
|
||||
|
||||
```java
|
||||
SpawnMarker marker = SpawnMarker.getAssetMap().getAsset("village_guard");
|
||||
IWeightedMap<SpawnConfiguration> npcs = marker.getWeightedConfigurations();
|
||||
```
|
||||
|
||||
**Emplacement Asset:** `NPC/Spawn/Markers/`
|
||||
|
||||
### Beacons de Spawn
|
||||
|
||||
Points de spawn dynamiques associes a des entites qui declenchent le spawning dans un rayon:
|
||||
|
||||
```java
|
||||
BeaconSpawnManager manager = SpawningPlugin.get().getBeaconSpawnManager();
|
||||
List<BeaconSpawnWrapper> beacons = manager.getBeaconSpawns(environmentId);
|
||||
```
|
||||
|
||||
**Emplacement Asset:** `NPC/Spawn/Beacons/`
|
||||
|
||||
### Spawning Mondial
|
||||
|
||||
Spawning ambiant de NPCs base sur l'environnement et le biome:
|
||||
|
||||
```java
|
||||
WorldSpawnManager manager = SpawningPlugin.get().getWorldSpawnManager();
|
||||
```
|
||||
|
||||
**Emplacement Asset:** `NPC/Spawn/World/`
|
||||
|
||||
### Suppression de Spawn
|
||||
|
||||
Zones qui empechent le spawn de NPCs dans un rayon:
|
||||
|
||||
```java
|
||||
SpawnSuppression suppression = SpawnSuppression.getAssetMap().getAsset("safe_zone");
|
||||
double radius = suppression.getRadius();
|
||||
int[] suppressedGroups = suppression.getSuppressedGroupIds();
|
||||
```
|
||||
|
||||
**Emplacement Asset:** `NPC/Spawn/Suppression/`
|
||||
|
||||
## Commandes
|
||||
|
||||
| Commande | Description |
|
||||
|----------|-------------|
|
||||
| `/spawning enable [monde]` | Activer le spawning NPC dans le monde |
|
||||
| `/spawning disable [monde]` | Desactiver le spawning NPC dans le monde |
|
||||
| `/spawning beacons` | Gestion des spawn beacons |
|
||||
| `/spawning markers` | Gestion des marqueurs de spawn |
|
||||
| `/spawning populate` | Forcer la population de spawn |
|
||||
| `/spawning stats` | Voir les statistiques de spawning |
|
||||
| `/spawning suppression` | Gestion des zones de suppression |
|
||||
|
||||
**Alias:** `/sp`
|
||||
|
||||
## Contenu de la Section
|
||||
|
||||
{{< cards >}}
|
||||
{{< card link="world-spawning" title="Spawning Mondial" subtitle="Spawning NPC base sur l'environnement" icon="globe" >}}
|
||||
{{< card link="spawn-suppression" title="Suppression de Spawn" subtitle="Empecher les spawns dans des zones" icon="shield-exclamation" >}}
|
||||
{{< card link="local-spawning" title="Spawning Local" subtitle="Spawning par proximite joueur" icon="user" >}}
|
||||
{{< card link="spawner-assets" title="Assets Spawner" subtitle="Configuration marqueurs et beacons" icon="document-text" >}}
|
||||
{{< /cards >}}
|
||||
212
content/world/entities/spawning/local-spawning.en.md
Normal file
212
content/world/entities/spawning/local-spawning.en.md
Normal file
@@ -0,0 +1,212 @@
|
||||
---
|
||||
title: Local Spawning
|
||||
type: docs
|
||||
weight: 3
|
||||
---
|
||||
|
||||
Local spawning manages NPC spawning around players, ensuring active gameplay areas have appropriate creature density.
|
||||
|
||||
**Package:** `com.hypixel.hytale.server.spawning.local`
|
||||
|
||||
## Architecture
|
||||
|
||||
```
|
||||
Local Spawning
|
||||
├── Components
|
||||
│ ├── LocalSpawnController - Player spawn controller
|
||||
│ ├── LocalSpawnBeacon - Local spawn point
|
||||
│ └── LocalSpawnState - Spawn state tracking
|
||||
└── Systems
|
||||
├── LocalSpawnSetupSystem - Initialize local spawning
|
||||
├── LocalSpawnControllerSystem - Process controllers
|
||||
├── LocalSpawnBeaconSystem - Process beacons
|
||||
└── LocalSpawnForceTriggerSystem - Manual triggers
|
||||
```
|
||||
|
||||
## LocalSpawnController
|
||||
|
||||
Controls local spawning around a player:
|
||||
|
||||
```java
|
||||
public class LocalSpawnController implements Component<EntityStore> {
|
||||
private double timeToNextRunSeconds;
|
||||
|
||||
public void setTimeToNextRunSeconds(double seconds);
|
||||
public boolean tickTimeToNextRunSeconds(float dt);
|
||||
}
|
||||
```
|
||||
|
||||
### Component Access
|
||||
|
||||
```java
|
||||
// Get component type
|
||||
ComponentType<EntityStore, LocalSpawnController> type =
|
||||
SpawningPlugin.get().getLocalSpawnControllerComponentType();
|
||||
|
||||
// Access on player entity
|
||||
LocalSpawnController controller = store.getComponent(playerRef, type);
|
||||
```
|
||||
|
||||
### Spawn Timing
|
||||
|
||||
The controller uses a configurable delay before spawning:
|
||||
|
||||
```java
|
||||
// Initial delay configured in SpawningPlugin
|
||||
double joinDelay = SpawningPlugin.get().getLocalSpawnControllerJoinDelay();
|
||||
```
|
||||
|
||||
This prevents immediate spawning when a player joins, allowing time for world loading.
|
||||
|
||||
## LocalSpawnBeacon
|
||||
|
||||
Defines local spawn points around players:
|
||||
|
||||
```java
|
||||
public class LocalSpawnBeacon {
|
||||
// Position and configuration for local spawns
|
||||
// Dynamically created based on player position
|
||||
}
|
||||
```
|
||||
|
||||
### Beacon Usage
|
||||
|
||||
Local spawn beacons are automatically managed:
|
||||
1. Created around active players
|
||||
2. Updated as players move
|
||||
3. Removed when players leave area
|
||||
|
||||
## LocalSpawnState
|
||||
|
||||
Tracks local spawn state:
|
||||
|
||||
```java
|
||||
public class LocalSpawnState {
|
||||
// Current spawn state for a local spawn controller
|
||||
// Tracks active spawns and cooldowns
|
||||
}
|
||||
```
|
||||
|
||||
## Systems
|
||||
|
||||
### LocalSpawnSetupSystem
|
||||
|
||||
Initializes local spawning for players:
|
||||
|
||||
```java
|
||||
getEntityStoreRegistry().registerSystem(new LocalSpawnSetupSystem());
|
||||
```
|
||||
|
||||
This system:
|
||||
- Attaches `LocalSpawnController` to new players
|
||||
- Configures initial spawn parameters
|
||||
- Sets up spawn beacons
|
||||
|
||||
### LocalSpawnControllerSystem
|
||||
|
||||
Processes spawn controllers each tick:
|
||||
|
||||
```java
|
||||
getEntityStoreRegistry().registerSystem(new LocalSpawnControllerSystem());
|
||||
```
|
||||
|
||||
This system:
|
||||
- Decrements spawn timers
|
||||
- Checks spawn conditions
|
||||
- Triggers spawn jobs when ready
|
||||
|
||||
### LocalSpawnBeaconSystem
|
||||
|
||||
Manages local spawn beacons:
|
||||
|
||||
```java
|
||||
getEntityStoreRegistry().registerSystem(new LocalSpawnBeaconSystem());
|
||||
```
|
||||
|
||||
This system:
|
||||
- Updates beacon positions
|
||||
- Processes beacon spawn logic
|
||||
- Handles beacon lifecycle
|
||||
|
||||
### LocalSpawnForceTriggerSystem
|
||||
|
||||
Handles forced spawn triggers:
|
||||
|
||||
```java
|
||||
getEntityStoreRegistry().registerSystem(new LocalSpawnForceTriggerSystem());
|
||||
```
|
||||
|
||||
Used for:
|
||||
- Debug commands
|
||||
- Event-triggered spawning
|
||||
- Manual population
|
||||
|
||||
## API Usage
|
||||
|
||||
### Get Local Spawn Controller
|
||||
|
||||
```java
|
||||
ComponentType<EntityStore, LocalSpawnController> type =
|
||||
LocalSpawnController.getComponentType();
|
||||
|
||||
LocalSpawnController controller = store.getComponent(playerRef, type);
|
||||
if (controller != null) {
|
||||
// Player has local spawning enabled
|
||||
}
|
||||
```
|
||||
|
||||
### Force Spawn Update
|
||||
|
||||
```java
|
||||
// Reset spawn timer to trigger immediate check
|
||||
LocalSpawnController controller = store.getComponent(playerRef, type);
|
||||
controller.setTimeToNextRunSeconds(0);
|
||||
```
|
||||
|
||||
### Check Spawn Ready
|
||||
|
||||
```java
|
||||
// Check if spawn timer has elapsed
|
||||
boolean ready = controller.tickTimeToNextRunSeconds(deltaTime);
|
||||
if (ready) {
|
||||
// Time to attempt spawning
|
||||
}
|
||||
```
|
||||
|
||||
## Configuration
|
||||
|
||||
### Join Delay
|
||||
|
||||
Configure the delay before local spawning starts for new players:
|
||||
|
||||
```java
|
||||
double delay = SpawningPlugin.get().getLocalSpawnControllerJoinDelay();
|
||||
```
|
||||
|
||||
This prevents:
|
||||
- Immediate spawn-in ambushes
|
||||
- Overwhelming new players
|
||||
- Spawning before world is loaded
|
||||
|
||||
### Spawn Radius
|
||||
|
||||
Local spawning uses a configured radius around players:
|
||||
|
||||
```java
|
||||
// Spawn radius determines how far from player NPCs can spawn
|
||||
// Configured per spawn definition
|
||||
```
|
||||
|
||||
## Integration with World Spawning
|
||||
|
||||
Local spawning works alongside world spawning:
|
||||
|
||||
| System | Scope | Trigger |
|
||||
|--------|-------|---------|
|
||||
| World Spawning | Chunk-based | Chunk loading |
|
||||
| Local Spawning | Player-centric | Player proximity |
|
||||
|
||||
Both systems:
|
||||
- Respect spawn suppression
|
||||
- Use same NPC pool
|
||||
- Share spawn limits
|
||||
212
content/world/entities/spawning/local-spawning.fr.md
Normal file
212
content/world/entities/spawning/local-spawning.fr.md
Normal file
@@ -0,0 +1,212 @@
|
||||
---
|
||||
title: Spawning Local
|
||||
type: docs
|
||||
weight: 3
|
||||
---
|
||||
|
||||
Le spawning local gere le spawn de NPCs autour des joueurs, assurant que les zones de jeu actives ont une densite de creatures appropriee.
|
||||
|
||||
**Package:** `com.hypixel.hytale.server.spawning.local`
|
||||
|
||||
## Architecture
|
||||
|
||||
```
|
||||
Spawning Local
|
||||
├── Composants
|
||||
│ ├── LocalSpawnController - Controleur spawn joueur
|
||||
│ ├── LocalSpawnBeacon - Point de spawn local
|
||||
│ └── LocalSpawnState - Suivi etat spawn
|
||||
└── Systemes
|
||||
├── LocalSpawnSetupSystem - Initialiser spawning local
|
||||
├── LocalSpawnControllerSystem - Traiter controleurs
|
||||
├── LocalSpawnBeaconSystem - Traiter beacons
|
||||
└── LocalSpawnForceTriggerSystem - Declencheurs manuels
|
||||
```
|
||||
|
||||
## LocalSpawnController
|
||||
|
||||
Controle le spawning local autour d'un joueur:
|
||||
|
||||
```java
|
||||
public class LocalSpawnController implements Component<EntityStore> {
|
||||
private double timeToNextRunSeconds;
|
||||
|
||||
public void setTimeToNextRunSeconds(double seconds);
|
||||
public boolean tickTimeToNextRunSeconds(float dt);
|
||||
}
|
||||
```
|
||||
|
||||
### Acces au Composant
|
||||
|
||||
```java
|
||||
// Obtenir type de composant
|
||||
ComponentType<EntityStore, LocalSpawnController> type =
|
||||
SpawningPlugin.get().getLocalSpawnControllerComponentType();
|
||||
|
||||
// Acceder sur entite joueur
|
||||
LocalSpawnController controller = store.getComponent(playerRef, type);
|
||||
```
|
||||
|
||||
### Timing de Spawn
|
||||
|
||||
Le controleur utilise un delai configurable avant spawning:
|
||||
|
||||
```java
|
||||
// Delai initial configure dans SpawningPlugin
|
||||
double joinDelay = SpawningPlugin.get().getLocalSpawnControllerJoinDelay();
|
||||
```
|
||||
|
||||
Cela empeche le spawning immediat quand un joueur rejoint, laissant le temps au monde de charger.
|
||||
|
||||
## LocalSpawnBeacon
|
||||
|
||||
Definit les points de spawn locaux autour des joueurs:
|
||||
|
||||
```java
|
||||
public class LocalSpawnBeacon {
|
||||
// Position et configuration pour spawns locaux
|
||||
// Cree dynamiquement base sur position joueur
|
||||
}
|
||||
```
|
||||
|
||||
### Utilisation des Beacons
|
||||
|
||||
Les beacons de spawn locaux sont geres automatiquement:
|
||||
1. Crees autour des joueurs actifs
|
||||
2. Mis a jour quand joueurs bougent
|
||||
3. Supprimes quand joueurs quittent la zone
|
||||
|
||||
## LocalSpawnState
|
||||
|
||||
Suit l'etat de spawn local:
|
||||
|
||||
```java
|
||||
public class LocalSpawnState {
|
||||
// Etat de spawn actuel pour un controleur local
|
||||
// Suit spawns actifs et cooldowns
|
||||
}
|
||||
```
|
||||
|
||||
## Systemes
|
||||
|
||||
### LocalSpawnSetupSystem
|
||||
|
||||
Initialise le spawning local pour les joueurs:
|
||||
|
||||
```java
|
||||
getEntityStoreRegistry().registerSystem(new LocalSpawnSetupSystem());
|
||||
```
|
||||
|
||||
Ce systeme:
|
||||
- Attache `LocalSpawnController` aux nouveaux joueurs
|
||||
- Configure parametres de spawn initiaux
|
||||
- Configure les beacons de spawn
|
||||
|
||||
### LocalSpawnControllerSystem
|
||||
|
||||
Traite les controleurs de spawn a chaque tick:
|
||||
|
||||
```java
|
||||
getEntityStoreRegistry().registerSystem(new LocalSpawnControllerSystem());
|
||||
```
|
||||
|
||||
Ce systeme:
|
||||
- Decremente les timers de spawn
|
||||
- Verifie les conditions de spawn
|
||||
- Declenche jobs de spawn quand pret
|
||||
|
||||
### LocalSpawnBeaconSystem
|
||||
|
||||
Gere les beacons de spawn locaux:
|
||||
|
||||
```java
|
||||
getEntityStoreRegistry().registerSystem(new LocalSpawnBeaconSystem());
|
||||
```
|
||||
|
||||
Ce systeme:
|
||||
- Met a jour positions des beacons
|
||||
- Traite logique spawn beacon
|
||||
- Gere cycle de vie beacon
|
||||
|
||||
### LocalSpawnForceTriggerSystem
|
||||
|
||||
Gere les declencheurs de spawn forces:
|
||||
|
||||
```java
|
||||
getEntityStoreRegistry().registerSystem(new LocalSpawnForceTriggerSystem());
|
||||
```
|
||||
|
||||
Utilise pour:
|
||||
- Commandes debug
|
||||
- Spawning declenche par evenement
|
||||
- Population manuelle
|
||||
|
||||
## Utilisation de l'API
|
||||
|
||||
### Obtenir Controleur Spawn Local
|
||||
|
||||
```java
|
||||
ComponentType<EntityStore, LocalSpawnController> type =
|
||||
LocalSpawnController.getComponentType();
|
||||
|
||||
LocalSpawnController controller = store.getComponent(playerRef, type);
|
||||
if (controller != null) {
|
||||
// Le joueur a le spawning local active
|
||||
}
|
||||
```
|
||||
|
||||
### Forcer Mise a Jour Spawn
|
||||
|
||||
```java
|
||||
// Reset timer spawn pour declencher verification immediate
|
||||
LocalSpawnController controller = store.getComponent(playerRef, type);
|
||||
controller.setTimeToNextRunSeconds(0);
|
||||
```
|
||||
|
||||
### Verifier Pret pour Spawn
|
||||
|
||||
```java
|
||||
// Verifier si timer spawn ecoule
|
||||
boolean ready = controller.tickTimeToNextRunSeconds(deltaTime);
|
||||
if (ready) {
|
||||
// Temps de tenter spawning
|
||||
}
|
||||
```
|
||||
|
||||
## Configuration
|
||||
|
||||
### Delai de Connexion
|
||||
|
||||
Configurer le delai avant que spawning local demarre pour nouveaux joueurs:
|
||||
|
||||
```java
|
||||
double delay = SpawningPlugin.get().getLocalSpawnControllerJoinDelay();
|
||||
```
|
||||
|
||||
Cela empeche:
|
||||
- Embuscades immediates au spawn
|
||||
- Submerger les nouveaux joueurs
|
||||
- Spawning avant chargement monde
|
||||
|
||||
### Rayon de Spawn
|
||||
|
||||
Le spawning local utilise un rayon configure autour des joueurs:
|
||||
|
||||
```java
|
||||
// Le rayon de spawn determine a quelle distance du joueur les NPCs peuvent spawn
|
||||
// Configure par definition de spawn
|
||||
```
|
||||
|
||||
## Integration avec Spawning Mondial
|
||||
|
||||
Le spawning local fonctionne avec le spawning mondial:
|
||||
|
||||
| Systeme | Portee | Declencheur |
|
||||
|---------|--------|-------------|
|
||||
| Spawning Mondial | Base chunk | Chargement chunk |
|
||||
| Spawning Local | Centre joueur | Proximite joueur |
|
||||
|
||||
Les deux systemes:
|
||||
- Respectent la suppression de spawn
|
||||
- Utilisent le meme pool NPC
|
||||
- Partagent les limites de spawn
|
||||
249
content/world/entities/spawning/spawn-suppression.en.md
Normal file
249
content/world/entities/spawning/spawn-suppression.en.md
Normal file
@@ -0,0 +1,249 @@
|
||||
---
|
||||
title: Spawn Suppression
|
||||
type: docs
|
||||
weight: 2
|
||||
---
|
||||
|
||||
Spawn suppression allows preventing NPC spawning within defined areas, useful for safe zones, player bases, and controlled environments.
|
||||
|
||||
**Package:** `com.hypixel.hytale.server.spawning.suppression`
|
||||
|
||||
## Architecture
|
||||
|
||||
```
|
||||
Spawn Suppression
|
||||
├── Assets
|
||||
│ └── SpawnSuppression - Suppression zone definitions
|
||||
├── Components
|
||||
│ ├── SpawnSuppressionComponent - Entity-attached suppression
|
||||
│ ├── SpawnSuppressionController - Suppression logic
|
||||
│ ├── ChunkSuppressionEntry - Chunk suppression data
|
||||
│ └── ChunkSuppressionQueue - Pending suppressions
|
||||
├── Systems
|
||||
│ ├── SpawnSuppressionSystems - Main suppression logic
|
||||
│ ├── ChunkSuppressionSystems - Chunk-level processing
|
||||
│ └── SpawnMarkerSuppressionSystem - Marker suppression
|
||||
└── Utilities
|
||||
├── SuppressionSpanHelper - Span calculations
|
||||
└── SpawnSuppressorEntry - Suppressor tracking
|
||||
```
|
||||
|
||||
## SpawnSuppression Asset
|
||||
|
||||
### Asset Configuration
|
||||
|
||||
```yaml
|
||||
# NPC/Spawn/Suppression/safe_zone.json
|
||||
{
|
||||
"Id": "safe_zone",
|
||||
"SuppressionRadius": 50.0,
|
||||
"SuppressedGroups": ["hostile", "neutral_aggressive"],
|
||||
"SuppressSpawnMarkers": true
|
||||
}
|
||||
```
|
||||
|
||||
### Asset Fields
|
||||
|
||||
| Field | Type | Description |
|
||||
|-------|------|-------------|
|
||||
| `Id` | String | Unique suppression identifier |
|
||||
| `SuppressionRadius` | Double | Radius of suppression effect |
|
||||
| `SuppressedGroups` | String[] | NPCGroup IDs to suppress |
|
||||
| `SuppressSpawnMarkers` | Boolean | Also suppress spawn markers |
|
||||
|
||||
### Asset Access
|
||||
|
||||
```java
|
||||
// Get suppression asset
|
||||
SpawnSuppression suppression = SpawnSuppression.getAssetMap().getAsset("safe_zone");
|
||||
|
||||
// Get properties
|
||||
double radius = suppression.getRadius();
|
||||
int[] suppressedGroups = suppression.getSuppressedGroupIds();
|
||||
boolean suppressMarkers = suppression.isSuppressSpawnMarkers();
|
||||
```
|
||||
|
||||
## SpawnSuppressionComponent
|
||||
|
||||
Attaches suppression behavior to entities:
|
||||
|
||||
```java
|
||||
public class SpawnSuppressionComponent implements Component<EntityStore> {
|
||||
private String spawnSuppression; // Asset ID reference
|
||||
|
||||
public String getSpawnSuppression();
|
||||
public void setSpawnSuppression(String spawnSuppression);
|
||||
}
|
||||
```
|
||||
|
||||
### Component Usage
|
||||
|
||||
```java
|
||||
// Get component type
|
||||
ComponentType<EntityStore, SpawnSuppressionComponent> type =
|
||||
SpawningPlugin.get().getSpawnSuppressorComponentType();
|
||||
|
||||
// Attach to entity
|
||||
SpawnSuppressionComponent comp = new SpawnSuppressionComponent("safe_zone");
|
||||
store.setComponent(entityRef, type, comp);
|
||||
|
||||
// Read from entity
|
||||
SpawnSuppressionComponent existing = store.getComponent(entityRef, type);
|
||||
String suppressionId = existing.getSpawnSuppression();
|
||||
```
|
||||
|
||||
### Component Codec
|
||||
|
||||
```java
|
||||
public static final BuilderCodec<SpawnSuppressionComponent> CODEC = BuilderCodec.builder(...)
|
||||
.append(new KeyedCodec<>("SpawnSuppression", Codec.STRING), ...)
|
||||
.build();
|
||||
```
|
||||
|
||||
## Suppression Controller
|
||||
|
||||
### SpawnSuppressionController
|
||||
|
||||
Manages active suppression zones:
|
||||
|
||||
```java
|
||||
// Controller tracks active suppressions
|
||||
// Calculates affected chunks
|
||||
// Updates suppression state
|
||||
```
|
||||
|
||||
## Chunk Suppression
|
||||
|
||||
### ChunkSuppressionEntry
|
||||
|
||||
Tracks suppression state per chunk:
|
||||
|
||||
```java
|
||||
// Records which suppressions affect each chunk
|
||||
// Cached for efficient spawn checks
|
||||
```
|
||||
|
||||
### ChunkSuppressionQueue
|
||||
|
||||
Queue of pending suppression updates:
|
||||
|
||||
```java
|
||||
// Handles async suppression calculations
|
||||
// Processes additions and removals
|
||||
```
|
||||
|
||||
### ChunkSuppressionSystems
|
||||
|
||||
Processes chunk-level suppression:
|
||||
|
||||
```java
|
||||
getEntityStoreRegistry().registerSystem(new ChunkSuppressionSystems());
|
||||
```
|
||||
|
||||
## Suppression Systems
|
||||
|
||||
### SpawnSuppressionSystems
|
||||
|
||||
Main suppression logic:
|
||||
|
||||
```java
|
||||
// Processes SpawnSuppressionComponent entities
|
||||
// Updates affected chunk data
|
||||
// Triggers suppression state changes
|
||||
```
|
||||
|
||||
### SpawnMarkerSuppressionSystem
|
||||
|
||||
Handles spawn marker suppression:
|
||||
|
||||
```java
|
||||
// Disables markers within suppression radius
|
||||
// Re-enables when suppression removed
|
||||
```
|
||||
|
||||
## Suppression Utilities
|
||||
|
||||
### SuppressionSpanHelper
|
||||
|
||||
Calculates suppression spans:
|
||||
|
||||
```java
|
||||
SuppressionSpanHelper helper = new SuppressionSpanHelper();
|
||||
// Computes which chunks fall within suppression radius
|
||||
// Handles edge cases at chunk boundaries
|
||||
```
|
||||
|
||||
### SpawnSuppressorEntry
|
||||
|
||||
Tracks individual suppressor entities:
|
||||
|
||||
```java
|
||||
// Links entity reference to suppression config
|
||||
// Enables efficient lookup and cleanup
|
||||
```
|
||||
|
||||
## API Usage
|
||||
|
||||
### Create Suppression Zone
|
||||
|
||||
```java
|
||||
// 1. Define asset in JSON
|
||||
// NPC/Spawn/Suppression/player_base.json
|
||||
|
||||
// 2. Attach component to entity
|
||||
SpawnSuppressionComponent comp = new SpawnSuppressionComponent("player_base");
|
||||
store.setComponent(entityRef, SpawnSuppressionComponent.getComponentType(), comp);
|
||||
```
|
||||
|
||||
### Check If Position Suppressed
|
||||
|
||||
```java
|
||||
// Suppression is checked automatically during spawn attempts
|
||||
// The spawning system queries suppression state per chunk
|
||||
```
|
||||
|
||||
### Remove Suppression
|
||||
|
||||
```java
|
||||
// Remove component to disable suppression
|
||||
store.removeComponent(entityRef, SpawnSuppressionComponent.getComponentType());
|
||||
```
|
||||
|
||||
## Suppression Behavior
|
||||
|
||||
### Radius Calculation
|
||||
|
||||
Suppression uses 3D distance with optimization:
|
||||
- X/Z: Affects entire chunks within radius
|
||||
- Y: Uses exact distance calculation
|
||||
|
||||
This allows NPCs to spawn in caves below or sky above a suppression zone.
|
||||
|
||||
### Group Filtering
|
||||
|
||||
Only specified NPC groups are suppressed:
|
||||
|
||||
```yaml
|
||||
{
|
||||
"SuppressedGroups": ["hostile"]
|
||||
// Hostile NPCs blocked
|
||||
// Friendly/neutral NPCs can still spawn
|
||||
}
|
||||
```
|
||||
|
||||
### Marker Suppression
|
||||
|
||||
When `SuppressSpawnMarkers` is true:
|
||||
- Spawn markers within radius stop functioning
|
||||
- They resume when suppression is removed
|
||||
- Does not permanently delete markers
|
||||
|
||||
## Commands
|
||||
|
||||
Access via `/spawning suppression`:
|
||||
|
||||
| Subcommand | Description |
|
||||
|------------|-------------|
|
||||
| `list` | List active suppressions |
|
||||
| `info <id>` | Show suppression details |
|
||||
| `clear <id>` | Remove suppression |
|
||||
249
content/world/entities/spawning/spawn-suppression.fr.md
Normal file
249
content/world/entities/spawning/spawn-suppression.fr.md
Normal file
@@ -0,0 +1,249 @@
|
||||
---
|
||||
title: Suppression de Spawn
|
||||
type: docs
|
||||
weight: 2
|
||||
---
|
||||
|
||||
La suppression de spawn permet d'empecher le spawn de NPCs dans des zones definies, utile pour les zones sures, bases de joueurs et environnements controles.
|
||||
|
||||
**Package:** `com.hypixel.hytale.server.spawning.suppression`
|
||||
|
||||
## Architecture
|
||||
|
||||
```
|
||||
Suppression de Spawn
|
||||
├── Assets
|
||||
│ └── SpawnSuppression - Definitions zones de suppression
|
||||
├── Composants
|
||||
│ ├── SpawnSuppressionComponent - Suppression attachee entite
|
||||
│ ├── SpawnSuppressionController - Logique de suppression
|
||||
│ ├── ChunkSuppressionEntry - Donnees suppression chunk
|
||||
│ └── ChunkSuppressionQueue - Suppressions en attente
|
||||
├── Systemes
|
||||
│ ├── SpawnSuppressionSystems - Logique suppression principale
|
||||
│ ├── ChunkSuppressionSystems - Traitement niveau chunk
|
||||
│ └── SpawnMarkerSuppressionSystem - Suppression marqueurs
|
||||
└── Utilitaires
|
||||
├── SuppressionSpanHelper - Calculs d'etendue
|
||||
└── SpawnSuppressorEntry - Suivi suppresseurs
|
||||
```
|
||||
|
||||
## Asset SpawnSuppression
|
||||
|
||||
### Configuration Asset
|
||||
|
||||
```yaml
|
||||
# NPC/Spawn/Suppression/safe_zone.json
|
||||
{
|
||||
"Id": "safe_zone",
|
||||
"SuppressionRadius": 50.0,
|
||||
"SuppressedGroups": ["hostile", "neutral_aggressive"],
|
||||
"SuppressSpawnMarkers": true
|
||||
}
|
||||
```
|
||||
|
||||
### Champs Asset
|
||||
|
||||
| Champ | Type | Description |
|
||||
|-------|------|-------------|
|
||||
| `Id` | String | Identifiant unique de suppression |
|
||||
| `SuppressionRadius` | Double | Rayon d'effet de suppression |
|
||||
| `SuppressedGroups` | String[] | IDs NPCGroup a supprimer |
|
||||
| `SuppressSpawnMarkers` | Boolean | Supprimer aussi les marqueurs |
|
||||
|
||||
### Acces Asset
|
||||
|
||||
```java
|
||||
// Obtenir asset de suppression
|
||||
SpawnSuppression suppression = SpawnSuppression.getAssetMap().getAsset("safe_zone");
|
||||
|
||||
// Obtenir proprietes
|
||||
double radius = suppression.getRadius();
|
||||
int[] suppressedGroups = suppression.getSuppressedGroupIds();
|
||||
boolean suppressMarkers = suppression.isSuppressSpawnMarkers();
|
||||
```
|
||||
|
||||
## SpawnSuppressionComponent
|
||||
|
||||
Attache le comportement de suppression aux entites:
|
||||
|
||||
```java
|
||||
public class SpawnSuppressionComponent implements Component<EntityStore> {
|
||||
private String spawnSuppression; // Reference ID asset
|
||||
|
||||
public String getSpawnSuppression();
|
||||
public void setSpawnSuppression(String spawnSuppression);
|
||||
}
|
||||
```
|
||||
|
||||
### Utilisation du Composant
|
||||
|
||||
```java
|
||||
// Obtenir type de composant
|
||||
ComponentType<EntityStore, SpawnSuppressionComponent> type =
|
||||
SpawningPlugin.get().getSpawnSuppressorComponentType();
|
||||
|
||||
// Attacher a une entite
|
||||
SpawnSuppressionComponent comp = new SpawnSuppressionComponent("safe_zone");
|
||||
store.setComponent(entityRef, type, comp);
|
||||
|
||||
// Lire depuis entite
|
||||
SpawnSuppressionComponent existing = store.getComponent(entityRef, type);
|
||||
String suppressionId = existing.getSpawnSuppression();
|
||||
```
|
||||
|
||||
### Codec du Composant
|
||||
|
||||
```java
|
||||
public static final BuilderCodec<SpawnSuppressionComponent> CODEC = BuilderCodec.builder(...)
|
||||
.append(new KeyedCodec<>("SpawnSuppression", Codec.STRING), ...)
|
||||
.build();
|
||||
```
|
||||
|
||||
## Controleur de Suppression
|
||||
|
||||
### SpawnSuppressionController
|
||||
|
||||
Gere les zones de suppression actives:
|
||||
|
||||
```java
|
||||
// Le controleur suit les suppressions actives
|
||||
// Calcule les chunks affectes
|
||||
// Met a jour l'etat de suppression
|
||||
```
|
||||
|
||||
## Suppression de Chunk
|
||||
|
||||
### ChunkSuppressionEntry
|
||||
|
||||
Suit l'etat de suppression par chunk:
|
||||
|
||||
```java
|
||||
// Enregistre quelles suppressions affectent chaque chunk
|
||||
// Mis en cache pour verifications spawn efficaces
|
||||
```
|
||||
|
||||
### ChunkSuppressionQueue
|
||||
|
||||
File d'attente de mises a jour de suppression:
|
||||
|
||||
```java
|
||||
// Gere les calculs de suppression async
|
||||
// Traite ajouts et suppressions
|
||||
```
|
||||
|
||||
### ChunkSuppressionSystems
|
||||
|
||||
Traite la suppression niveau chunk:
|
||||
|
||||
```java
|
||||
getEntityStoreRegistry().registerSystem(new ChunkSuppressionSystems());
|
||||
```
|
||||
|
||||
## Systemes de Suppression
|
||||
|
||||
### SpawnSuppressionSystems
|
||||
|
||||
Logique de suppression principale:
|
||||
|
||||
```java
|
||||
// Traite les entites SpawnSuppressionComponent
|
||||
// Met a jour les donnees de chunk affectes
|
||||
// Declenche les changements d'etat de suppression
|
||||
```
|
||||
|
||||
### SpawnMarkerSuppressionSystem
|
||||
|
||||
Gere la suppression des marqueurs de spawn:
|
||||
|
||||
```java
|
||||
// Desactive les marqueurs dans le rayon de suppression
|
||||
// Reactive quand suppression supprimee
|
||||
```
|
||||
|
||||
## Utilitaires de Suppression
|
||||
|
||||
### SuppressionSpanHelper
|
||||
|
||||
Calcule les etendues de suppression:
|
||||
|
||||
```java
|
||||
SuppressionSpanHelper helper = new SuppressionSpanHelper();
|
||||
// Calcule quels chunks tombent dans le rayon
|
||||
// Gere les cas limites aux frontieres de chunk
|
||||
```
|
||||
|
||||
### SpawnSuppressorEntry
|
||||
|
||||
Suit les entites suppresseurs individuelles:
|
||||
|
||||
```java
|
||||
// Lie reference entite a config suppression
|
||||
// Permet lookup et nettoyage efficaces
|
||||
```
|
||||
|
||||
## Utilisation de l'API
|
||||
|
||||
### Creer une Zone de Suppression
|
||||
|
||||
```java
|
||||
// 1. Definir asset en JSON
|
||||
// NPC/Spawn/Suppression/player_base.json
|
||||
|
||||
// 2. Attacher composant a entite
|
||||
SpawnSuppressionComponent comp = new SpawnSuppressionComponent("player_base");
|
||||
store.setComponent(entityRef, SpawnSuppressionComponent.getComponentType(), comp);
|
||||
```
|
||||
|
||||
### Verifier si Position Supprimee
|
||||
|
||||
```java
|
||||
// La suppression est verifiee automatiquement lors des tentatives de spawn
|
||||
// Le systeme de spawn interroge l'etat de suppression par chunk
|
||||
```
|
||||
|
||||
### Supprimer une Suppression
|
||||
|
||||
```java
|
||||
// Retirer composant pour desactiver suppression
|
||||
store.removeComponent(entityRef, SpawnSuppressionComponent.getComponentType());
|
||||
```
|
||||
|
||||
## Comportement de Suppression
|
||||
|
||||
### Calcul de Rayon
|
||||
|
||||
La suppression utilise une distance 3D avec optimisation:
|
||||
- X/Z: Affecte des chunks entiers dans le rayon
|
||||
- Y: Utilise calcul de distance exact
|
||||
|
||||
Cela permet aux NPCs de spawn dans les grottes en dessous ou le ciel au-dessus d'une zone de suppression.
|
||||
|
||||
### Filtrage par Groupe
|
||||
|
||||
Seuls les groupes NPC specifies sont supprimes:
|
||||
|
||||
```yaml
|
||||
{
|
||||
"SuppressedGroups": ["hostile"]
|
||||
// NPCs hostiles bloques
|
||||
// NPCs amicaux/neutres peuvent toujours spawn
|
||||
}
|
||||
```
|
||||
|
||||
### Suppression de Marqueurs
|
||||
|
||||
Quand `SuppressSpawnMarkers` est vrai:
|
||||
- Les marqueurs dans le rayon cessent de fonctionner
|
||||
- Ils reprennent quand suppression retiree
|
||||
- Ne supprime pas definitivement les marqueurs
|
||||
|
||||
## Commandes
|
||||
|
||||
Acces via `/spawning suppression`:
|
||||
|
||||
| Sous-commande | Description |
|
||||
|---------------|-------------|
|
||||
| `list` | Lister les suppressions actives |
|
||||
| `info <id>` | Afficher details suppression |
|
||||
| `clear <id>` | Retirer suppression |
|
||||
304
content/world/entities/spawning/spawner-assets.en.md
Normal file
304
content/world/entities/spawning/spawner-assets.en.md
Normal file
@@ -0,0 +1,304 @@
|
||||
---
|
||||
title: Spawner Assets
|
||||
type: docs
|
||||
weight: 4
|
||||
---
|
||||
|
||||
Spawner assets define how and where NPCs spawn, including markers for static spawn points and beacons for dynamic spawning.
|
||||
|
||||
**Package:** `com.hypixel.hytale.server.spawning.assets`
|
||||
|
||||
## Spawn Markers
|
||||
|
||||
### SpawnMarker Asset
|
||||
|
||||
Markers are static spawn points that spawn NPCs with configurable respawn timing.
|
||||
|
||||
**Asset Location:** `NPC/Spawn/Markers/`
|
||||
|
||||
```yaml
|
||||
# NPC/Spawn/Markers/village_guard.json
|
||||
{
|
||||
"Id": "village_guard",
|
||||
"Model": "spawn_marker_hostile",
|
||||
"ExclusionRadius": 15.0,
|
||||
"MaxDropHeight": 2.0,
|
||||
"RealtimeRespawn": true,
|
||||
"ManualTrigger": false,
|
||||
"DeactivationDistance": 40.0,
|
||||
"DeactivationTime": 5.0,
|
||||
"NPCs": [
|
||||
{
|
||||
"Name": "guard_soldier",
|
||||
"Weight": 70.0,
|
||||
"RealtimeRespawnTime": 120.0
|
||||
},
|
||||
{
|
||||
"Name": "guard_captain",
|
||||
"Weight": 30.0,
|
||||
"RealtimeRespawnTime": 300.0
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
### SpawnMarker Fields
|
||||
|
||||
| Field | Type | Default | Description |
|
||||
|-------|------|---------|-------------|
|
||||
| `Id` | String | Required | Unique marker identifier |
|
||||
| `Model` | String | Config default | Visual model in creative mode |
|
||||
| `NPCs` | SpawnConfiguration[] | Required | Weighted NPC list |
|
||||
| `ExclusionRadius` | Double | 0 | Player exclusion radius |
|
||||
| `MaxDropHeight` | Double | 2.0 | Max spawn height offset |
|
||||
| `RealtimeRespawn` | Boolean | false | Use real vs game time |
|
||||
| `ManualTrigger` | Boolean | false | Require manual activation |
|
||||
| `DeactivationDistance` | Double | 40.0 | Distance to deactivate |
|
||||
| `DeactivationTime` | Double | 5.0 | Seconds before deactivation |
|
||||
|
||||
### SpawnConfiguration
|
||||
|
||||
Individual NPC spawn entry in weighted pool:
|
||||
|
||||
```java
|
||||
public class SpawnConfiguration implements IWeightedElement {
|
||||
protected String npc; // NPC role name
|
||||
protected double weight; // Spawn weight
|
||||
protected double realtimeRespawnTime; // Seconds (realtime)
|
||||
protected Duration spawnAfterGameTime; // Duration (game time)
|
||||
protected String flockDefinitionId; // Optional flock
|
||||
}
|
||||
```
|
||||
|
||||
```yaml
|
||||
{
|
||||
"Name": "forest_deer",
|
||||
"Weight": 50.0,
|
||||
"RealtimeRespawnTime": 60.0,
|
||||
"SpawnAfterGameTime": "PT1H",
|
||||
"Flock": "deer_herd"
|
||||
}
|
||||
```
|
||||
|
||||
### Respawn Timing
|
||||
|
||||
Choose between realtime or game time respawning:
|
||||
|
||||
**Realtime:** Uses `RealtimeRespawnTime` (seconds)
|
||||
```yaml
|
||||
{
|
||||
"RealtimeRespawn": true,
|
||||
"NPCs": [{ "RealtimeRespawnTime": 120.0 }]
|
||||
}
|
||||
```
|
||||
|
||||
**Game Time:** Uses `SpawnAfterGameTime` (ISO 8601 duration)
|
||||
```yaml
|
||||
{
|
||||
"RealtimeRespawn": false,
|
||||
"NPCs": [{ "SpawnAfterGameTime": "P1DT6H" }]
|
||||
}
|
||||
```
|
||||
|
||||
Duration format: `P[days]DT[hours]H[minutes]M[seconds]S`
|
||||
|
||||
### Flock Spawning
|
||||
|
||||
Spawn a group of NPCs around the main spawn:
|
||||
|
||||
```yaml
|
||||
{
|
||||
"Name": "wolf_alpha",
|
||||
"Flock": "wolf_pack"
|
||||
}
|
||||
```
|
||||
|
||||
The flock definition specifies additional NPCs to spawn around the main one.
|
||||
|
||||
## Spawn Beacons
|
||||
|
||||
### BeaconNPCSpawn
|
||||
|
||||
Dynamic spawn points that spawn NPCs within a radius.
|
||||
|
||||
**Asset Location:** `NPC/Spawn/Beacons/`
|
||||
|
||||
```yaml
|
||||
# NPC/Spawn/Beacons/dungeon_spawner.json
|
||||
{
|
||||
"Id": "dungeon_spawner",
|
||||
"NPCRole": "skeleton_warrior",
|
||||
"SpawnWeight": 10,
|
||||
"MinGroupSize": 2,
|
||||
"MaxGroupSize": 5,
|
||||
"Environments": ["dungeon_dark"]
|
||||
}
|
||||
```
|
||||
|
||||
### SpawnBeacon Component
|
||||
|
||||
Entities with spawn beacon behavior:
|
||||
|
||||
```java
|
||||
public class SpawnBeacon {
|
||||
// Configuration for beacon spawning
|
||||
// Triggers spawning within radius
|
||||
}
|
||||
```
|
||||
|
||||
### Beacon Systems
|
||||
|
||||
```java
|
||||
// SpawnBeaconSystems processes active beacons
|
||||
getEntityStoreRegistry().registerSystem(new SpawnBeaconSystems());
|
||||
|
||||
// BeaconSpatialSystem handles spatial queries
|
||||
getEntityStoreRegistry().registerSystem(new BeaconSpatialSystem());
|
||||
```
|
||||
|
||||
## World Spawn Configuration
|
||||
|
||||
### WorldNPCSpawn
|
||||
|
||||
Environment-based ambient spawning.
|
||||
|
||||
**Asset Location:** `NPC/Spawn/World/`
|
||||
|
||||
```yaml
|
||||
# NPC/Spawn/World/forest_fauna.json
|
||||
{
|
||||
"Id": "forest_fauna",
|
||||
"NPCRole": "rabbit",
|
||||
"SpawnWeight": 20,
|
||||
"MinGroupSize": 1,
|
||||
"MaxGroupSize": 3,
|
||||
"Environments": ["forest", "grassland"],
|
||||
"LightType": "Day",
|
||||
"MinLightLevel": 8
|
||||
}
|
||||
```
|
||||
|
||||
### NPCSpawn Base Fields
|
||||
|
||||
| Field | Type | Description |
|
||||
|-------|------|-------------|
|
||||
| `NPCRole` | String | NPC role to spawn |
|
||||
| `SpawnWeight` | Integer | Spawn probability weight |
|
||||
| `MinGroupSize` | Integer | Minimum NPCs to spawn |
|
||||
| `MaxGroupSize` | Integer | Maximum NPCs to spawn |
|
||||
|
||||
### Environment Filtering
|
||||
|
||||
Restrict spawning to specific environments:
|
||||
|
||||
```yaml
|
||||
{
|
||||
"Environments": ["cave_dark", "dungeon"]
|
||||
}
|
||||
```
|
||||
|
||||
### Light Level Filtering
|
||||
|
||||
```yaml
|
||||
{
|
||||
"LightType": "Night",
|
||||
"MinLightLevel": 0,
|
||||
"MaxLightLevel": 7
|
||||
}
|
||||
```
|
||||
|
||||
Light types: `Any`, `Day`, `Night`
|
||||
|
||||
## Spawn Marker Entity
|
||||
|
||||
### SpawnMarkerEntity Component
|
||||
|
||||
Entity representing a spawn marker in the world:
|
||||
|
||||
```java
|
||||
ComponentType<EntityStore, SpawnMarkerEntity> type =
|
||||
SpawningPlugin.get().getSpawnMarkerEntityComponentType();
|
||||
```
|
||||
|
||||
### Marker Block State
|
||||
|
||||
Spawn markers can be placed as blocks:
|
||||
|
||||
```java
|
||||
public class SpawnMarkerBlockState {
|
||||
// Block-based spawn marker
|
||||
}
|
||||
|
||||
public class SpawnMarkerBlockReference {
|
||||
// Reference to marker block
|
||||
}
|
||||
```
|
||||
|
||||
## Interactions
|
||||
|
||||
### TriggerSpawnMarkersInteraction
|
||||
|
||||
Manually trigger spawn markers via interaction:
|
||||
|
||||
```yaml
|
||||
# Item or block interaction
|
||||
{
|
||||
"Type": "TriggerSpawnMarkers",
|
||||
"MarkerIds": ["ambush_1", "ambush_2"],
|
||||
"Radius": 50.0
|
||||
}
|
||||
```
|
||||
|
||||
Registered as:
|
||||
```java
|
||||
getCodecRegistry(Interaction.CODEC).register(
|
||||
"TriggerSpawnMarkers",
|
||||
TriggerSpawnMarkersInteraction.class,
|
||||
TriggerSpawnMarkersInteraction.CODEC
|
||||
);
|
||||
```
|
||||
|
||||
## API Usage
|
||||
|
||||
### Access Spawn Marker Assets
|
||||
|
||||
```java
|
||||
// Get marker asset
|
||||
SpawnMarker marker = SpawnMarker.getAssetMap().getAsset("village_guard");
|
||||
|
||||
// Get weighted configurations
|
||||
IWeightedMap<SpawnConfiguration> npcs = marker.getWeightedConfigurations();
|
||||
|
||||
// Get random NPC from pool
|
||||
SpawnConfiguration selected = npcs.getRandom(random);
|
||||
String npcRole = selected.getNpc();
|
||||
```
|
||||
|
||||
### Access Spawn Suppression
|
||||
|
||||
```java
|
||||
SpawnSuppression suppression = SpawnSuppression.getAssetMap().getAsset("safe_zone");
|
||||
double radius = suppression.getRadius();
|
||||
```
|
||||
|
||||
### Validate Marker Asset
|
||||
|
||||
```java
|
||||
// Validation happens on plugin start
|
||||
// Warns about:
|
||||
// - Missing respawn times
|
||||
// - Conflicting realtime/game time settings
|
||||
// - Invalid NPC roles
|
||||
```
|
||||
|
||||
## Asset Loading Order
|
||||
|
||||
Spawn assets have dependencies:
|
||||
|
||||
```java
|
||||
// Markers load after models and NPC roles
|
||||
HytaleAssetStore.builder(...)
|
||||
.loadsAfter(ModelAsset.class)
|
||||
.loadsAfter(NPCRole.class)
|
||||
.build();
|
||||
```
|
||||
304
content/world/entities/spawning/spawner-assets.fr.md
Normal file
304
content/world/entities/spawning/spawner-assets.fr.md
Normal file
@@ -0,0 +1,304 @@
|
||||
---
|
||||
title: Assets Spawner
|
||||
type: docs
|
||||
weight: 4
|
||||
---
|
||||
|
||||
Les assets spawner definissent comment et ou les NPCs apparaissent, incluant les marqueurs pour points de spawn statiques et les beacons pour spawning dynamique.
|
||||
|
||||
**Package:** `com.hypixel.hytale.server.spawning.assets`
|
||||
|
||||
## Marqueurs de Spawn
|
||||
|
||||
### Asset SpawnMarker
|
||||
|
||||
Les marqueurs sont des points de spawn statiques qui font apparaitre des NPCs avec timing de reapparition configurable.
|
||||
|
||||
**Emplacement Asset:** `NPC/Spawn/Markers/`
|
||||
|
||||
```yaml
|
||||
# NPC/Spawn/Markers/village_guard.json
|
||||
{
|
||||
"Id": "village_guard",
|
||||
"Model": "spawn_marker_hostile",
|
||||
"ExclusionRadius": 15.0,
|
||||
"MaxDropHeight": 2.0,
|
||||
"RealtimeRespawn": true,
|
||||
"ManualTrigger": false,
|
||||
"DeactivationDistance": 40.0,
|
||||
"DeactivationTime": 5.0,
|
||||
"NPCs": [
|
||||
{
|
||||
"Name": "guard_soldier",
|
||||
"Weight": 70.0,
|
||||
"RealtimeRespawnTime": 120.0
|
||||
},
|
||||
{
|
||||
"Name": "guard_captain",
|
||||
"Weight": 30.0,
|
||||
"RealtimeRespawnTime": 300.0
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
### Champs SpawnMarker
|
||||
|
||||
| Champ | Type | Defaut | Description |
|
||||
|-------|------|--------|-------------|
|
||||
| `Id` | String | Requis | Identifiant unique marqueur |
|
||||
| `Model` | String | Defaut config | Modele visuel en mode creatif |
|
||||
| `NPCs` | SpawnConfiguration[] | Requis | Liste NPC ponderee |
|
||||
| `ExclusionRadius` | Double | 0 | Rayon exclusion joueur |
|
||||
| `MaxDropHeight` | Double | 2.0 | Offset hauteur spawn max |
|
||||
| `RealtimeRespawn` | Boolean | false | Temps reel vs temps jeu |
|
||||
| `ManualTrigger` | Boolean | false | Necessiter activation manuelle |
|
||||
| `DeactivationDistance` | Double | 40.0 | Distance de desactivation |
|
||||
| `DeactivationTime` | Double | 5.0 | Secondes avant desactivation |
|
||||
|
||||
### SpawnConfiguration
|
||||
|
||||
Entree spawn NPC individuelle dans pool pondere:
|
||||
|
||||
```java
|
||||
public class SpawnConfiguration implements IWeightedElement {
|
||||
protected String npc; // Nom role NPC
|
||||
protected double weight; // Poids de spawn
|
||||
protected double realtimeRespawnTime; // Secondes (temps reel)
|
||||
protected Duration spawnAfterGameTime; // Duree (temps jeu)
|
||||
protected String flockDefinitionId; // Flock optionnel
|
||||
}
|
||||
```
|
||||
|
||||
```yaml
|
||||
{
|
||||
"Name": "forest_deer",
|
||||
"Weight": 50.0,
|
||||
"RealtimeRespawnTime": 60.0,
|
||||
"SpawnAfterGameTime": "PT1H",
|
||||
"Flock": "deer_herd"
|
||||
}
|
||||
```
|
||||
|
||||
### Timing de Reapparition
|
||||
|
||||
Choisir entre reapparition temps reel ou temps de jeu:
|
||||
|
||||
**Temps Reel:** Utilise `RealtimeRespawnTime` (secondes)
|
||||
```yaml
|
||||
{
|
||||
"RealtimeRespawn": true,
|
||||
"NPCs": [{ "RealtimeRespawnTime": 120.0 }]
|
||||
}
|
||||
```
|
||||
|
||||
**Temps de Jeu:** Utilise `SpawnAfterGameTime` (duree ISO 8601)
|
||||
```yaml
|
||||
{
|
||||
"RealtimeRespawn": false,
|
||||
"NPCs": [{ "SpawnAfterGameTime": "P1DT6H" }]
|
||||
}
|
||||
```
|
||||
|
||||
Format duree: `P[jours]DT[heures]H[minutes]M[secondes]S`
|
||||
|
||||
### Spawning de Flock
|
||||
|
||||
Faire apparaitre un groupe de NPCs autour du spawn principal:
|
||||
|
||||
```yaml
|
||||
{
|
||||
"Name": "wolf_alpha",
|
||||
"Flock": "wolf_pack"
|
||||
}
|
||||
```
|
||||
|
||||
La definition flock specifie les NPCs additionnels a spawn autour du principal.
|
||||
|
||||
## Beacons de Spawn
|
||||
|
||||
### BeaconNPCSpawn
|
||||
|
||||
Points de spawn dynamiques qui font apparaitre des NPCs dans un rayon.
|
||||
|
||||
**Emplacement Asset:** `NPC/Spawn/Beacons/`
|
||||
|
||||
```yaml
|
||||
# NPC/Spawn/Beacons/dungeon_spawner.json
|
||||
{
|
||||
"Id": "dungeon_spawner",
|
||||
"NPCRole": "skeleton_warrior",
|
||||
"SpawnWeight": 10,
|
||||
"MinGroupSize": 2,
|
||||
"MaxGroupSize": 5,
|
||||
"Environments": ["dungeon_dark"]
|
||||
}
|
||||
```
|
||||
|
||||
### Composant SpawnBeacon
|
||||
|
||||
Entites avec comportement beacon de spawn:
|
||||
|
||||
```java
|
||||
public class SpawnBeacon {
|
||||
// Configuration pour spawning beacon
|
||||
// Declenche spawning dans un rayon
|
||||
}
|
||||
```
|
||||
|
||||
### Systemes Beacon
|
||||
|
||||
```java
|
||||
// SpawnBeaconSystems traite les beacons actifs
|
||||
getEntityStoreRegistry().registerSystem(new SpawnBeaconSystems());
|
||||
|
||||
// BeaconSpatialSystem gere les requetes spatiales
|
||||
getEntityStoreRegistry().registerSystem(new BeaconSpatialSystem());
|
||||
```
|
||||
|
||||
## Configuration Spawn Mondial
|
||||
|
||||
### WorldNPCSpawn
|
||||
|
||||
Spawning ambiant base sur l'environnement.
|
||||
|
||||
**Emplacement Asset:** `NPC/Spawn/World/`
|
||||
|
||||
```yaml
|
||||
# NPC/Spawn/World/forest_fauna.json
|
||||
{
|
||||
"Id": "forest_fauna",
|
||||
"NPCRole": "rabbit",
|
||||
"SpawnWeight": 20,
|
||||
"MinGroupSize": 1,
|
||||
"MaxGroupSize": 3,
|
||||
"Environments": ["forest", "grassland"],
|
||||
"LightType": "Day",
|
||||
"MinLightLevel": 8
|
||||
}
|
||||
```
|
||||
|
||||
### Champs de Base NPCSpawn
|
||||
|
||||
| Champ | Type | Description |
|
||||
|-------|------|-------------|
|
||||
| `NPCRole` | String | Role NPC a spawner |
|
||||
| `SpawnWeight` | Integer | Poids probabilite spawn |
|
||||
| `MinGroupSize` | Integer | Minimum NPCs a spawner |
|
||||
| `MaxGroupSize` | Integer | Maximum NPCs a spawner |
|
||||
|
||||
### Filtrage par Environnement
|
||||
|
||||
Restreindre spawning a des environnements specifiques:
|
||||
|
||||
```yaml
|
||||
{
|
||||
"Environments": ["cave_dark", "dungeon"]
|
||||
}
|
||||
```
|
||||
|
||||
### Filtrage par Niveau de Lumiere
|
||||
|
||||
```yaml
|
||||
{
|
||||
"LightType": "Night",
|
||||
"MinLightLevel": 0,
|
||||
"MaxLightLevel": 7
|
||||
}
|
||||
```
|
||||
|
||||
Types de lumiere: `Any`, `Day`, `Night`
|
||||
|
||||
## Entite Marqueur de Spawn
|
||||
|
||||
### Composant SpawnMarkerEntity
|
||||
|
||||
Entite representant un marqueur de spawn dans le monde:
|
||||
|
||||
```java
|
||||
ComponentType<EntityStore, SpawnMarkerEntity> type =
|
||||
SpawningPlugin.get().getSpawnMarkerEntityComponentType();
|
||||
```
|
||||
|
||||
### Etat Bloc Marqueur
|
||||
|
||||
Les marqueurs de spawn peuvent etre places comme blocs:
|
||||
|
||||
```java
|
||||
public class SpawnMarkerBlockState {
|
||||
// Marqueur de spawn base bloc
|
||||
}
|
||||
|
||||
public class SpawnMarkerBlockReference {
|
||||
// Reference au bloc marqueur
|
||||
}
|
||||
```
|
||||
|
||||
## Interactions
|
||||
|
||||
### TriggerSpawnMarkersInteraction
|
||||
|
||||
Declencher manuellement des marqueurs de spawn via interaction:
|
||||
|
||||
```yaml
|
||||
# Interaction item ou bloc
|
||||
{
|
||||
"Type": "TriggerSpawnMarkers",
|
||||
"MarkerIds": ["ambush_1", "ambush_2"],
|
||||
"Radius": 50.0
|
||||
}
|
||||
```
|
||||
|
||||
Enregistre comme:
|
||||
```java
|
||||
getCodecRegistry(Interaction.CODEC).register(
|
||||
"TriggerSpawnMarkers",
|
||||
TriggerSpawnMarkersInteraction.class,
|
||||
TriggerSpawnMarkersInteraction.CODEC
|
||||
);
|
||||
```
|
||||
|
||||
## Utilisation de l'API
|
||||
|
||||
### Acceder aux Assets Marqueur de Spawn
|
||||
|
||||
```java
|
||||
// Obtenir asset marqueur
|
||||
SpawnMarker marker = SpawnMarker.getAssetMap().getAsset("village_guard");
|
||||
|
||||
// Obtenir configurations ponderees
|
||||
IWeightedMap<SpawnConfiguration> npcs = marker.getWeightedConfigurations();
|
||||
|
||||
// Obtenir NPC aleatoire depuis pool
|
||||
SpawnConfiguration selected = npcs.getRandom(random);
|
||||
String npcRole = selected.getNpc();
|
||||
```
|
||||
|
||||
### Acceder a la Suppression de Spawn
|
||||
|
||||
```java
|
||||
SpawnSuppression suppression = SpawnSuppression.getAssetMap().getAsset("safe_zone");
|
||||
double radius = suppression.getRadius();
|
||||
```
|
||||
|
||||
### Valider Asset Marqueur
|
||||
|
||||
```java
|
||||
// La validation se fait au demarrage du plugin
|
||||
// Avertit sur:
|
||||
// - Temps de reapparition manquants
|
||||
// - Parametres temps reel/jeu conflictuels
|
||||
// - Roles NPC invalides
|
||||
```
|
||||
|
||||
## Ordre de Chargement Assets
|
||||
|
||||
Les assets spawn ont des dependances:
|
||||
|
||||
```java
|
||||
// Les marqueurs chargent apres modeles et roles NPC
|
||||
HytaleAssetStore.builder(...)
|
||||
.loadsAfter(ModelAsset.class)
|
||||
.loadsAfter(NPCRole.class)
|
||||
.build();
|
||||
```
|
||||
260
content/world/entities/spawning/world-spawning.en.md
Normal file
260
content/world/entities/spawning/world-spawning.en.md
Normal file
@@ -0,0 +1,260 @@
|
||||
---
|
||||
title: World Spawning
|
||||
type: docs
|
||||
weight: 1
|
||||
---
|
||||
|
||||
World spawning manages ambient NPC spawning based on environment, biome, and chunk conditions.
|
||||
|
||||
**Package:** `com.hypixel.hytale.server.spawning.world`
|
||||
|
||||
## Architecture
|
||||
|
||||
```
|
||||
World Spawning
|
||||
├── Manager
|
||||
│ └── WorldSpawnManager - Central spawn coordination
|
||||
├── Components
|
||||
│ ├── WorldSpawnData - World-level spawn state
|
||||
│ ├── ChunkSpawnData - Per-chunk spawn tracking
|
||||
│ ├── ChunkSpawnedNPCData - Spawned NPC records
|
||||
│ └── SpawnJobData - Active spawn jobs
|
||||
├── Systems
|
||||
│ ├── WorldSpawningSystem - Main spawning logic
|
||||
│ ├── WorldSpawnTrackingSystem - Track spawned entities
|
||||
│ ├── WorldSpawnJobSystems - Job processing
|
||||
│ ├── ChunkSpawningSystems - Chunk-level spawning
|
||||
│ └── MoonPhaseChangeEventSystem - Lunar spawn modifiers
|
||||
└── Config
|
||||
├── WorldNPCSpawn - Spawn definitions
|
||||
├── NPCSpawn - Base spawn config
|
||||
└── RoleSpawnParameters - Role-specific params
|
||||
```
|
||||
|
||||
## WorldSpawnManager
|
||||
|
||||
Central manager for world-level NPC spawning:
|
||||
|
||||
```java
|
||||
WorldSpawnManager manager = SpawningPlugin.get().getWorldSpawnManager();
|
||||
```
|
||||
|
||||
The manager coordinates spawning across chunks based on:
|
||||
- Environment type
|
||||
- Biome conditions
|
||||
- Light levels
|
||||
- Moon phase
|
||||
- Player proximity
|
||||
|
||||
## World Spawn Configuration
|
||||
|
||||
### WorldNPCSpawn Asset
|
||||
|
||||
```yaml
|
||||
# NPC/Spawn/World/forest_creatures.json
|
||||
{
|
||||
"Id": "forest_creatures",
|
||||
"NPCRole": "deer",
|
||||
"SpawnWeight": 10,
|
||||
"MinGroupSize": 1,
|
||||
"MaxGroupSize": 3,
|
||||
"Environments": ["forest", "plains"],
|
||||
"LightType": "Day",
|
||||
"MinLightLevel": 8,
|
||||
"MaxLightLevel": 15
|
||||
}
|
||||
```
|
||||
|
||||
### NPCSpawn Base Configuration
|
||||
|
||||
```java
|
||||
public class NPCSpawn {
|
||||
protected String npcRole; // NPC role to spawn
|
||||
protected int spawnWeight; // Spawn probability weight
|
||||
protected int minGroupSize; // Minimum group size
|
||||
protected int maxGroupSize; // Maximum group size
|
||||
}
|
||||
```
|
||||
|
||||
### RoleSpawnParameters
|
||||
|
||||
Per-role spawn parameters:
|
||||
|
||||
```java
|
||||
public class RoleSpawnParameters {
|
||||
// Role-specific spawn configuration
|
||||
// Defines constraints and behaviors per NPC type
|
||||
}
|
||||
```
|
||||
|
||||
## Environment-Based Spawning
|
||||
|
||||
### EnvironmentSpawnParameters
|
||||
|
||||
```java
|
||||
EnvironmentSpawnParameters params = new EnvironmentSpawnParameters();
|
||||
// Parameters specific to environment type
|
||||
```
|
||||
|
||||
### Light Type Filtering
|
||||
|
||||
```java
|
||||
public enum LightType {
|
||||
Any, // Spawn at any light level
|
||||
Day, // Only spawn during day
|
||||
Night // Only spawn at night
|
||||
}
|
||||
```
|
||||
|
||||
Used with `LightRangePredicate` to filter spawn positions:
|
||||
|
||||
```java
|
||||
LightRangePredicate predicate = new LightRangePredicate(minLight, maxLight, lightType);
|
||||
boolean canSpawn = predicate.test(world, position);
|
||||
```
|
||||
|
||||
## Chunk-Level Management
|
||||
|
||||
### ChunkSpawnData
|
||||
|
||||
Tracks spawn state per chunk:
|
||||
|
||||
```java
|
||||
ComponentType<ChunkStore, ChunkSpawnData> type =
|
||||
SpawningPlugin.get().getChunkSpawnDataComponentType();
|
||||
ChunkSpawnData data = chunkStore.getComponent(chunkRef, type);
|
||||
```
|
||||
|
||||
### ChunkSpawnedNPCData
|
||||
|
||||
Records which NPCs were spawned in a chunk:
|
||||
|
||||
```java
|
||||
// Tracks spawned entities for cleanup and respawning
|
||||
```
|
||||
|
||||
### ChunkEnvironmentSpawnData
|
||||
|
||||
Environment-specific spawn data per chunk:
|
||||
|
||||
```java
|
||||
// Caches environment conditions for spawn decisions
|
||||
```
|
||||
|
||||
## Spawn Job System
|
||||
|
||||
### SpawnJob
|
||||
|
||||
Base class for spawn operations:
|
||||
|
||||
```java
|
||||
public class SpawnJob {
|
||||
// Asynchronous spawn operation
|
||||
}
|
||||
```
|
||||
|
||||
### SpawnJobData Component
|
||||
|
||||
Tracks active spawn jobs:
|
||||
|
||||
```java
|
||||
SpawnJobData jobData = store.getComponent(worldRef, SpawnJobData.getComponentType());
|
||||
```
|
||||
|
||||
### WorldSpawnJobSystems
|
||||
|
||||
Processes spawn jobs:
|
||||
|
||||
```java
|
||||
// System that executes pending spawn jobs
|
||||
// Handles spawn position validation
|
||||
// Creates NPCs when conditions are met
|
||||
```
|
||||
|
||||
## World Spawn Systems
|
||||
|
||||
### WorldSpawningSystem
|
||||
|
||||
Main system for world spawning logic:
|
||||
|
||||
```java
|
||||
getEntityStoreRegistry().registerSystem(new WorldSpawningSystem());
|
||||
```
|
||||
|
||||
This system:
|
||||
1. Checks spawn conditions per chunk
|
||||
2. Selects appropriate NPC types
|
||||
3. Validates spawn positions
|
||||
4. Creates spawn jobs
|
||||
|
||||
### WorldSpawnTrackingSystem
|
||||
|
||||
Tracks spawned entities for management:
|
||||
|
||||
```java
|
||||
// Monitors spawned NPCs
|
||||
// Handles despawn when conditions change
|
||||
// Updates spawn counts
|
||||
```
|
||||
|
||||
### MoonPhaseChangeEventSystem
|
||||
|
||||
Adjusts spawning based on moon phase:
|
||||
|
||||
```java
|
||||
// Modifies spawn rates during different moon phases
|
||||
// Enables special night spawns during full moon
|
||||
```
|
||||
|
||||
## Position Selection
|
||||
|
||||
### FloodFillPositionSelector
|
||||
|
||||
Finds valid spawn positions using flood fill:
|
||||
|
||||
```java
|
||||
FloodFillPositionSelector selector = new FloodFillPositionSelector();
|
||||
// Searches for suitable spawn locations
|
||||
```
|
||||
|
||||
### RandomChunkColumnIterator
|
||||
|
||||
Iterates through random positions in a chunk column:
|
||||
|
||||
```java
|
||||
RandomChunkColumnIterator iterator = new RandomChunkColumnIterator();
|
||||
// Provides random positions for spawn attempts
|
||||
```
|
||||
|
||||
### ChunkColumnMask
|
||||
|
||||
Masks specific areas within a chunk:
|
||||
|
||||
```java
|
||||
ChunkColumnMask mask = new ChunkColumnMask();
|
||||
// Excludes certain positions from spawning
|
||||
```
|
||||
|
||||
## API Usage
|
||||
|
||||
### Check World Spawn State
|
||||
|
||||
```java
|
||||
WorldSpawnData worldData = store.getComponent(worldRef, WorldSpawnData.getComponentType());
|
||||
```
|
||||
|
||||
### Get Spawn Wrapper
|
||||
|
||||
```java
|
||||
WorldSpawnWrapper wrapper = manager.getSpawnWrapper(spawnIndex);
|
||||
WorldNPCSpawn spawn = wrapper.getSpawn();
|
||||
```
|
||||
|
||||
## Spawn Statistics
|
||||
|
||||
Track spawning metrics with `WorldNPCSpawnStat`:
|
||||
|
||||
```java
|
||||
// Records spawn attempts, successes, and failures
|
||||
// Used by /spawning stats command
|
||||
```
|
||||
260
content/world/entities/spawning/world-spawning.fr.md
Normal file
260
content/world/entities/spawning/world-spawning.fr.md
Normal file
@@ -0,0 +1,260 @@
|
||||
---
|
||||
title: Spawning Mondial
|
||||
type: docs
|
||||
weight: 1
|
||||
---
|
||||
|
||||
Le spawning mondial gere le spawn ambiant de NPCs base sur l'environnement, le biome et les conditions de chunk.
|
||||
|
||||
**Package:** `com.hypixel.hytale.server.spawning.world`
|
||||
|
||||
## Architecture
|
||||
|
||||
```
|
||||
Spawning Mondial
|
||||
├── Manager
|
||||
│ └── WorldSpawnManager - Coordination centrale du spawn
|
||||
├── Composants
|
||||
│ ├── WorldSpawnData - Etat spawn niveau monde
|
||||
│ ├── ChunkSpawnData - Suivi spawn par chunk
|
||||
│ ├── ChunkSpawnedNPCData - Enregistrements NPCs spawnes
|
||||
│ └── SpawnJobData - Jobs de spawn actifs
|
||||
├── Systemes
|
||||
│ ├── WorldSpawningSystem - Logique principale de spawn
|
||||
│ ├── WorldSpawnTrackingSystem - Suivi entites spawnees
|
||||
│ ├── WorldSpawnJobSystems - Traitement des jobs
|
||||
│ ├── ChunkSpawningSystems - Spawning niveau chunk
|
||||
│ └── MoonPhaseChangeEventSystem - Modificateurs lunaires
|
||||
└── Config
|
||||
├── WorldNPCSpawn - Definitions de spawn
|
||||
├── NPCSpawn - Config spawn de base
|
||||
└── RoleSpawnParameters - Params specifiques role
|
||||
```
|
||||
|
||||
## WorldSpawnManager
|
||||
|
||||
Manager central pour le spawning NPC niveau monde:
|
||||
|
||||
```java
|
||||
WorldSpawnManager manager = SpawningPlugin.get().getWorldSpawnManager();
|
||||
```
|
||||
|
||||
Le manager coordonne le spawning a travers les chunks base sur:
|
||||
- Type d'environnement
|
||||
- Conditions de biome
|
||||
- Niveaux de lumiere
|
||||
- Phase lunaire
|
||||
- Proximite des joueurs
|
||||
|
||||
## Configuration Spawn Mondial
|
||||
|
||||
### Asset WorldNPCSpawn
|
||||
|
||||
```yaml
|
||||
# NPC/Spawn/World/forest_creatures.json
|
||||
{
|
||||
"Id": "forest_creatures",
|
||||
"NPCRole": "deer",
|
||||
"SpawnWeight": 10,
|
||||
"MinGroupSize": 1,
|
||||
"MaxGroupSize": 3,
|
||||
"Environments": ["forest", "plains"],
|
||||
"LightType": "Day",
|
||||
"MinLightLevel": 8,
|
||||
"MaxLightLevel": 15
|
||||
}
|
||||
```
|
||||
|
||||
### Configuration de Base NPCSpawn
|
||||
|
||||
```java
|
||||
public class NPCSpawn {
|
||||
protected String npcRole; // Role NPC a spawner
|
||||
protected int spawnWeight; // Poids de probabilite
|
||||
protected int minGroupSize; // Taille groupe minimum
|
||||
protected int maxGroupSize; // Taille groupe maximum
|
||||
}
|
||||
```
|
||||
|
||||
### RoleSpawnParameters
|
||||
|
||||
Parametres de spawn par role:
|
||||
|
||||
```java
|
||||
public class RoleSpawnParameters {
|
||||
// Configuration spawn specifique au role
|
||||
// Definit contraintes et comportements par type NPC
|
||||
}
|
||||
```
|
||||
|
||||
## Spawning Base sur l'Environnement
|
||||
|
||||
### EnvironmentSpawnParameters
|
||||
|
||||
```java
|
||||
EnvironmentSpawnParameters params = new EnvironmentSpawnParameters();
|
||||
// Parametres specifiques au type d'environnement
|
||||
```
|
||||
|
||||
### Filtrage par Type de Lumiere
|
||||
|
||||
```java
|
||||
public enum LightType {
|
||||
Any, // Spawn a tout niveau de lumiere
|
||||
Day, // Spawn uniquement le jour
|
||||
Night // Spawn uniquement la nuit
|
||||
}
|
||||
```
|
||||
|
||||
Utilise avec `LightRangePredicate` pour filtrer les positions de spawn:
|
||||
|
||||
```java
|
||||
LightRangePredicate predicate = new LightRangePredicate(minLight, maxLight, lightType);
|
||||
boolean canSpawn = predicate.test(world, position);
|
||||
```
|
||||
|
||||
## Gestion Niveau Chunk
|
||||
|
||||
### ChunkSpawnData
|
||||
|
||||
Suit l'etat de spawn par chunk:
|
||||
|
||||
```java
|
||||
ComponentType<ChunkStore, ChunkSpawnData> type =
|
||||
SpawningPlugin.get().getChunkSpawnDataComponentType();
|
||||
ChunkSpawnData data = chunkStore.getComponent(chunkRef, type);
|
||||
```
|
||||
|
||||
### ChunkSpawnedNPCData
|
||||
|
||||
Enregistre quels NPCs ont ete spawnes dans un chunk:
|
||||
|
||||
```java
|
||||
// Suit les entites spawnees pour nettoyage et respawn
|
||||
```
|
||||
|
||||
### ChunkEnvironmentSpawnData
|
||||
|
||||
Donnees de spawn specifiques a l'environnement par chunk:
|
||||
|
||||
```java
|
||||
// Met en cache les conditions d'environnement pour decisions de spawn
|
||||
```
|
||||
|
||||
## Systeme de Jobs de Spawn
|
||||
|
||||
### SpawnJob
|
||||
|
||||
Classe de base pour operations de spawn:
|
||||
|
||||
```java
|
||||
public class SpawnJob {
|
||||
// Operation de spawn asynchrone
|
||||
}
|
||||
```
|
||||
|
||||
### Composant SpawnJobData
|
||||
|
||||
Suit les jobs de spawn actifs:
|
||||
|
||||
```java
|
||||
SpawnJobData jobData = store.getComponent(worldRef, SpawnJobData.getComponentType());
|
||||
```
|
||||
|
||||
### WorldSpawnJobSystems
|
||||
|
||||
Traite les jobs de spawn:
|
||||
|
||||
```java
|
||||
// Systeme qui execute les jobs de spawn en attente
|
||||
// Gere la validation des positions de spawn
|
||||
// Cree les NPCs quand conditions remplies
|
||||
```
|
||||
|
||||
## Systemes de Spawn Mondial
|
||||
|
||||
### WorldSpawningSystem
|
||||
|
||||
Systeme principal pour la logique de spawn mondial:
|
||||
|
||||
```java
|
||||
getEntityStoreRegistry().registerSystem(new WorldSpawningSystem());
|
||||
```
|
||||
|
||||
Ce systeme:
|
||||
1. Verifie les conditions de spawn par chunk
|
||||
2. Selectionne les types NPC appropries
|
||||
3. Valide les positions de spawn
|
||||
4. Cree les jobs de spawn
|
||||
|
||||
### WorldSpawnTrackingSystem
|
||||
|
||||
Suit les entites spawnees pour gestion:
|
||||
|
||||
```java
|
||||
// Surveille les NPCs spawnes
|
||||
// Gere le despawn quand conditions changent
|
||||
// Met a jour les compteurs de spawn
|
||||
```
|
||||
|
||||
### MoonPhaseChangeEventSystem
|
||||
|
||||
Ajuste le spawning selon la phase lunaire:
|
||||
|
||||
```java
|
||||
// Modifie les taux de spawn pendant differentes phases
|
||||
// Active spawns nocturnes speciaux pendant pleine lune
|
||||
```
|
||||
|
||||
## Selection de Position
|
||||
|
||||
### FloodFillPositionSelector
|
||||
|
||||
Trouve les positions de spawn valides via flood fill:
|
||||
|
||||
```java
|
||||
FloodFillPositionSelector selector = new FloodFillPositionSelector();
|
||||
// Recherche des emplacements de spawn adequats
|
||||
```
|
||||
|
||||
### RandomChunkColumnIterator
|
||||
|
||||
Itere a travers des positions aleatoires dans une colonne de chunk:
|
||||
|
||||
```java
|
||||
RandomChunkColumnIterator iterator = new RandomChunkColumnIterator();
|
||||
// Fournit positions aleatoires pour tentatives de spawn
|
||||
```
|
||||
|
||||
### ChunkColumnMask
|
||||
|
||||
Masque des zones specifiques dans un chunk:
|
||||
|
||||
```java
|
||||
ChunkColumnMask mask = new ChunkColumnMask();
|
||||
// Exclut certaines positions du spawning
|
||||
```
|
||||
|
||||
## Utilisation de l'API
|
||||
|
||||
### Verifier l'Etat de Spawn Mondial
|
||||
|
||||
```java
|
||||
WorldSpawnData worldData = store.getComponent(worldRef, WorldSpawnData.getComponentType());
|
||||
```
|
||||
|
||||
### Obtenir un Wrapper de Spawn
|
||||
|
||||
```java
|
||||
WorldSpawnWrapper wrapper = manager.getSpawnWrapper(spawnIndex);
|
||||
WorldNPCSpawn spawn = wrapper.getSpawn();
|
||||
```
|
||||
|
||||
## Statistiques de Spawn
|
||||
|
||||
Suivre les metriques de spawn avec `WorldNPCSpawnStat`:
|
||||
|
||||
```java
|
||||
// Enregistre tentatives, succes et echecs de spawn
|
||||
// Utilise par la commande /spawning stats
|
||||
```
|
||||
Reference in New Issue
Block a user