> For the complete documentation index, see [llms.txt](https://docs.creoii.dev/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.creoii.dev/creo-api/packages/block-api.md).

# Block API

## Setup

{% tabs %}
{% tab title="Gradle" %}

```gradle
repositories {
    mavenCentral()
}

dependencies {
    modImplementation 'dev.creoii.creoapi:creo-block-api:<VERSION>'
}
```

{% endtab %}

{% tab title="Kotlin" %}

```gradle
repositories {
    mavenCentral()
}

dependencies {
    modImplementation("dev.creoii.creoapi:creo-block-api:<VERSION>")
}
```

{% endtab %}
{% endtabs %}

## CreoBlock

{% code title="CreoBlock.java" %}

```java
// Called when an entity is looking at the block.
void onLookedAt(World world, BlockState state, BlockHitResult hitResult, Entity looker, double squaredDistance);

// Called when a block is placed by a structure block, after data structure blocks have been processed.
void onPlacedByStructure(ServerWorldAccess world, BlockPos pos, BlockState state, FluidState fluidState, Random random, BlockPos pivot, StructureTemplate structureTemplate, StructurePlacementData placementData, StructureTemplate.StructureBlockInfo structureBlockInfo);

// Determines whether CreoBlock#onAdjacentEntityCollision can be called.
boolean canEntityCollideAdjacent(Entity entity, BlockState state, BlockPos pos);

// Called when an entity is next to a block but not actually colliding with it.
void onAdjacentEntityCollision(Entity entity, BlockState state, BlockPos pos);

// Called client-side to render a blockstate as an overlay to the block.
BlockState getOverlayState(BlockState state, BlockPos pos, Random random);
```

{% endcode %}

## Spreadable
