Class ExpandLevel
java.lang.Object
com.blamejared.crafttweaker.natives.world.ExpandLevel
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic booleanaddFreshEntity(net.minecraft.world.level.Level internal, net.minecraft.world.entity.Entity entity) add an entity to the world, return if the entity is added successfully.static booleandestroyBlock(net.minecraft.world.level.Level internal, net.minecraft.core.BlockPos pos, boolean doDrops) Destroys a block within the world.static booleandestroyBlock(net.minecraft.world.level.Level internal, net.minecraft.core.BlockPos pos, boolean doDrops, net.minecraft.world.entity.Entity breaker) Destroys a block within the world.static intgetBestNeighborSignal(net.minecraft.world.level.Level internal, net.minecraft.core.BlockPos pos) Gets the highest redstone signal available to a position from any of it's neighbors.static net.minecraft.world.level.biome.BiomegetBiome(net.minecraft.world.level.Level internal, net.minecraft.core.BlockPos pos) Gets the biome at a given position.static net.minecraft.world.level.block.entity.BlockEntitygetBlockEntity(net.minecraft.world.level.Level internal, net.minecraft.core.BlockPos pos) static MapDatagetBlockEntityData(net.minecraft.world.level.Level internal, net.minecraft.core.BlockPos pos) Gets the tile entity data for a tile entity at a given position.static net.minecraft.world.level.block.state.BlockStategetBlockState(net.minecraft.world.level.Level internal, net.minecraft.core.BlockPos pos) Gets the block state at a given position.static longgetDayTime(net.minecraft.world.level.Level internal) static StringgetDifficulty(net.minecraft.world.level.Level internal) Gets the difficulty setting for the world.static net.minecraft.resources.ResourceLocationgetDimension(net.minecraft.world.level.Level internal) Gets the registry name of the dimension this world represents.static intgetDirectSignalTo(net.minecraft.world.level.Level internal, net.minecraft.core.BlockPos pos) Gets the highest strong (direct) redstone signal of any neighboring block.static List<net.minecraft.world.entity.Entity>getEntities(net.minecraft.world.level.Level internal, net.minecraft.world.entity.Entity excludingEntity, double x1, double y1, double z1, double x2, double y2, double z2, Predicate<net.minecraft.world.entity.Entity> predicate) Gets all entities in given area, excluding the one passed into it.static <T extends net.minecraft.world.entity.Entity>
List<T>getEntitiesInArea(net.minecraft.world.level.Level internal, Class<T> typeOfT, net.minecraft.core.BlockPos pos1, net.minecraft.core.BlockPos pos2) Gets all entities in given area, but the arguments are block poses.static List<net.minecraft.world.entity.Entity>getEntitiesInAreaExcluding(net.minecraft.world.level.Level internal, net.minecraft.world.entity.Entity excludingEntity, Predicate<net.minecraft.world.entity.Entity> predicate, net.minecraft.core.BlockPos pos1, net.minecraft.core.BlockPos pos2) static <T extends net.minecraft.world.entity.Entity>
List<T>getEntitiesOfClass(net.minecraft.world.level.Level internal, Class<T> typeOfT, double x1, double y1, double z1, double x2, double y2, double z2) Gets all entities in given area.static longgetGametime(net.minecraft.world.level.Level internal) static RandomgetRandom(net.minecraft.world.level.Level internal) static intgetSeaLevel(net.minecraft.world.level.Level internal) Gets the height of the sea level.static intgetSignal(net.minecraft.world.level.Level internal, net.minecraft.core.BlockPos pos, net.minecraft.core.Direction direction) Gets the redstone signal strength available to a position from a given direction.static voidglobalLevelEvent(net.minecraft.world.level.Level internal, int eventId, net.minecraft.core.BlockPos pos, int data) Triggers a predetermined event on the client.static booleanhasNeighborSignal(net.minecraft.world.level.Level internal, net.minecraft.core.BlockPos pos) Checks if a given position is receiving a redstone signal.static booleanisClientSide(net.minecraft.world.level.Level internal) static booleanisDay(net.minecraft.world.level.Level internal) static booleanisDifficultyLocked(net.minecraft.world.level.Level internal) Checks if the difficulty of the world has been locked.static booleanisEmptyBlock(net.minecraft.world.level.Level internal, net.minecraft.core.BlockPos pos) Checks if the block at a given position is empty.static booleanisHardcore(net.minecraft.world.level.Level internal) Checks if hardcore mode is enabled.static booleanisLoaded(net.minecraft.world.level.Level internal, net.minecraft.core.BlockPos pos) Checks if the block at a given position is in a loaded chunk.static booleanisNight(net.minecraft.world.level.Level internal) static booleanisRaining(net.minecraft.world.level.Level internal) Checks if it is raining.static booleanisRainingAt(net.minecraft.world.level.Level internal, net.minecraft.core.BlockPos pos) Checks if it is raining at a specific position.static booleanisThundering(net.minecraft.world.level.Level internal) Checks if there is a thunder storm.static voidlevelEvent(net.minecraft.world.level.Level internal, net.minecraft.world.entity.player.Player excluded, int eventId, net.minecraft.core.BlockPos pos, int data) Triggers a predetermined event on the client.static net.minecraft.world.phys.BlockHitResultrayTraceBlocks(net.minecraft.world.level.Level internal, net.minecraft.world.phys.Vec3 startVec, net.minecraft.world.phys.Vec3 endVec, net.minecraft.world.level.ClipContext.Block blockMode, net.minecraft.world.level.ClipContext.Fluid fluidMode, net.minecraft.world.entity.Entity entity) Creates a ray trace from one vector to the other vector, which will stop at a block or a fluid.static SequenceBuilder<net.minecraft.world.level.Level,MapData> Creates a newSequenceBuilderfor this level.static <T> SequenceBuilder<net.minecraft.world.level.Level,T> Creates a newSequenceBuilderfor this level.static booleansetBlockAndUpdate(net.minecraft.world.level.Level internal, net.minecraft.core.BlockPos pos, net.minecraft.world.level.block.state.BlockState state) Sets the block and its state at a given position.static voidsetRainingLevel(net.minecraft.world.level.Level internal, float level) Sets the current rain level.
-
Constructor Details
-
ExpandLevel
public ExpandLevel()
-
-
Method Details
-
sequence
public static SequenceBuilder<net.minecraft.world.level.Level,MapData> sequence(net.minecraft.world.level.Level internal, MapData data) Creates a newSequenceBuilderfor this level.SequenceBuilder's let you compose scripted events such as waiting 5 ticks, then setting the weather to rain.- Returns:
- A new
SequenceBuilderfor this level. - DocParam:
- data {version: "1.0.0"}
-
sequence
public static <T> SequenceBuilder<net.minecraft.world.level.Level,T> sequence(net.minecraft.world.level.Level internal, Class<T> dataClass, T data) Creates a newSequenceBuilderfor this level.SequenceBuilder's let you compose scripted events such as waiting 5 ticks, then setting the weather to rain.- Returns:
- A new
SequenceBuilderfor this level. - DocParam:
- data {version: "1.0.0"},
crafttweaker.api.data.MapData
-
isClientSide
public static boolean isClientSide(net.minecraft.world.level.Level internal) -
isDay
public static boolean isDay(net.minecraft.world.level.Level internal) -
isNight
public static boolean isNight(net.minecraft.world.level.Level internal) -
getGametime
public static long getGametime(net.minecraft.world.level.Level internal) -
getDayTime
public static long getDayTime(net.minecraft.world.level.Level internal) -
getSeaLevel
public static int getSeaLevel(net.minecraft.world.level.Level internal) Gets the height of the sea level.- Returns:
- The height of the sea level.
-
isRaining
public static boolean isRaining(net.minecraft.world.level.Level internal) Checks if it is raining.- Returns:
- Whether it is raining.
-
setRainingLevel
public static void setRainingLevel(net.minecraft.world.level.Level internal, float level) Sets the current rain level.- Parameters:
level- The new rain level between 0 and 1- DocParam:
- level 0.5
-
isThundering
public static boolean isThundering(net.minecraft.world.level.Level internal) Checks if there is a thunder storm.- Returns:
- Whether there is a thunder storm.
-
isHardcore
public static boolean isHardcore(net.minecraft.world.level.Level internal) Checks if hardcore mode is enabled.- Returns:
- Whether hardcore mode is enabled.
-
getDifficulty
Gets the difficulty setting for the world.- Returns:
- The difficulty setting for the world.
-
isDifficultyLocked
public static boolean isDifficultyLocked(net.minecraft.world.level.Level internal) Checks if the difficulty of the world has been locked.- Returns:
- Whether the world difficulty has been locked.
-
getDimension
public static net.minecraft.resources.ResourceLocation getDimension(net.minecraft.world.level.Level internal) Gets the registry name of the dimension this world represents.- Returns:
- The registry name of the dimension the world represents.
-
isRainingAt
public static boolean isRainingAt(net.minecraft.world.level.Level internal, net.minecraft.core.BlockPos pos) Checks if it is raining at a specific position. This can never be true if the position does not have direct line of sight to the sky.- Parameters:
pos- The position to check.- Returns:
- Whether it is raining at the current position.
- DocParam:
- pos new BlockPos(0, 1, 2)
-
getDirectSignalTo
public static int getDirectSignalTo(net.minecraft.world.level.Level internal, net.minecraft.core.BlockPos pos) Gets the highest strong (direct) redstone signal of any neighboring block.- Parameters:
pos- The position to check.- Returns:
- The highest strong (direct) redstone signal of all directly neighboring blocks.
- DocParam:
- pos new BlockPos(0, 1, 2)
-
getSignal
public static int getSignal(net.minecraft.world.level.Level internal, net.minecraft.core.BlockPos pos, net.minecraft.core.Direction direction) Gets the redstone signal strength available to a position from a given direction.- Parameters:
pos- The position to check.direction- The direction to query.- Returns:
- The redstone signal strength available from that direction.
- DocParam:
- pos new BlockPos(0, 1, 2), direction <direction:north>
-
getBestNeighborSignal
public static int getBestNeighborSignal(net.minecraft.world.level.Level internal, net.minecraft.core.BlockPos pos) Gets the highest redstone signal available to a position from any of it's neighbors.- Parameters:
pos- The position to check.- Returns:
- The highest redstone signal available to the position.
- DocParam:
- pos new BlockPos(0, 1, 2)
-
getBlockEntityData
public static MapData getBlockEntityData(net.minecraft.world.level.Level internal, net.minecraft.core.BlockPos pos) Gets the tile entity data for a tile entity at a given position.- Parameters:
pos- The position of the tile entity.- Returns:
- The data of the tile entity.
- DocParam:
- pos new BlockPos(0, 1, 2)
-
setBlockAndUpdate
public static boolean setBlockAndUpdate(net.minecraft.world.level.Level internal, net.minecraft.core.BlockPos pos, net.minecraft.world.level.block.state.BlockState state) Sets the block and its state at a given position.- Parameters:
pos- The position to set the block at.state- The new state of the block.- Returns:
- Whether the block was changed.
- DocParam:
- pos new BlockPos(0, 1, 2), state <blockstate:minecraft:iron_block>
-
getBlockState
public static net.minecraft.world.level.block.state.BlockState getBlockState(net.minecraft.world.level.Level internal, net.minecraft.core.BlockPos pos) Gets the block state at a given position.- Parameters:
pos- The position to look up.- Returns:
- The block state at the position.
- DocParam:
- pos new BlockPos(0, 1, 2)
-
hasNeighborSignal
public static boolean hasNeighborSignal(net.minecraft.world.level.Level internal, net.minecraft.core.BlockPos pos) Checks if a given position is receiving a redstone signal.- Parameters:
pos- The position to check.- Returns:
- Whether the position is receiving a redstone signal.
- DocParam:
- pos new BlockPos(0, 1, 2)
-
getBiome
public static net.minecraft.world.level.biome.Biome getBiome(net.minecraft.world.level.Level internal, net.minecraft.core.BlockPos pos) Gets the biome at a given position.- Parameters:
pos- The position to look up.- Returns:
- The biome at the given position.
- DocParam:
- pos new BlockPos(0, 1, 2)
-
destroyBlock
public static boolean destroyBlock(net.minecraft.world.level.Level internal, net.minecraft.core.BlockPos pos, boolean doDrops) Destroys a block within the world.- Parameters:
pos- The position of the block.doDrops- Whether the block drops itself and it's loot.- Returns:
- Whether the block was changed.
- DocParam:
- pos new BlockPos(0, 1, 2), doDrops true
-
destroyBlock
public static boolean destroyBlock(net.minecraft.world.level.Level internal, net.minecraft.core.BlockPos pos, boolean doDrops, net.minecraft.world.entity.Entity breaker) Destroys a block within the world.- Parameters:
pos- The position of the block.doDrops- Whether the block drops itself and it's loot.breaker- The entity to break the block.- Returns:
- Whether the block was changed.
- DocParam:
- pos new BlockPos(0, 1, 2), doDrops true, breaker player
-
globalLevelEvent
public static void globalLevelEvent(net.minecraft.world.level.Level internal, int eventId, net.minecraft.core.BlockPos pos, int data) Triggers a predetermined event on the client. Using this on a server or integrated server will send the event to all nearby players.- Parameters:
eventId- The ID of the event to play.pos- The position of the event.data- Four bytes of additional data encoded as an integer. This is generally unused.- DocParam:
- eventId 2005, pos new BlockPos(0, 1, 2), data 0
-
levelEvent
public static void levelEvent(net.minecraft.world.level.Level internal, net.minecraft.world.entity.player.Player excluded, int eventId, net.minecraft.core.BlockPos pos, int data) Triggers a predetermined event on the client. Using this on a server or integrated server will send the event to all nearby players.- Parameters:
excluded- An excluded player who will not receive the event.eventId- The ID of the event to play.pos- The position of the event.data- Four bytes of additional data encoded as an integer. This is generally unused.- DocParam:
- excluded player, eventId 2005, pos new BlockPos(0, 1, 2), data 0
-
isEmptyBlock
public static boolean isEmptyBlock(net.minecraft.world.level.Level internal, net.minecraft.core.BlockPos pos) Checks if the block at a given position is empty.- Parameters:
pos- The position to look up.- Returns:
- Whether the block is empty.
- DocParam:
- pos new BlockPos(0, 1, 2)
-
isLoaded
public static boolean isLoaded(net.minecraft.world.level.Level internal, net.minecraft.core.BlockPos pos) Checks if the block at a given position is in a loaded chunk.- Parameters:
pos- The position to look up.- Returns:
- Whether the position is in a loaded chunk.
- DocParam:
- pos new BlockPos(0, 1, 2)
-
getEntitiesOfClass
public static <T extends net.minecraft.world.entity.Entity> List<T> getEntitiesOfClass(net.minecraft.world.level.Level internal, Class<T> typeOfT, double x1, double y1, double z1, double x2, double y2, double z2) Gets all entities in given area.- Returns:
- all entities in given area.
- DocParam:
- x1 1.0, y1 1.0, z1 1.0, x2 11.4, y2 11.4, z2 11.4
-
getEntitiesInArea
public static <T extends net.minecraft.world.entity.Entity> List<T> getEntitiesInArea(net.minecraft.world.level.Level internal, Class<T> typeOfT, net.minecraft.core.BlockPos pos1, net.minecraft.core.BlockPos pos2) Gets all entities in given area, but the arguments are block poses. If `pos2` is omitted, it will use `pos1.add(1, 1, 1)`- Returns:
- all entities in given area
- DocParam:
- pos1 new BlockPos(0, 1, 2), pos2 new BlockPos(3, 4, 5)
-
getEntities
public static List<net.minecraft.world.entity.Entity> getEntities(net.minecraft.world.level.Level internal, net.minecraft.world.entity.Entity excludingEntity, double x1, double y1, double z1, double x2, double y2, double z2, Predicate<net.minecraft.world.entity.Entity> predicate) Gets all entities in given area, excluding the one passed into it.- Parameters:
predicate- the entity filter- DocParam:
- excludingEntity entity, x1 1.0, y1 1.0, z1 1.0, x2 11.4, y2 11.4, z2 11.4, predicate (entityIn) => entityIn.isInWater()
-
getEntitiesInAreaExcluding
public static List<net.minecraft.world.entity.Entity> getEntitiesInAreaExcluding(net.minecraft.world.level.Level internal, net.minecraft.world.entity.Entity excludingEntity, Predicate<net.minecraft.world.entity.Entity> predicate, net.minecraft.core.BlockPos pos1, net.minecraft.core.BlockPos pos2) - DocParam:
- excludingEntity entity, predicate (entityIn) => entityIn.isInWater(), pos1 new BlockPos(0, 1, 2), pos2 new BlockPos(3, 4, 5)
-
getBlockEntity
public static net.minecraft.world.level.block.entity.BlockEntity getBlockEntity(net.minecraft.world.level.Level internal, net.minecraft.core.BlockPos pos) -
addFreshEntity
public static boolean addFreshEntity(net.minecraft.world.level.Level internal, net.minecraft.world.entity.Entity entity) add an entity to the world, return if the entity is added successfully. -
getRandom
-
rayTraceBlocks
public static net.minecraft.world.phys.BlockHitResult rayTraceBlocks(net.minecraft.world.level.Level internal, net.minecraft.world.phys.Vec3 startVec, net.minecraft.world.phys.Vec3 endVec, net.minecraft.world.level.ClipContext.Block blockMode, net.minecraft.world.level.ClipContext.Fluid fluidMode, net.minecraft.world.entity.Entity entity) Creates a ray trace from one vector to the other vector, which will stop at a block or a fluid.- Parameters:
startVec- a vector which describes the starting pointendVec- a vector which describes the direction and length we are searching inblockMode- the type of block that the ray trace would stop at.fluidMode- the type of fluid that the ray trace would stop at.entity- the entity for selection context- Returns:
- a
BlockHitResultholding the result, the position and facing the ray stops. - DocParam:
- startVec new Vec3(0.0, 0.0, 0.0), endVec new Vec3(1.1, 4.5, 1.4), blockMode RayTraceBlockMode.OUTLINE, fluidMode RayTraceFluidMode.NONE, entity entity
-