juliarn / npc-lib

Asynchronous, high-performance Minecraft NPC library for 1.8-1.21 servers.
MIT License
296 stars 50 forks source link

1.19.3 #83

Closed frqnny closed 1 year ago

frqnny commented 1 year ago

While I haven't tested and this might work perfectly well on 1.19.3, it did bring some great changes. Minecraft no longer requires NPC players to show up in tab anymore. Could this plugin support that functionality?

derklaro commented 1 year ago

See https://github.com/juliarn/NPC-Lib/commit/ce4e67e8433656a4844abf799d6d4c9bd0358b4e , not sure if I will update v2 for 1.19.3 anytime soon

DxsSucuk commented 1 year ago

Apperantly the ModernAccessor of the WorldAccessor does not work in Paper-1.19.3-f26e9cc anymore @derklaro

derklaro commented 1 year ago

Please provide more info, other than "doesn't work" 😉

DxsSucuk commented 1 year ago

Whil testing the API I tried to spawn a NPC replicating the Player on join, at the same position as the Player. I received a stacktrace that the given world-identifier is not valid and does not exist. Stacktrace:

java.lang.IllegalArgumentException: Could not resolve world from identifier: world
    at com.github.juliarn.npclib.common.npc.CommonNpcBuilder.position(CommonNpcBuilder.java:78) ~[TestNPCLib.jar:?]
    at de.presti.testnpclib.TestNPCLib.onEnable(TestNPCLib.java:26) ~[TestNPCLib.jar:?]
    at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:264) ~[paper-api-1.19.3-R0.1-SNAPSHOT.jar:?]
    at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:371) ~[paper-api-1.19.3-R0.1-SNAPSHOT.jar:?]
    at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:544) ~[paper-api-1.19.3-R0.1-SNAPSHOT.jar:?]
    at com.rylinaux.plugman.util.PluginUtil.load(PluginUtil.java:309) ~[PlugManX.jar:?]
    at com.rylinaux.plugman.util.PluginUtil.load(PluginUtil.java:267) ~[PlugManX.jar:?]
    at com.rylinaux.plugman.util.PluginUtil.reload(PluginUtil.java:393) ~[PlugManX.jar:?]
    at com.rylinaux.plugman.command.ReloadCommand.execute(ReloadCommand.java:122) ~[PlugManX.jar:?]
    at com.rylinaux.plugman.PlugManCommandHandler.onCommand(PlugManCommandHandler.java:95) ~[PlugManX.jar:?]
    at org.bukkit.command.PluginCommand.execute(PluginCommand.java:45) ~[paper-api-1.19.3-R0.1-SNAPSHOT.jar:?]
    at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:155) ~[paper-api-1.19.3-R0.1-SNAPSHOT.jar:?]
    at org.bukkit.craftbukkit.v1_19_R2.CraftServer.dispatchCommand(CraftServer.java:929) ~[paper-1.19.3.jar:git-Paper-358]
    at org.bukkit.craftbukkit.v1_19_R2.CraftServer.dispatchServerCommand(CraftServer.java:892) ~[paper-1.19.3.jar:git-Paper-358]
    at net.minecraft.server.dedicated.DedicatedServer.handleConsoleInputs(DedicatedServer.java:494) ~[paper-1.19.3.jar:git-Paper-358]
    at net.minecraft.server.dedicated.DedicatedServer.tickChildren(DedicatedServer.java:441) ~[paper-1.19.3.jar:git-Paper-358]
    at net.minecraft.server.MinecraftServer.tickServer(MinecraftServer.java:1397) ~[paper-1.19.3.jar:git-Paper-358]
    at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1173) ~[paper-1.19.3.jar:git-Paper-358]
    at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:316) ~[paper-1.19.3.jar:git-Paper-358]
    at java.lang.Thread.run(Thread.java:833) ~[?:?]

After modifying the library code and using the modified version, which forces the usage of the LegacyAccessor, the NPC could be spawned and exception has been thrown.

derklaro commented 1 year ago

The modern world accessor uses a key for the world identification (should be minecraft:world), use the legacy world accessor if you want to use legacy naming :)

DxsSucuk commented 1 year ago

Well in that case there should be a update in the BukkitPlatformUtil? Since I used it to transform a location into a position. And it does not check if the ModernAccessor is used or not. Which means in a version that uses it the transform method wouldn't work.

derklaro commented 1 year ago

@DxsSucuk as of https://github.com/juliarn/NPC-Lib/commit/edd6fe020bf7cf38b2c96e283d6f21da42f7a7c8 you can now use positionFromBukkitModern if you're sure that your server is running on paper 1.16.5+

derklaro commented 1 year ago

Just released beta2 which includes 1.19.3 support. Happy new year 🥂

DxsSucuk commented 1 year ago

Happy new year!