IWorld
Link to iworld
The IWorld object contains information on a Dimension within the game.
导入类
Link to 导入类
It might be required to import the class to avoid errors.
import crafttweaker.world.IWorld
继承自 IBlockProperties
Link to 继承自-iblockproperties
IWorld extends IBlockAccess. That means that all methods that are available to IBlockAccess objects are also available to IWorld.
Creating an IWorld object
Link to creating-an-iworld-object
Normally, you can derive this object from entities or other functions. If you need to create it yourself though, this is the way to go:
Note that this method should only be called inside functions that are meant to be run inside minecraft, not during the loading circle.
ZenScript Copycrafttweaker.world.IWorld.getFromID(int id);
ZenMethods without parameters and ZenGetters
Link to zenmethods-without-parameters-and-zengetters
ZenMethod | ZenGetter | Return type | 描述 |
---|---|---|---|
ZenMethod isRemote() | ZenGetter remote | Return type 布尔值 | 描述 True if the world is a "slave" client; changes will not be saved or propagated from this world. For example, server worlds have this set to false, client worlds have this set to true. |
ZenMethod isRaining() | ZenGetter raining | Return type 布尔值 | 描述 Returns true if it is currently raining. |
ZenMethod getMoonPhase() | ZenGetter moonPhase | Return type int | 描述 Returns the current moon phase. |
ZenMethod isDayTime() | ZenGetter dayTime | Return type 布尔值 | 描述 Checks if it is daytime. |
ZenMethod getWorldTime() | ZenGetter time | Return type long | 描述 Returns the world's time. |
ZenMethod getDimension() | ZenGetter dimension | Return type int | 描述 Returns the world's dimension. |
ZenMethod isSurfaceWorld() | ZenGetter surfaceWorld | Return type 布尔值 | 描述 Returns whether you are in a surface world or not. |
ZenMethod getDimensionType() | ZenGetter dimensionType | Return type 字符串[string] | 描述 Returns the dimension's type name. |
ZenMethod getWorldType() | ZenGetter worldType | Return type 字符串[string] | 描述 Returns the world's type name. |
ZenMethod getWorldInfo() | ZenGetter worldInfo | Return type IWorldInfo | 描述 Returns the world's information. Can be used to retrieve even more info on the world. |
ZenMethod getProvider() | ZenGetter provider | Return type IWorldProvider | 描述 Returns the world's provider. Can be used to retrieve even more info on the world. |
ZenMethod getSeaLevel() | ZenGetter seaLevel | Return type int | 描述 Returns the world's sea level. |
ZenMethod getRandom() | ZenGetter random | Return type IRandom | 描述 Returns the world's random generator |
ZenMethods with parameters
Link to zenmethods-with-parameters
Get Biome at specific Position
Link to get-biome-at-specific-position
Use either an IPosition3f or an IBlockPos object.
Returns an IBiome Object.
ZenScript CopyworldObj.getBiome(IPosition3f position);
worldObj.getBiome(IBlockPos position);
Get Brightness at specific Position
Link to get-brightness-at-specific-position
Use either three ints or an IBlockPos object. Returns an int.
ZenScript CopyworldObj.getBrightness(int x, int y, int z);
worldObj.getBrightness(IBlockPos position);
Get Block at specific Position
Link to get-block-at-specific-position
Use either three ints or an IBlockPos object. Returns an IBlock Object.
ZenScript CopyworldObj.getBlock(int x, int y, int z);
worldObj.getBlock(IBlockPos position);
Get or Set a blockState at a specific Position
Link to get-or-set-a-blockstate-at-a-specific-position
Use an IBlockPos Object and for the setter also an IBlockState Object. Optionally an IData object can be specified to define NBT data for the blockstate's TileEntity when it is set. Getter Returns an IBlockState, setter a bool.
ZenScript CopyworldObj.getBlockState(IBlockPos pos);
worldObj.setBlockState(IBlockState state, IBlockPos pos);
worldObj.setBlockState(IBlockState state, IData tileEntityData, IBlockPos pos);
Spawn Entity
Link to spawn-entity
Use an IEntity object.
Returns a bool that states if the spawn was successful.
ZenScript CopyworldObj.spawnEntity(IEntity entity);
Create Lightningbolt
Link to create-lightningbolt
Returns the Lightningbolt as an IEntity object.
ZenScript CopyworldObj.createLightningBolt(double x, double y, double z, @Optional boolean effectOnly);
Add a Weather Effect
Link to add-a-weather-effect
Use an IEntity object.
Returns a bool that states if the spawn was successful.
ZenScript CopyworldObj.addWeatherEffect(IEntity entity);
Remove Entity
Link to remove-entity
Use an IEntity object.
Returns a bool that states if the spawn was successful.
ZenScript CopyworldObj.removeEntity(IEntity entity);
Get a raytrace result
Link to get-a-raytrace-result
Use two IVector3d objects, and three booleans to get an IRayTraceResult.
Can be null
The first vector describes the starting point, the 2nd vector the direction and length we are searching in.
Only the last parameter is true by default.
ZenScript CopyworldObj.rayTraceBlocks(IVector3d begin, IVector3d ray, @Optional boolean stopOnLiquid, @Optional boolean ignoreBlockWithoutBoundingBox, @Optional(true) boolean returnLastUncollidableBlock)
Get the picked block
Link to get-the-picked-block
Use an IBlockPos, an IRayTraceResult and an IPlayer.
Returns an IItemStack.
Can be null
Gets the IItemStack that would be obtained by picking the block at the position.
ZenScript CopyworldObj.getPickedBlock(IBlockPos pos, IRayTraceResult rayTraceResult, IPlayer player);
Check if a position is a spawn chunk
Link to check-if-a-position-is-a-spawn-chunk
Returns a bool that states if the position is a spawn chunk.
ZenScript CopyworldObj.isSpawnChunk(int x, int z);
Extinguish Fire
Link to extinguish-fire
Returns a bool.
ZenScript CopyworldObj.extinguishFire(IPlayer player, IBlockPos pos, IFacing side);
Create an explosion object
Link to create-an-explosion-object
Use an IEntity, three doubles, a float, and two booleans. Returns an IExplosion.
Creates an IExplosion in the world at the given coordinates. The explosion will have the specified placer (can be null), as well as the size of the explosion and whether it should cause fire and/or cause terrain damage, respectively.
ZenScript CopyworldObj.createExplosion(IEntity exploder, double x, double y, double z, float size, bool causesFire, bool damagesTerrain);
Perform an explosion in the world
Link to perform-an-explosion-in-the-world
Create & perform in the same method
Link to create--perform-in-the-same-method
Use an IEntity, three doubles, a float, and two booleans. Returns the created and performed IExplosion.
Creates and performs an IExplosion in the world at the given coordinates. The explosion will have the specified placer (can be null), as well as the size of the explosion and whether it should cause fire and/or cause terrain damage, respectively.
ZenScript CopyworldObj.performExplosion(IEntity exploder, double x, double y, double z, float size, bool causesFire, bool damagesTerrain);
Only perform an existing explosion
Link to only-perform-an-existing-explosion
Use an IExplosion. Returns the performed IExplosion.
Performs the IExplosion in the world.
ZenScript CopyworldObj.performExplosion(IExplosion explosion);