diff --git a/src/main/kotlin/com/steelextractor/extractors/Blocks.kt b/src/main/kotlin/com/steelextractor/extractors/Blocks.kt index 17db734..f31f985 100644 --- a/src/main/kotlin/com/steelextractor/extractors/Blocks.kt +++ b/src/main/kotlin/com/steelextractor/extractors/Blocks.kt @@ -12,6 +12,7 @@ import net.minecraft.resources.RegistryOps import net.minecraft.server.MinecraftServer import net.minecraft.world.level.EmptyBlockGetter import net.minecraft.world.level.block.Block +import net.minecraft.world.level.block.FireBlock import net.minecraft.world.level.block.state.BlockBehaviour import net.minecraft.world.level.block.state.BlockState import net.minecraft.world.level.block.state.properties.BlockStateProperties @@ -556,7 +557,9 @@ class Blocks : SteelExtractor.Extractor { val blocksJson = JsonArray() - + val fireBlock = net.minecraft.world.level.block.Blocks.FIRE as FireBlock + val igniteOddsMethod = fireBlock.javaClass.getDeclaredMethod("getIgniteOdds", BlockState::class.java).apply { isAccessible = true } + val burnOddsMethod = fireBlock.javaClass.getDeclaredMethod("getBurnOdds", BlockState::class.java).apply { isAccessible = true } for (block in BuiltInRegistries.BLOCK) { val blockJson = JsonObject() blockJson.addProperty("id", BuiltInRegistries.BLOCK.getId(block)) @@ -575,6 +578,7 @@ class Blocks : SteelExtractor.Extractor { "explosionResistance", getPrivateFieldValue(behaviourProps, "explosionResistance") ) + behaviourJson.addProperty( "isRandomlyTicking", getPrivateFieldValue(behaviourProps, "isRandomlyTicking") @@ -606,10 +610,7 @@ class Blocks : SteelExtractor.Extractor { behaviourJson.addProperty("maxVerticalOffset", getProtectedFloatMethodValue(block, "getMaxVerticalOffset")) behaviourJson.addProperty("destroyTime", getPrivateFieldValue(behaviourProps, "destroyTime")) - behaviourJson.addProperty( - "explosionResistance", - getPrivateFieldValue(behaviourProps, "explosionResistance") - ) + behaviourJson.addProperty("ignitedByLava", getPrivateFieldValue(behaviourProps, "ignitedByLava")) behaviourJson.addProperty("liquid", getPrivateFieldValue(behaviourProps, "liquid")) @@ -660,6 +661,17 @@ class Blocks : SteelExtractor.Extractor { }, ) + + val defaultState = block.defaultBlockState() + + val spreadChance = igniteOddsMethod.invoke(fireBlock, defaultState) as Int + val burnChance = burnOddsMethod.invoke(fireBlock, defaultState) as Int + val flammabilityJson = JsonObject().apply { + addProperty("spread_chance", spreadChance) + addProperty("burn_chance", burnChance) + } + blockJson.add("flammability", flammabilityJson) + // Only add if there are actual differences if (behaviourJson.size() > 0) { blockJson.add("behavior_properties", behaviourJson)