KubeJS (Old)

KubeJS (Old)

3M Downloads

BlockBuilder.flammable()

Lurrae opened this issue ยท 0 comments

commented

Describe the feature

Like how you can set the .hardness(), .resistance(), etc. of a block, it'd be really nice if you could set the flammability of a block! Judging by the Minecraft wiki's explanation of block flammability (see this page), there would probably have to be a couple of bonus arguments, and I could see it being set up like so:

event.create('kubejs:test_planks')
    ...
    .flammable(5, 20, true)

In this example, the first argument sets the "ignite odds" of the block (how likely it is for fire to spread to the block every fire tick), the second argument sets the "burn odds" of the block (how likely the block is to disappear every fire tick), and the third argument sets whether or not the block can be ignited by lava. If either ignite odds or burn odds are 0 (the default values) the block will not burn at all, so if you don't set .flammable your block won't burn at all, as should be expected
Perhaps there could even be a secondary, simpler-to-use method that looks like this:

event.create('kubejs:test_log')
    ...
    .flammable('minecraft:oak_log')

This just has one argument, taking an existing block's ID and using it to set the flammability statistics to match that block. This has the advantage of not needing to know the exact statistics of the block you want to copy, but of course gives you a bit less control over the specifics of how flammable a block is

Additional info

To my knowledge, there is no easy way to make a flammable block; there's not even an addon that supports it as far as I'm aware. You MIGHT be able to fudge it with .randomTick(), but with how many factors play in to block flammability, it'd be nearly impossible to get a 1:1 recreation of fire spread the way it works for other blocks.
Making blocks flammable seems like something that should be easy to do, especially considering just how common it is for a block to want to be flammable (for example, if someone makes a custom type of wood, they're gonna want almost every block they make to be flammable).