azalea-rs / azalea

A collection of Rust crates for making Minecraft bots, clients, and tools.
https://azalea.matdoes.dev
MIT License
361 stars 48 forks source link

feat: Setting properties on a `BlockState` generically #140

Open Sculas opened 4 months ago

Sculas commented 4 months ago

Currently, you need the concrete type of a block to set, for example, the facing. However, this isn't possible in cases where you don't know the concrete type of a block. Properties don't have FromStr implemented either, so you can't go from a waterlogged=true to Waterlogged(true).

All in all, this makes it very hard (almost impossible I'd say) to implement a WorldEdit schematic parser, because you can't parse a value like this one: minecraft:birch_stairs[facing=east,half=bottom,shape=straight,waterlogged=false] to it's corresponding BlockState.

My current workaround is to use a LUT, taken from here.