Moonlight Lib

Moonlight Lib

197M Downloads

It would be nice if you could get the wood type of a Wood Log.

Gremious opened this issue ยท 5 comments

commented

I am a mod developer on Fabric/1.20.1 and I use moonlight lib as a dependency. The WoodTypeRegistry and WoodType.getChildren letting me go from plank to slab/fence/etc. with cross mod compatibility is fantastic :)

For reference, my mod will "break down" blocks, e.g. on use of a tool, go from oak logs -> stripped -> planks slabs -> fences -> sticks.

Unfortunately, I cannot find a nice way to go from a wood log to the wood type, i.e.

woodRegistry.detectTypeFromBlock(Blocks.OAK_LOG, Registries.BLOCK.getId(Blocks.OAK_LOG))

Is empty since it only triggers for the planks.

Personally, I'll likely have to decipher the name of the block, and then try to find it in the WoodTypeRegistry.getTypes() entries. (Open to ideas).

So, I open this issue as a suggestion - it would be nice if Moonlight provided a function which, if given a Log/Stripped/hyphae Block and/or Identifier for said block, would give out the wood type, so you can figure out which planks are supposed to match it.

commented

And WoodTypeRegistry is a subclass of BlockTypeRegistry. so you can use that method.

commented

There is one. WoodTypeRegistry.getTypeOf. or something similar.

commented

There should also be a utility to morph into different kinds but that's just shorthand, don't remember where for that one, maybe it's internal.

commented
commented

Oh, brilliant - thank you both very much.