block.break event has event.player === event.getEntity(), block.place doesn't
Lupus590 opened this issue ยท 1 comments
A BlockPlaceEventJS doesn't actually have a player attribute as you can see here
This is just due to the original Forge / Fabric event's structure, which may accept non-player entities, as well. That said, this obviously makes event.player return undefined
, so if you want to compare the entity to something, you should probably just use their UUIDs:
KubeJS/common/src/main/java/dev/latvian/kubejs/entity/EntityJS.java
Lines 67 to 69 in 99c7cd7
In the future, there might be ways to "convert" an EntityJS to a PlayerJS, though our long term goal is actually to mostly do away with wrapper classes entirely and just integrate our functionality into the relevant vanilla classes