Item API

Extensions giving items more functionality.

Setup

repositories {
    mavenCentral()
}

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

CreoItemSettings

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

// 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

CreoItem.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);

Last updated