Skip to content
On this page

Common

KattonLootTableApi

top.katton.api.dpcallercommon/src/main/kotlin/top/katton/api/dpcaller/KattonLootTableApi.kt
Get drops for a block as if it were broken with a tool.

dropBlockLoot

CommonFunction
kotlin
fun dropBlockLoot(pos: BlockPos, tool: ItemStack): List<ItemStack>

Get drops for a block as if it were broken with a tool.

Parameters

ParameterDescription
posblock position
tooltool ItemStack used to break the block

Returns

list of ItemStack drops

dropKillLoot

CommonFunction
kotlin
fun dropKillLoot(entity: Entity, killer: Entity?): List<ItemStack>

Get drops for an entity as if it were killed.

Parameters

ParameterDescription
entitytarget entity
killeroptional killer entity (may influence drops)

Returns

list of ItemStack drops

dropChestLoot

CommonFunction
kotlin
fun dropChestLoot(lootTable: LootTable): List<ItemStack>

Generate chest loot from a LootTable.

Parameters

ParameterDescription
lootTableLootTable to roll

Returns

list of generated ItemStack

dropFishingLoot

CommonFunction
kotlin
fun dropFishingLoot(lootTable: LootTable, pos: BlockPos, tool: ItemStack): List<ItemStack>

Generate fishing loot from a LootTable.

Parameters

ParameterDescription
lootTableLootTable to roll
posorigin position for loot context
tooltool ItemStack used

Returns

list of generated ItemStack

dropToBlock

CommonFunction
kotlin
fun dropToBlock(block: BlockPos, itemStacks: List<ItemStack>)

Attempt to deposit item stacks into a container block.

Parameters

ParameterDescription
blockcontainer block position
itemStackslist of ItemStack to deposit (may be modified)

dropToBlockReplace

CommonFunction
kotlin
fun dropToBlockReplace(block: BlockPos, i: Int, j: Int, itemStacks: List<ItemStack>)

Replace a range of slots in a container block with given item stacks.

Parameters

ParameterDescription
blockcontainer position
istart slot index
jnumber of slots to replace
itemStackslist of ItemStacks to place (shorter lists fill with empty)

dropToPlayer

CommonFunction
kotlin
fun dropToPlayer(player: ServerPlayer, itemStacks: List<ItemStack>)

Give item stacks to players (adds copies to inventory).

Parameters

ParameterDescription
playertarget ServerPlayer
itemStackslist of ItemStack to give

dropToEntity

CommonFunction
kotlin
fun dropToEntity(entity: Entity, i: Int, j: Int, itemStacks: List<ItemStack>)

Set item stacks into entity slots.

Parameters

ParameterDescription
entitytarget entity
istarting slot index
jnumber of slots to set
itemStackslist of ItemStacks to set

dropTo

CommonFunction
kotlin
fun dropTo(level: Level, pos: Vec3, itemStacks: List<ItemStack>)

Drop item stacks into the world at a position.

Parameters

ParameterDescription
levelworld level
posdrop position
itemStackslist of ItemStack to spawn