MCServerWorld
Link to mcserverworld
Represents the logical (server) implementation of the world. These are not limited to dedicated servers, they exist in single player worlds as part of the integrated server.
导入类
Link to 导入类
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.MCServerWorld;
Extending MCWorld
Link to extending-mcworld
MCServerWorld extends MCWorld. That means all methods available in MCWorld are also available in MCServerWorld
使用方式
Link to 使用方式
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<MCEntity>
ZenScript Copy// MCServerWorld.getEntities(predicate as Predicate<MCEntity>, type as MCEntityType) as stdlib.List<MCEntity>
(world as MCServerWorld).getEntities((entity as MCEntity) => entity.isImmuneToFire(), <entitytype:minecraft:sheep>);
参数 | 类型 | 描述 | 可选 | DefaultValue |
---|---|---|---|---|
参数 predicate | 类型 Predicate<MCEntity> | 描述 The predicate to check against. | 可选 false | DefaultValue |
参数 类型 | 类型 MCEntityType #MC实体类型 | 描述 No Description Provided | 可选 true | DefaultValue |
Name: isRaid
Checks if a position is within an active raid.
Returns: Whether or not the position was inside an active raid.
Return Type: boolean
ZenScript Copy// MCServerWorld.isRaid(pos as BlockPos) as boolean
(world as MCServerWorld).isRaid(new BlockPos(0, 1, 2));
参数 | 类型 | 描述 |
---|---|---|
参数 点 | 类型 BlockPos | 描述 The position to look up. |
Name: isSlimeChunk
Checks if a position is within a chunk that is considered a slime chunk.
Returns: Whether or not the position was inside a slime chunk.
Return Type: boolean
ZenScript Copy// MCServerWorld.isSlimeChunk(pos as BlockPos) as boolean
(world as MCServerWorld).isSlimeChunk(new BlockPos(0, 1, 2));
参数 | 类型 | 描述 |
---|---|---|
参数 点 | 类型 BlockPos | 描述 The position to look up. |
Name: isVillage
Checks if a position is within a village.
Returns: Whether or not the position was inside a village.
Return Type: boolean
ZenScript Copy// MCServerWorld.isVillage(pos as BlockPos) as boolean
(world as MCServerWorld).isVillage(new BlockPos(0, 1, 2));
参数 | 类型 | 描述 |
---|---|---|
参数 点 | 类型 BlockPos | 描述 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.
Return Type: void
ZenScript Copy// MCServerWorld.setTimeToDay() as void
(world as MCServerWorld).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.
Return Type: void
ZenScript Copy// MCServerWorld.setTimeToMidnight() as void
(world as MCServerWorld).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.
Return Type: void
ZenScript Copy// MCServerWorld.setTimeToNight() as void
(world as MCServerWorld).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.
Return Type: void
ZenScript Copy// MCServerWorld.setTimeToNoon() as void
(world as MCServerWorld).setTimeToNoon();
名称 | 类型 | 可获得 | 可设置 | 描述 |
---|---|---|---|---|
名称 seed | 类型 long | 可获得 true | 可设置 false | 描述 Gets the random seed of the world. |
名称 server | 类型 MCServer | 可获得 true | 可设置 false | 描述 No Description Provided |
名称 timeOfDay | 类型 MCServerWorld | 可获得 false | 可设置 true | 描述 Sets the time of the Minecraft day. |