#How to change rarity of block without using 'ItemEvents.modification'?
11 messages · Page 1 of 1 (latest)
Once your ticket has been resolved, please close it with </ticket close:1054771505520717835> command!
Rarities are for items, not for blocks
When you create a block in KubeJS, KJS automatically creates a block item for you
As KonSola brought up, rarity is for items only, meaning this rarity will only apply to the itemstack version of it, not when the block is placed
Furthermore, the BlockBuilder and it's associated BlockItemBuilder do not offer any methods to assign a rarity to the BlockItem.
Using ItemEvents.modification is the only easy option, outside of creating your own extended version of the BlockItemBuilder and adding a custom rarity setter with a JavaAdapter
Or, KubeJS' block builder offers an item method allowing you to modify the block item
StartupEvents.registry('block', event => {
event.create("custom_block").item(item => item.rarity("epic"))
})
Try this
So your block will be defined like this:
StartupEvents.registry('block', event => {
event
.create('perfect_alloy_block')
.item(item => item
.rarity('uncommon')
.fireResistant()
.maxStackSize(16)
)
})
oh yeah, completely forgot you could get the ItemBuilder from the BlockBuilder 
thanks