# Item API

## Setup

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

```gradle
repositories {
    mavenCentral()
}

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

{% endtab %}

{% tab title="Kotlin" %}

```gradle
repositories {
    mavenCentral()
}

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

{% endtab %}
{% endtabs %}

## CreoItemSettings

An extension of **FabricItemSettings** that provides even more customizability for items.

```java
// Delay once the item is dropped until it can be picked up again.
private int pickupDelay;

// How long it takes for the item to despawn.
private int despawnTime;

// Whether the item floats or sinks in fluids.
private boolean buoyant;

// The amount of downwards gravity applied to the item when dropped.
private double gravity;

// How fast a Hopper transfers the item to another Hopper or container.
private int hopperTransferRate;

// How fast the item rotates when on the ground.
private float rotationModifier;

// Makes the item picked up by right-clicking instead of collision.
private boolean clickPickup;

// What fuel items are required to smelt this item, if smeltable.
private RegistryEntryList<Item> requiredFuels;
```

## CreoItem

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

```java
// Determines whether CreoBlock#onAttackThroughBlock can be called.
boolean canAttackThroughBlock(ServerPlayerEntity player, ItemStack stack, Entity target);

// Called when the item attacks an entity through a block.
void onAttackThroughBlock(ServerPlayerEntity player, ItemStack stack, Entity target);
```

{% endcode %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.creoii.dev/creo-api/packages/item-api.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
