Class ExpandLevel

java.lang.Object
com.blamejared.crafttweaker.natives.world.ExpandLevel

@ZenRegister public class ExpandLevel extends Object
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    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.
    static net.minecraft.world.level.block.entity.BlockEntity
    getBlockEntity(net.minecraft.world.level.Level internal, net.minecraft.core.BlockPos pos)
     
    static long
    getDayTime(net.minecraft.world.level.Level internal)
     
    static net.minecraft.resources.ResourceLocation
    getDimension(net.minecraft.world.level.Level internal)
    Gets the registry name of the dimension this world represents.
    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.
    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 long
    getGametime(net.minecraft.world.level.Level internal)
     
    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.
    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.
    static boolean
    hasNeighborSignal(net.minecraft.world.level.Level internal, net.minecraft.core.BlockPos pos)
    Checks if a given position is receiving a redstone signal.
    static boolean
    isDay(net.minecraft.world.level.Level internal)
     
    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.
    static boolean
    isNight(net.minecraft.world.level.Level internal)
     
    static boolean
    isRaining(net.minecraft.world.level.Level internal)
    Checks if it is raining.
    static boolean
    isRainingAt(net.minecraft.world.level.Level internal, net.minecraft.core.BlockPos pos)
    Checks if it is raining at a specific position.
    static boolean
    isThundering(net.minecraft.world.level.Level internal)
    Checks if there is a thunder storm.
    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.
    static SequenceBuilder<net.minecraft.world.level.Level,IData>
    sequence(net.minecraft.world.level.Level internal, IData data)
    Creates a new SequenceBuilder for this level.
    static <T> SequenceBuilder<net.minecraft.world.level.Level,T>
    sequence(net.minecraft.world.level.Level internal, Class<T> dataClass, T data)
    Creates a new SequenceBuilder for this level.
    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.
    static void
    setRainingLevel(net.minecraft.world.level.Level internal, float level)
    Sets the current rain level.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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 new SequenceBuilder for this level.

      SequenceBuilder's let you compose scripted events such as waiting 5 ticks, then setting the weather to rain.

      Returns:
      A new SequenceBuilder for 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 new SequenceBuilder for this level.

      SequenceBuilder's let you compose scripted events such as waiting 5 ticks, then setting the weather to rain.

      Returns:
      A new SequenceBuilder for 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 point
      endVec - a vector which describes the direction and length we are searching in
      blockMode - 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 BlockHitResult holding 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