#Datagen Loot from Blockstate EnumProperty

5 messages · Page 1 of 1 (latest)

grizzled lion
#

i have a block that i want to be able to drop itself + another item that's placed in it, in this case a colored carpet

it works like this, i have this block where i can right click with a carpet and it adds a custom carpet texture on top of it, using a blockstate enum property, i can remove the carpet using shears, which will spawn an item entity of the corresponding item, but when broken it only drops the table itself, basically losing the carpet inside of it

so i want to read the relevant Property and return the corresponding item, and none when the property says so

jaunty iron
#

instead of doing it with a loot table

#

override the

onBroken(WorldAccess world, BlockPos pos, BlockState state)
``` function in the `Block` class
#

and drop a the carpet according to the blockstate passed in the arguments

jaunty iron