Java Code Examples for net.minecraft.world.IBlockReader#getTileEntity()

The following examples show how to use net.minecraft.world.IBlockReader#getTileEntity() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: BlockEnderTank.java    From EnderStorage with MIT License 5 votes vote down vote up
@Override
public VoxelShape getShape(BlockState state, IBlockReader worldIn, BlockPos pos, ISelectionContext context) {
    VoxelShape shape = TANK_SHAPE;
    TileEntity t = worldIn.getTileEntity(pos);
    if (t instanceof TileEnderTank) {
        TileEnderTank tile = (TileEnderTank) t;
        shape = SHAPES[tile.rotation];
    }
    return shape;
}
 
Example 2
Source File: BlockEnderChest.java    From EnderStorage with MIT License 5 votes vote down vote up
@Override
public VoxelShape getShape(BlockState state, IBlockReader worldIn, BlockPos pos, ISelectionContext context) {
    VoxelShape shape = CHEST_SHAPE;
    TileEntity t = worldIn.getTileEntity(pos);
    if (t instanceof TileEnderChest) {
        TileEnderChest tile = (TileEnderChest) t;
        shape = SHAPES[tile.rotation][tile.getRadianLidAngle(0) >= 0 ? 0 : 1];
    }
    return shape;
}
 
Example 3
Source File: BlockEnderStorage.java    From EnderStorage with MIT License 5 votes vote down vote up
@Override
public int getLightValue(BlockState state, IBlockReader world, BlockPos pos) {
    TileEntity tile = world.getTileEntity(pos);
    if (tile instanceof TileFrequencyOwner) {
        return ((TileFrequencyOwner) tile).getLightValue();
    }
    return 0;
}
 
Example 4
Source File: BlockEnderStorage.java    From EnderStorage with MIT License 4 votes vote down vote up
@Override
public ItemStack getPickBlock(BlockState state, RayTraceResult rayTraceResult, IBlockReader world, BlockPos pos, PlayerEntity player) {
    TileFrequencyOwner tile = (TileFrequencyOwner) world.getTileEntity(pos);
    return createItem(tile.getFrequency());
}
 
Example 5
Source File: BlockEnderStorage.java    From EnderStorage with MIT License 4 votes vote down vote up
@Override
public boolean canConnectRedstone(BlockState state, IBlockReader world, BlockPos pos, Direction side) {
    TileEntity tile = world.getTileEntity(pos);
    return tile instanceof TileFrequencyOwner && ((TileFrequencyOwner) tile).redstoneInteraction();
}