KubeJS

KubeJS

69M Downloads

PoiTypeBuilder not working due to blocks not being loaded yet

PssbleTrngle opened this issue ยท 2 comments

commented

Minecraft Version

1.18.2

KubeJS Version

1802.5.5-build.556

Rhino Version

1802.2.1-build.255

Architectury Version

4.10.86

Forge/Fabric Version

Forge 40.1.76

Describe your issue

I do not think it is possible to create PoiTypes using kubjs, since the blocks seem to not have been registered yet.
The block should probably be set using a Supplier, because whatever you pass to the block() method, kubejs receives minecraft:air

onEvent('point_of_interest_type.registry', event => {
    const block = 'create:millstone'
	//  Block.getBlock(block) == 'minecraft:air' at this point
    event.create('test_poi', 'basic').block(block)
})

The resulting error

java.lang.IllegalStateException: Point of interest types baker_workstation and carpenter_workstation both list Block{minecraft:air} in their blockstates, this is not allowed.

Crash report/logs

No response

commented

Deferred registry my beloved...

I think we might need a custom class extending supplier here because of how Rhino would have to deal with type wrapping and erasure? I'll take a look and see what I can do

commented

Ok, I'm not entirely sure if it's only a problem with modded blocks or with vanilla blocks too, I have not checked that