IWorld
The IWorld object contains information on a Dimension within the game.
Importing the class
It might be required to import the class to avoid errors.
import crafttweaker.world.IWorld
Extending IBlockProperties
IWorld extends IBlockAccess. That means that all methods that are available to IBlockAccess objects are also available to IWorld.
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.
ZenMethods without parameters and ZenGetters
ZenMethod | ZenGetter | Return type | Description |
---|---|---|---|
ZenMethod isRemote() | ZenGetter remote | Return type boolean | Description 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 boolean | Description Returns true if it is currently raining. |
ZenMethod getMoonPhase() | ZenGetter moonPhase | Return type int | Description Returns the current moon phase. |
ZenMethod isDayTime() | ZenGetter dayTime | Return type boolean | Description Checks if it is daytime. |
ZenMethod getWorldTime() | ZenGetter time | Return type long | Description Returns the world’s time. |
ZenMethod getDimension() | ZenGetter dimension | Return type int | Description Returns the world’s dimension. |
ZenMethod isSurfaceWorld() | ZenGetter surfaceWorld | Return type boolean | Description Returns whether you are in a surface world or not. |
ZenMethod getDimensionType() | ZenGetter dimensionType | Return type String | Description Returns the dimension’s type name. |
ZenMethod getWorldType() | ZenGetter worldType | Return type String | Description Returns the world’s type name. |
ZenMethod getWorldInfo() | ZenGetter worldInfo | Return type IWorldInfo | Description Returns the world’s information. Can be used to retrieve even more info on the world. |
ZenMethod getProvider() | ZenGetter provider | Return type IWorldProvider | Description Returns the world’s provider. Can be used to retrieve even more info on the world. |
ZenMethod getSeaLevel() | ZenGetter seaLevel | Return type int | Description Returns the world’s sea level. |
ZenMethod getRandom() | ZenGetter random | Return type IRandom | Description Returns the world’s random generator |
ZenMethods with parameters
Get Biome at specific Position
Use either an IPosition3f or an IBlockPos object.
Returns an IBiome Object.
Get Brightness at specific Position
Use either three ints or an IBlockPos object. Returns an int.
Get Block at specific Position
Use either three ints or an IBlockPos object. Returns an IBlock Object.
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.
Spawn Entity
Use an IEntity object.
Returns a bool that states if the spawn was successful.
Create Lightningbolt
Returns the Lightningbolt as an IEntity object.
Add a Weather Effect
Use an IEntity object.
Returns a bool that states if the spawn was successful.
Remove Entity
Use an IEntity object.
Returns a bool that states if the remove was successful.
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.
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.
Check if a position is a spawn chunk
Returns a bool that states if the position is a spawn chunk.
Extinguish Fire
Returns a bool.
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.
Perform an explosion in the world
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.
Only perform an existing explosion
Use an IExplosion. Returns the performed IExplosion.
Performs the IExplosion in the world.