ServerLevel
Link to serverlevel
Importare la Classe
Link to importare-la-classe
It might be required for you to import the package if you encounter any issues (like casting an Array), so better be safe than sorry and add the import at the very top of the file.
ZenScript Copyimport crafttweaker.api.world.ServerLevel;
Extending Level
Link to extending-level
ServerLevel extends Level. That means all methods available in Level are also available in ServerLevel
Metodi
Link to metodi
Name: getCustomData
Gets the custom data that is saved/loaded to/from disk when the level is saved/loaded to/from disk.
This lets you store data on this specific level, so data stored in the Overworld will not be accessible from the Nether.
Returns: The custom data for this world.
Return Type: CraftTweakerSavedData
ZenScript Copy// ServerLevel.getCustomData() as CraftTweakerSavedData
myServerLevel.getCustomData();
Name: getEntities
Gets entities in the world that match the given Predicate and the given MCEntityType (if provided).
Returns: A List of Entities that match.
Return Type: stdlib.List<Entity>
ZenScript Copy// ServerLevel.getEntities(predicate as Predicate<Entity>, type as EntityType) as stdlib.List<Entity>
myServerLevel.getEntities((entity as MCEntity) => entity.isImmuneToFire(), <entitytype:minecraft:sheep>);
Parametro | Tipo | Descrizione | Optional |
---|---|---|---|
Parametro predicate | Tipo Predicate<Entity> | Descrizione The predicate to check against. | Optional no |
Parametro type | Tipo EntityType | Descrizione | Optional sì |
Name: isRaided
Checks if a position is within an active raid.
Returns: Whether the position was inside an active raid.
Return Type: boolean
ZenScript Copy// ServerLevel.isRaided(pos as BlockPos) as boolean
myServerLevel.isRaided(new BlockPos(0, 1, 2));
Parametro | Tipo | Descrizione |
---|---|---|
Parametro pos | Tipo BlockPos | Descrizione The position to look up. |
Name: isSlimeChunk
Checks if a position is within a chunk that is considered a slime chunk.
Returns: Whether the position was inside a slime chunk.
Return Type: boolean
ZenScript Copy// ServerLevel.isSlimeChunk(pos as BlockPos) as boolean
myServerLevel.isSlimeChunk(new BlockPos(0, 1, 2));
Parametro | Tipo | Descrizione |
---|---|---|
Parametro pos | Tipo BlockPos | Descrizione The position to look up. |
Name: isVillage
Checks if a position is within a village.
Returns: Whether the position was inside a village.
Return Type: boolean
ZenScript Copy// ServerLevel.isVillage(pos as BlockPos) as boolean
myServerLevel.isVillage(new BlockPos(0, 1, 2));
Parametro | Tipo | Descrizione |
---|---|---|
Parametro pos | Tipo BlockPos | Descrizione The position to look up. |
Name: setTimeToDay
Sets the time of the Minecraft day to day. This is like using the "time set day" command or setting the time to 1000.
ZenScript Copy// ServerLevel.setTimeToDay()
myServerLevel.setTimeToDay();
Name: setTimeToMidnight
Sets the time of the Minecraft day to midnight. This is like using the "time set midnight" command or setting the time to 18000.
ZenScript Copy// ServerLevel.setTimeToMidnight()
myServerLevel.setTimeToMidnight();
Name: setTimeToNight
Sets the time of the Minecraft day to night. This is like using the "time set night" command or setting the time to 13000.
ZenScript Copy// ServerLevel.setTimeToNight()
myServerLevel.setTimeToNight();
Name: setTimeToNoon
Sets the time of the Minecraft day to noon. This is like using the "time set noon" command or setting the time to 6000.
ZenScript Copy// ServerLevel.setTimeToNoon()
myServerLevel.setTimeToNoon();
Proprietà
Link to proprietà
Nome | Tipo | Ha Getter | Ha Setter | Descrizione |
---|---|---|---|---|
Nome customData | Tipo CraftTweakerSavedData | Ha Getter sì | Ha Setter no | Descrizione Gets the custom data that is saved/loaded to/from disk when the level is saved/loaded to/from disk. This lets you store data on this specific level, so data stored in the Overworld will not be accessible from the Nether. |
Nome dayTime | Tipo ServerLevel | Ha Getter no | Ha Setter sì | Descrizione Sets the time of the Minecraft day. |
Nome seed | Tipo long | Ha Getter sì | Ha Setter no | Descrizione Gets the random seed of the world. |
Nome server | Tipo Server | Ha Getter sì | Ha Setter no | Descrizione |