Class ExpandLevel
java.lang.Object
com.blamejared.crafttweaker.natives.world.ExpandLevel
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic 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.block.entity.BlockEntitygetBlockEntity(net.minecraft.world.level.Level internal, net.minecraft.core.BlockPos pos) static longgetDayTime(net.minecraft.world.level.Level internal) 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 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 booleanisDay(net.minecraft.world.level.Level internal) 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 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, IData> 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,IData> sequence(net.minecraft.world.level.Level internal, IData 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
-
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) -
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.
-
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 invalid input: '<'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)
-
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 invalid input: '<'blockstate:minecraft:iron_block>
-
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)
-
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
-
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) -
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
-