Extract block hardness in block extractor
Fix: https://github.com/Snowiiii/Pumpkin/issues/297
This commit is contained in:
parent
b01b276307
commit
a23ce773ad
1084
assets/blocks.json
1084
assets/blocks.json
File diff suppressed because it is too large
Load Diff
@ -30,6 +30,7 @@ class Blocks : Extractor.Extractor {
|
||||
blockJson.addProperty("id", Registries.BLOCK.getRawId(block))
|
||||
blockJson.addProperty("name", Registries.BLOCK.getId(block).toString())
|
||||
blockJson.addProperty("translation_key", block.translationKey)
|
||||
blockJson.addProperty("hardness", block.hardness)
|
||||
blockJson.addProperty("item_id", Registries.ITEM.getRawId(block.asItem()))
|
||||
|
||||
val propsJson = JsonArray()
|
||||
@ -69,9 +70,7 @@ class Blocks : Extractor.Extractor {
|
||||
|
||||
val collisionShapeIdxsJson = JsonArray()
|
||||
for (box in state.getCollisionShape(EmptyBlockView.INSTANCE, BlockPos.ORIGIN).boundingBoxes) {
|
||||
val collisionShape = Box(box.minX, box.minY, box.minZ, box.maxX, box.maxY, box.maxZ)
|
||||
|
||||
val idx = shapes.putIfAbsent(collisionShape, shapes.size)
|
||||
val idx = shapes.putIfAbsent(box, shapes.size)
|
||||
collisionShapeIdxsJson.add(Objects.requireNonNullElseGet(idx) { shapes.size - 1 })
|
||||
}
|
||||
|
||||
|
||||
@ -1,13 +1,11 @@
|
||||
package de.snowii.extractor.extractors
|
||||
|
||||
import com.google.gson.JsonArray
|
||||
import com.google.gson.JsonElement
|
||||
import com.google.gson.JsonObject
|
||||
import com.mojang.serialization.JsonOps
|
||||
import de.snowii.extractor.Extractor
|
||||
import net.minecraft.component.ComponentMap
|
||||
import net.minecraft.item.Item
|
||||
import net.minecraft.recipe.Recipe
|
||||
import net.minecraft.registry.Registries
|
||||
import net.minecraft.registry.RegistryKeys
|
||||
import net.minecraft.registry.RegistryOps
|
||||
|
||||
@ -52,6 +52,7 @@ pub struct TopLevel {
|
||||
pub struct Block {
|
||||
pub id: u16,
|
||||
pub item_id: u16,
|
||||
pub hardness: f32,
|
||||
pub wall_variant_id: Option<u16>,
|
||||
pub translation_key: String,
|
||||
pub name: String,
|
||||
|
||||
Loading…
Reference in New Issue
Block a user