public class BlockHelper
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static net.minecraft.util.math.shapes.VoxelShape |
EMPTY_SHAPE |
Constructor and Description |
---|
BlockHelper() |
Modifier and Type | Method and Description |
---|---|
static int |
countTileEntitiesOfType(net.minecraft.world.World world,
net.minecraft.util.math.ChunkPos pos,
java.lang.Class<? extends net.minecraft.tileentity.TileEntity> clazz)
Counts all TileEntities within a chunk.
|
static <T extends net.minecraft.tileentity.TileEntity> |
findAllTileEntityWithinRange(java.lang.Class<T> tileEntity,
net.minecraft.entity.Entity entity,
double range,
java.util.function.Predicate<T> predicate)
Finds all TileEntities within range of the provided entity
|
static <T extends net.minecraft.tileentity.TileEntity> |
findAllTileEntityWithinRange(java.lang.Class<T> tileEntity,
net.minecraft.world.World world,
net.minecraft.util.math.vector.Vector3d pos,
double range,
java.util.function.Predicate<T> predicate)
Finds all TileEntities within the given range
|
static <T extends net.minecraft.tileentity.TileEntity> |
findClosestTileEntity(java.lang.Class<T> tileEntity,
net.minecraft.entity.Entity entity,
double range,
java.util.function.Predicate<T> predicate)
Finds the closest TileEntity to the provided entity.
|
static <T extends java.lang.Comparable<T>> |
getPropertyValue(net.minecraft.block.BlockState state,
net.minecraft.state.Property<T> property) |
static <T extends net.minecraft.tileentity.TileEntity> |
getTileEntity(java.lang.Class<T> clazz,
net.minecraft.world.IBlockReader world,
net.minecraft.util.math.BlockPos pos) |
static void |
placeBed(net.minecraft.world.World world,
net.minecraft.util.math.BlockPos pos1,
net.minecraft.util.Direction facing,
net.minecraft.item.DyeColor color) |
static boolean |
validateReach(net.minecraft.entity.player.ServerPlayerEntity player,
net.minecraft.util.math.BlockPos pos) |
public static <T extends net.minecraft.tileentity.TileEntity> T findClosestTileEntity(java.lang.Class<T> tileEntity, net.minecraft.entity.Entity entity, double range, java.util.function.Predicate<T> predicate)
T
- A class that extends TileEntity.tileEntity
- The TileEntity class to find.entity
- The entity to search around.range
- The range around the entity to search.predicate
- Used for extra checking. if you just want the closest tile entity, return true.public static <T extends net.minecraft.tileentity.TileEntity> java.util.Map<net.minecraft.util.math.BlockPos,T> findAllTileEntityWithinRange(java.lang.Class<T> tileEntity, net.minecraft.entity.Entity entity, double range, java.util.function.Predicate<T> predicate)
T
- A class that extends TileEntity.tileEntity
- The TileEntity class to find.entity
- The entity we're searching around.range
- The range around the entity to search.predicate
- Optional TileEntity condition, can be null.public static <T extends net.minecraft.tileentity.TileEntity> java.util.Map<net.minecraft.util.math.BlockPos,T> findAllTileEntityWithinRange(java.lang.Class<T> tileEntity, net.minecraft.world.World world, net.minecraft.util.math.vector.Vector3d pos, double range, java.util.function.Predicate<T> predicate)
T
- A class that extends TileEntity.tileEntity
- The TileEntity class to find.world
- The world to search in.pos
- The pos to search around.range
- The range to search.predicate
- Optional TileEntity condition, can be null.public static int countTileEntitiesOfType(net.minecraft.world.World world, net.minecraft.util.math.ChunkPos pos, java.lang.Class<? extends net.minecraft.tileentity.TileEntity> clazz)
world
- the world that the chunk is in.pos
- The chunk position.clazz
- The TileEntity class to count.public static <T extends net.minecraft.tileentity.TileEntity> T getTileEntity(java.lang.Class<T> clazz, net.minecraft.world.IBlockReader world, net.minecraft.util.math.BlockPos pos)
public static boolean validateReach(net.minecraft.entity.player.ServerPlayerEntity player, net.minecraft.util.math.BlockPos pos)
public static void placeBed(net.minecraft.world.World world, net.minecraft.util.math.BlockPos pos1, net.minecraft.util.Direction facing, net.minecraft.item.DyeColor color)
public static <T extends java.lang.Comparable<T>> java.util.Optional<T> getPropertyValue(net.minecraft.block.BlockState state, net.minecraft.state.Property<T> property)