KubeJS (Old)

KubeJS (Old)

3M Downloads

[1.19] dev.latvian.mods.kubejs.forge.KubeJSForge.itemDestroyed needs to use getEntity instead of getPlayer in new Forge versions

zach2039 opened this issue ยท 1 comments

commented

Minecraft Version

1.19

KubeJS Version

1900.5.5-build.27

Rhino Version

1802.1.13-build.174

Architectury Version

5.9.31

Forge/Fabric Version

41.0.98

Describe your issue

NoSuchMethodError after spawning in entity with spawn egg. PlayerDestroyItemEvent no longer has getPlayer(), but instead getEntity(). The following code needs to change in dev.latvian.mods.kubejs.forge.KubeJSForge.java:

private static void itemDestroyed(PlayerDestroyItemEvent event) {
  if (event.getPlayer() instanceof ServerPlayer) {
    new ItemDestroyedEventJS(event).post(KubeJSEvents.ITEM_DESTROYED);
  }
}

Crash report/logs

https://pastebin.com/hSDR15Jz

commented

This likely won't be fixed for a while as Lat is currently working on a major internal refactor, but I will add it to the milestone for that release to let people know it is being looked into