Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add compatibility with MC 1.20.6 #125

Closed
MusclePr opened this issue May 19, 2024 · 49 comments
Closed

Add compatibility with MC 1.20.6 #125

MusclePr opened this issue May 19, 2024 · 49 comments
Labels
status: confirmed This issue has been confirmed and waiting for a resolution type: feature New feature or request

Comments

@MusclePr
Copy link

MusclePr commented May 19, 2024

I am always indebted to Yamipa.

I am just reporting this because it did not start with 1.20.6.

Starting org.bukkit.craftbukkit.Main
System Info: Java 21 (OpenJDK 64-Bit Server VM 21.0.3+9-LTS) Host: Linux 6.5.13-3-pve (amd64)
Loading libraries, please wait...
WARN StatusConsoleListener The use of package scanning to locate plugins is deprecated and will be removed in a future release
WARN StatusConsoleListener The use of package scanning to locate plugins is deprecated and will be removed in a future release
WARN StatusConsoleListener The use of package scanning to locate plugins is deprecated and will be removed in a future release
WARN StatusConsoleListener The use of package scanning to locate plugins is deprecated and will be removed in a future release
[08:29:14] [ServerMain/INFO]: Environment: Environment[sessionHost=https://sessionserver.mojang.com, servicesHost=https://api.minecraftservices.com, name=PROD]
[08:29:14] [ServerMain/INFO]: Loaded 1175 recipes
[08:29:15] [ServerMain/INFO]: Loaded 1276 advancements
[08:29:15] [Server thread/INFO]: Starting minecraft server version 1.20.6
[08:29:15] [Server thread/INFO]: Loading properties
[08:29:15] [Server thread/INFO]: This server is running Paper version 1.20.6-82-master@0ad09de (2024-05-18T20:25:01Z) (Implementing API version 1.20.6-R0.1-SNAPSHOT)
[08:29:15] [Server thread/INFO]: Server Ping Player Sample Count: 12
[08:29:15] [Server thread/INFO]: Using 4 threads for Netty based IO
[08:29:16] [Server thread/WARN]: [!] The timings profiler has been enabled but has been scheduled for removal from Paper in the future.
    We recommend installing the spark profiler as a replacement: https://spark.lucko.me/
    For more information please visit: https://github.com/PaperMC/Paper/issues/8948
[08:29:16] [Server thread/INFO]: Chunk system is using 1 I/O threads, 4 worker threads, and gen parallelism of 4 threads
[08:29:16] [Server thread/INFO]: Default game type: CREATIVE
[08:29:16] [Server thread/INFO]: Generating keypair
[08:29:16] [Server thread/INFO]: Starting Minecraft server on *:25565
[08:29:16] [Server thread/INFO]: Using epoll channel type
[08:29:16] [Server thread/INFO]: Paper: Using libdeflate (Linux x86_64) compression from Velocity.
[08:29:16] [Server thread/INFO]: Paper: Using OpenSSL 3.0.x (Linux x86_64) cipher from Velocity.
[08:29:16] [Server thread/INFO]: Loading server plugin ProtocolLib v5.2.1-SNAPSHOT-689
[08:29:16] [Server thread/WARN]: Version (MC: 1.20.6) has not yet been tested! Proceed with caution.
[08:29:17] [Server thread/INFO]: Loading server plugin YamipaPlugin v1.3.1
[08:29:17] [Server thread/INFO]: Server permissions file permissions.yml is empty, ignoring it
[08:29:17] [Server thread/INFO]: Enabling ProtocolLib v5.2.1-SNAPSHOT-689
[08:29:17] [Server thread/WARN]: **** SERVER IS RUNNING IN OFFLINE/INSECURE MODE!
[08:29:17] [Server thread/WARN]: The server will make no attempt to authenticate usernames. Beware.
[08:29:17] [Server thread/WARN]: Whilst this makes it possible to use BungeeCord, unless access to your server is properly restricted, it also opens up the ability for hackers to connect with any username they choose.
[08:29:17] [Server thread/WARN]: Please see http://www.spigotmc.org/wiki/firewall-guide/ for further information.
[08:29:17] [Server thread/WARN]: To change this, set "online-mode" to "true" in the server.properties file.
[08:29:17] [Server thread/INFO]: Preparing level "world"
[08:29:17] [Server thread/INFO]: Preparing start region for dimension minecraft:overworld
[08:29:18] [Server thread/INFO]: Time elapsed: 363 ms
[08:29:18] [Server thread/INFO]: Preparing start region for dimension minecraft:the_nether
[08:29:18] [Server thread/INFO]: Time elapsed: 75 ms
[08:29:18] [Server thread/INFO]: Preparing start region for dimension minecraft:the_end
[08:29:18] [Server thread/INFO]: Time elapsed: 60 ms
[08:29:18] [Server thread/INFO]: Enabling YamipaPlugin v1.3.1
[08:29:18] [Server thread/ERROR]: Error occurred while enabling YamipaPlugin v1.3.1 (Is it up to date?)
java.lang.ExceptionInInitializerError: null
        at Yamipa.jar/io.josemmo.bukkit.plugin.commands.ImageCommandBridge.register(ImageCommandBridge.java:29) ~[?:?]
        at Yamipa.jar/io.josemmo.bukkit.plugin.YamipaPlugin.onEnable(YamipaPlugin.java:90) ~[?:?]
        at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:287) ~[paper-api-1.20.6-R0.1-SNAPSHOT.jar:?]
        at io.papermc.paper.plugin.manager.PaperPluginInstanceManager.enablePlugin(PaperPluginInstanceManager.java:202) ~[paper-1.20.6.jar:1.20.6-82-0ad09de]
        at io.papermc.paper.plugin.manager.PaperPluginManagerImpl.enablePlugin(PaperPluginManagerImpl.java:109) ~[paper-1.20.6.jar:1.20.6-82-0ad09de]
        at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:519) ~[paper-api-1.20.6-R0.1-SNAPSHOT.jar:?]
        at org.bukkit.craftbukkit.CraftServer.enablePlugin(CraftServer.java:604) ~[paper-1.20.6.jar:1.20.6-82-0ad09de]
        at org.bukkit.craftbukkit.CraftServer.enablePlugins(CraftServer.java:553) ~[paper-1.20.6.jar:1.20.6-82-0ad09de]
        at net.minecraft.server.MinecraftServer.loadWorld0(MinecraftServer.java:678) ~[paper-1.20.6.jar:1.20.6-82-0ad09de]
        at net.minecraft.server.MinecraftServer.loadLevel(MinecraftServer.java:437) ~[paper-1.20.6.jar:1.20.6-82-0ad09de]
        at net.minecraft.server.dedicated.DedicatedServer.initServer(DedicatedServer.java:323) ~[paper-1.20.6.jar:1.20.6-82-0ad09de]
        at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1139) ~[paper-1.20.6.jar:1.20.6-82-0ad09de]
        at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:323) ~[paper-1.20.6.jar:1.20.6-82-0ad09de]
        at java.base/java.lang.Thread.run(Unknown Source) [?:?]
Caused by: java.lang.RuntimeException: Failed to get internal classes due to incompatible Minecraft server
        at Yamipa.jar/io.josemmo.bukkit.plugin.utils.Internals.<clinit>(Internals.java:52) ~[?:?]
        ... 14 more
Caused by: java.lang.NoSuchFieldException: vanillaCommandDispatcher
        at java.base/java.lang.Class.getDeclaredField(Unknown Source) ~[?:?]
        at io.papermc.reflectionrewriter.runtime.AbstractDefaultRulesReflectionProxy.getDeclaredField(AbstractDefaultRulesReflectionProxy.java:90) ~[reflection-rewriter-runtime-0.0.1.jar:?]
        at io.papermc.paper.pluginremap.reflect.PaperReflectionHolder.getDeclaredField(Unknown Source) ~[paper-1.20.6.jar:1.20.6-82-0ad09de]
        at Yamipa.jar/io.josemmo.bukkit.plugin.utils.Internals.<clinit>(Internals.java:34) ~[?:?]
        ... 14 more
[08:29:18] [Server thread/INFO]: Disabling YamipaPlugin v1.3.1
[08:29:18] [Server thread/INFO]: Starting remote control listener
[08:29:18] [Server thread/INFO]: Thread RCON Listener started
[08:29:18] [Server thread/INFO]: RCON running on 0.0.0.0:25575
[08:29:18] [Server thread/INFO]: Running delayed init tasks
[08:29:18] [Server thread/INFO]: Done (3.314s)! For help, type "help"
[08:29:18] [Server thread/INFO]: Timings Reset
@josemmo josemmo added type: feature New feature or request status: confirmed This issue has been confirmed and waiting for a resolution labels May 26, 2024
@josemmo josemmo changed the title Error occured on paper 1.20.6 Add compatibility with MC 1.20.6 May 26, 2024
josemmo added a commit that referenced this issue May 26, 2024
- Updated Internals class

 > Related to #125
@MusclePr
Copy link
Author

MusclePr commented Jun 5, 2024

  • Paper version 1.20.6-137-master@bd5867a (2024-06-04T21:04:28Z)
  • YamipaPlugin v1.3.2-SNAPSHOT-b2 (develop 424aa67)
[19:35:09] [Server thread/INFO]: Loading server plugin YamipaPlugin v1.3.2-SNAPSHOT-b2
   :
[19:35:22] [Server thread/INFO]: Enabling YamipaPlugin v1.3.2-SNAPSHOT-b2
[19:35:22] [Server thread/INFO]: Enabled image animation support

Started!

@Rat3l
Copy link

Rat3l commented Jun 9, 2024

Still not fixed

@MusclePr
Copy link
Author

MusclePr commented Jun 13, 2024

1.20.4
2024-06-13_10 17 02

version up to 1.20.6
2024-06-13_10 18 57

Yamipa does not output any error logs.
The command seems to work, but the image just doesn't appear on the screen.

@wtlgo
Copy link

wtlgo commented Jun 13, 2024

Maybe because of the ProtocolLib?

@josemmo
Copy link
Owner

josemmo commented Jun 13, 2024

Yes, this is related to ProtocolLib. Some bugs first need to be fixed in this library before they can be addressed in Yamipa, so be patient.

@josemmo josemmo closed this as completed Jun 13, 2024
@josemmo josemmo reopened this Jun 13, 2024
@wtlgo
Copy link

wtlgo commented Jun 13, 2024

Is there an open issue for that in dmulloy's repo? Can I have a look?

@MusclePr
Copy link
Author

MusclePr commented Jun 14, 2024

@josemmo

  • Paper version 1.20.6-139-master@79e2cb6
  • ProtocolLib v5.3.0-SNAPSHOT-716
  • YamipaPlugin v1.3.2-SNAPSHOT-b2
  • I pasted one image. /yamipa place nimachi 6

plugins/YamipaPlugin/config.yml

verbose: true
[init] Changing ownership of /data to 1000 ...
[init] Running as uid=1000 gid=1000 with /data as 'drwxrwxrwx 1 0 0 8192 Jun 14 09:37 /data'
[init] Resolving type given PAPER
[mc-image-helper] 09:51:48.664 INFO  : Resolved paper to version 1.20.6 build 139
[init] Copying any plugins from /plugins to /data/plugins
[mc-image-helper] 09:51:51.055 INFO  : Created/updated 2 properties in /data/server.properties
[init] Setting initial memory to 4G and max to 4G
[init] Starting the Minecraft server...
Starting org.bukkit.craftbukkit.Main
System Info: Java 21 (OpenJDK 64-Bit Server VM 21.0.3+9-LTS) Host: Linux 6.6.26-linuxkit (amd64)
Loading libraries, please wait...
WARN StatusConsoleListener Advanced terminal features are not available in this environment
[09:51:57 INFO]: Environment: Environment[sessionHost=https://sessionserver.mojang.com, servicesHost=https://api.minecraftservices.com, name=PROD]
[09:51:58 INFO]: Loaded 1175 recipes
[09:51:58 INFO]: Loaded 1276 advancements
[09:51:58 INFO]: Starting minecraft server version 1.20.6
[09:51:58 INFO]: Loading properties
[09:51:58 INFO]: This server is running Paper version 1.20.6-139-master@79e2cb6 (2024-06-13T14:55:37Z) (Implementing API version 1.20.6-R0.1-SNAPSHOT)
[09:51:58 INFO]: Server Ping Player Sample Count: 12
[09:51:58 INFO]: Using 4 threads for Netty based IO
[09:51:58 WARN]: [!] The timings profiler has been enabled but has been scheduled for removal from Paper in the future.
    We recommend installing the spark profiler as a replacement: https://spark.lucko.me/
    For more information please visit: https://github.com/PaperMC/Paper/issues/8948
[09:51:58 INFO]: [ChunkTaskScheduler] Chunk system is using 1 I/O threads, 6 worker threads, and gen parallelism of 6 threads
[09:51:59 INFO]: Default game type: SURVIVAL
[09:51:59 INFO]: Generating keypair
[09:51:59 INFO]: Starting Minecraft server on *:25565
[09:51:59 INFO]: Using epoll channel type
[09:51:59 INFO]: Paper: Using libdeflate (Linux x86_64) compression from Velocity.
[09:51:59 INFO]: Paper: Using OpenSSL 3.0.x (Linux x86_64) cipher from Velocity.
[09:51:59 INFO]: [ProtocolLib] Loading server plugin ProtocolLib v5.3.0-SNAPSHOT-716
[09:51:59 WARN]: [ProtocolLib] Version (MC: 1.20.6) has not yet been tested! Proceed with caution.
[09:52:00 INFO]: [YamipaPlugin] Loading server plugin YamipaPlugin v1.3.2-SNAPSHOT-b2
[09:52:00 INFO]: Server permissions file permissions.yml is empty, ignoring it
[09:52:00 INFO]: [ProtocolLib] Enabling ProtocolLib v5.3.0-SNAPSHOT-716
[09:52:00 INFO]: Preparing level "world"
[09:52:00 INFO]: Preparing start region for dimension minecraft:overworld
[09:52:01 INFO]: Time elapsed: 697 ms
[09:52:01 INFO]: Preparing start region for dimension minecraft:the_nether
[09:52:01 INFO]: Time elapsed: 356 ms
[09:52:01 INFO]: Preparing start region for dimension minecraft:the_end
[09:52:02 INFO]: Time elapsed: 312 ms
[09:52:02 INFO]: [YamipaPlugin] Enabling YamipaPlugin v1.3.2-SNAPSHOT-b2
[09:52:02 INFO]: [YamipaPlugin] Running on VERBOSE mode
[09:52:02 INFO]: [YamipaPlugin] [ImageCommandBridge] Registered plugin command and aliases
[09:52:02 INFO]: [YamipaPlugin] [ImageStorage] Registered file "nimachi"
[09:52:02 INFO]: [YamipaPlugin] [ImageStorage] Found 1 file(s) in images directory
[09:52:02 INFO]: [YamipaPlugin] Enabled image animation support
[09:52:02 INFO]: [YamipaPlugin] [FileSystemWatcher] Started watching directory at "/data/plugins/YamipaPlugin/images"
[09:52:02 INFO]: [YamipaPlugin] [FakeImage] Created FakeImage#(Location{world=CraftWorld{name=world},x=8.0,y=80.0,z=45.0,pitch=0.0,yaw=0.0},NORTH) from ImageFile#(nimachi)
[09:52:02 INFO]: [YamipaPlugin] [ImageRenderer] Created WorldArea#(world,0,0)
[09:52:02 INFO]: [YamipaPlugin] Waiting for ProtocolLib to be ready...
[09:52:02 INFO]: [YamipaPlugin] Triggered map color cache warm-up
[09:52:02 INFO]: [YamipaPlugin] ProtocolLib is now ready
[09:52:02 INFO]: Starting remote control listener
[09:52:02 INFO]: Thread RCON Listener started
[09:52:02 INFO]: RCON running on 0.0.0.0:25575
[09:52:02 INFO]: Running delayed init tasks
[09:52:02 INFO]: [YamipaPlugin] [ImageCommandBridge] Fixed command permissions
[09:52:02 INFO]: Done (4.187s)! For help, type "help"
[09:52:02 INFO]: Timings Reset
[09:52:28 INFO]: UUID of player Muscle_p is b0f19f33-fa11-489f-92ba-35a43418d7ea
[09:52:28 INFO]: [YamipaPlugin] [ImageRenderer] Player#Muscle_p moved to WorldArea#(world,0,0)
[09:52:28 INFO]: [YamipaPlugin] [FakeImage] Received request to spawn FakeImage#(Location{world=CraftWorld{name=world},x=8.0,y=80.0,z=45.0,pitch=0.0,yaw=0.0},NORTH) for Player#Muscle_p
[09:52:28 INFO]: Muscle_p joined the game
[09:52:28 INFO]: [YamipaPlugin] [CachedMapsFile] Found warm cache file "/data/plugins/YamipaPlugin/cache/nimachi.6-6.cache"
[09:52:28 INFO]: [YamipaPlugin] [FakeMap] Created FakeMap#2147483647
[09:52:28 INFO]: [YamipaPlugin] [FakeMap] Created FakeMap#2147483646
[09:52:28 INFO]: [YamipaPlugin] [FakeMap] Created FakeMap#2147483645
[09:52:28 INFO]: [YamipaPlugin] [FakeMap] Created FakeMap#2147483644
[09:52:28 INFO]: [YamipaPlugin] [FakeMap] Created FakeMap#2147483643
[09:52:28 INFO]: [YamipaPlugin] [FakeMap] Created FakeMap#2147483642
[09:52:28 INFO]: [YamipaPlugin] [FakeMap] Created FakeMap#2147483641
[09:52:28 INFO]: [YamipaPlugin] [FakeMap] Created FakeMap#2147483640
[09:52:28 INFO]: [YamipaPlugin] [FakeMap] Created FakeMap#2147483639
[09:52:28 INFO]: [YamipaPlugin] [FakeMap] Created FakeMap#2147483638
[09:52:28 INFO]: [YamipaPlugin] [FakeMap] Created FakeMap#2147483637
[09:52:28 INFO]: [YamipaPlugin] [FakeMap] Created FakeMap#2147483636
[09:52:28 INFO]: [YamipaPlugin] [FakeMap] Created FakeMap#2147483635
[09:52:28 INFO]: [YamipaPlugin] [FakeMap] Created FakeMap#2147483634
[09:52:28 INFO]: [YamipaPlugin] [FakeMap] Created FakeMap#2147483633
[09:52:28 INFO]: [YamipaPlugin] [FakeMap] Created FakeMap#2147483632
[09:52:28 INFO]: [YamipaPlugin] [FakeMap] Created FakeMap#2147483631
[09:52:28 INFO]: [YamipaPlugin] [FakeMap] Created FakeMap#2147483630
[09:52:28 INFO]: [YamipaPlugin] [FakeMap] Created FakeMap#2147483629
[09:52:28 INFO]: [YamipaPlugin] [FakeMap] Created FakeMap#2147483628
[09:52:28 INFO]: [YamipaPlugin] [FakeMap] Created FakeMap#2147483627
[09:52:28 INFO]: [YamipaPlugin] [FakeMap] Created FakeMap#2147483626
[09:52:28 INFO]: [YamipaPlugin] [FakeMap] Created FakeMap#2147483625
[09:52:28 INFO]: [YamipaPlugin] [FakeMap] Created FakeMap#2147483624
[09:52:28 INFO]: [YamipaPlugin] [FakeMap] Created FakeMap#2147483623
[09:52:28 INFO]: [YamipaPlugin] [FakeMap] Created FakeMap#2147483622
[09:52:28 INFO]: [YamipaPlugin] [FakeMap] Created FakeMap#2147483621
[09:52:28 INFO]: [YamipaPlugin] [FakeMap] Created FakeMap#2147483620
[09:52:28 INFO]: [YamipaPlugin] [FakeMap] Created FakeMap#2147483619
[09:52:28 INFO]: [YamipaPlugin] [FakeMap] Created FakeMap#2147483618
[09:52:28 INFO]: [YamipaPlugin] [FakeMap] Created FakeMap#2147483617
[09:52:28 INFO]: [YamipaPlugin] [FakeMap] Created FakeMap#2147483616
[09:52:28 INFO]: [YamipaPlugin] [FakeMap] Created FakeMap#2147483615
[09:52:28 INFO]: [YamipaPlugin] [FakeMap] Created FakeMap#2147483614
[09:52:28 INFO]: [YamipaPlugin] [FakeMap] Created FakeMap#2147483613
[09:52:28 INFO]: [YamipaPlugin] [FakeMap] Created FakeMap#2147483612
[09:52:28 INFO]: [YamipaPlugin] [FakeItemFrame] Created FakeItemFrame#536870911 using 1 FakeMap(s)
[09:52:28 INFO]: [YamipaPlugin] [FakeItemFrame] Created FakeItemFrame#536870912 using 1 FakeMap(s)
[09:52:28 INFO]: [YamipaPlugin] [FakeItemFrame] Created FakeItemFrame#536870913 using 1 FakeMap(s)
[09:52:28 INFO]: [YamipaPlugin] [FakeItemFrame] Created FakeItemFrame#536870914 using 1 FakeMap(s)
[09:52:28 INFO]: [YamipaPlugin] [FakeItemFrame] Created FakeItemFrame#536870915 using 1 FakeMap(s)
[09:52:28 INFO]: [YamipaPlugin] [FakeItemFrame] Created FakeItemFrame#536870916 using 1 FakeMap(s)
[09:52:28 INFO]: [YamipaPlugin] [FakeItemFrame] Created FakeItemFrame#536870917 using 1 FakeMap(s)
[09:52:28 INFO]: [YamipaPlugin] [FakeItemFrame] Created FakeItemFrame#536870918 using 1 FakeMap(s)
[09:52:28 INFO]: [YamipaPlugin] [FakeItemFrame] Created FakeItemFrame#536870919 using 1 FakeMap(s)
[09:52:28 INFO]: [YamipaPlugin] [FakeItemFrame] Created FakeItemFrame#536870920 using 1 FakeMap(s)
[09:52:28 INFO]: [YamipaPlugin] [FakeItemFrame] Created FakeItemFrame#536870921 using 1 FakeMap(s)
[09:52:28 INFO]: [YamipaPlugin] [FakeItemFrame] Created FakeItemFrame#536870922 using 1 FakeMap(s)
[09:52:28 INFO]: [YamipaPlugin] [FakeItemFrame] Created FakeItemFrame#536870923 using 1 FakeMap(s)
[09:52:28 INFO]: [YamipaPlugin] [FakeItemFrame] Created FakeItemFrame#536870924 using 1 FakeMap(s)
[09:52:28 INFO]: [YamipaPlugin] [FakeItemFrame] Created FakeItemFrame#536870925 using 1 FakeMap(s)
[09:52:28 INFO]: [YamipaPlugin] [FakeItemFrame] Created FakeItemFrame#536870926 using 1 FakeMap(s)
[09:52:28 INFO]: [YamipaPlugin] [FakeItemFrame] Created FakeItemFrame#536870927 using 1 FakeMap(s)
[09:52:28 INFO]: [YamipaPlugin] [FakeItemFrame] Created FakeItemFrame#536870928 using 1 FakeMap(s)
[09:52:28 INFO]: [YamipaPlugin] [FakeItemFrame] Created FakeItemFrame#536870929 using 1 FakeMap(s)
[09:52:28 INFO]: [YamipaPlugin] [FakeItemFrame] Created FakeItemFrame#536870930 using 1 FakeMap(s)
[09:52:28 INFO]: [YamipaPlugin] [FakeItemFrame] Created FakeItemFrame#536870931 using 1 FakeMap(s)
[09:52:28 INFO]: [YamipaPlugin] [FakeItemFrame] Created FakeItemFrame#536870932 using 1 FakeMap(s)
[09:52:28 INFO]: [YamipaPlugin] [FakeItemFrame] Created FakeItemFrame#536870933 using 1 FakeMap(s)
[09:52:28 INFO]: [YamipaPlugin] [FakeItemFrame] Created FakeItemFrame#536870934 using 1 FakeMap(s)
[09:52:28 INFO]: [YamipaPlugin] [FakeItemFrame] Created FakeItemFrame#536870935 using 1 FakeMap(s)
[09:52:28 INFO]: [YamipaPlugin] [FakeItemFrame] Created FakeItemFrame#536870936 using 1 FakeMap(s)
[09:52:28 INFO]: [YamipaPlugin] [FakeItemFrame] Created FakeItemFrame#536870937 using 1 FakeMap(s)
[09:52:28 INFO]: [YamipaPlugin] [FakeItemFrame] Created FakeItemFrame#536870938 using 1 FakeMap(s)
[09:52:28 INFO]: [YamipaPlugin] [FakeItemFrame] Created FakeItemFrame#536870939 using 1 FakeMap(s)
[09:52:28 INFO]: [YamipaPlugin] [FakeItemFrame] Created FakeItemFrame#536870940 using 1 FakeMap(s)
[09:52:28 INFO]: [YamipaPlugin] [FakeItemFrame] Created FakeItemFrame#536870941 using 1 FakeMap(s)
[09:52:28 INFO]: [YamipaPlugin] [FakeItemFrame] Created FakeItemFrame#536870942 using 1 FakeMap(s)
[09:52:28 INFO]: [YamipaPlugin] [FakeItemFrame] Created FakeItemFrame#536870943 using 1 FakeMap(s)
[09:52:28 INFO]: [YamipaPlugin] [FakeItemFrame] Created FakeItemFrame#536870944 using 1 FakeMap(s)
[09:52:28 INFO]: [YamipaPlugin] [FakeItemFrame] Created FakeItemFrame#536870945 using 1 FakeMap(s)
[09:52:28 INFO]: [YamipaPlugin] [FakeItemFrame] Created FakeItemFrame#536870946 using 1 FakeMap(s)
[09:52:28 INFO]: Muscle_p[/192.168.65.1:33384] logged in with entity id 437 at ([world]8.726941141604792, 79.47730211583617, 40.473193796568374)
[09:52:29 INFO]: [YamipaPlugin] [FakeMap] Granted sending pixels for FakeMap#2147483647 to Player#Muscle_p
[09:52:34 INFO]: Muscle_p lost connection: Disconnected
[09:52:34 INFO]: [YamipaPlugin] [FakeImage] Invalidated FakeImage#(Location{world=CraftWorld{name=world},x=8.0,y=80.0,z=45.0,pitch=0.0,yaw=0.0},NORTH)
[09:52:34 INFO]: [YamipaPlugin] [ImageFile] Invalidated cached maps "6-6" in ImageFile#(nimachi)
[09:52:34 INFO]: Muscle_p left the game

Is it possible to check the problem with Yamipa from this log?
It seems to me that there is no problem with Yamipa itself.

Do you know what ProtocolLib API is causing the image not to be displayed?

ProtocolLib still has an issue where MAP_CHUNK, SCOREBOARD_OBJECTIVE, and ENTITY_SOUND packets cannot be created.
Does this have anything to do with Yamipa?

@josemmo
Copy link
Owner

josemmo commented Jun 14, 2024

Yamipa cannot render images on 1.20.6 because ProtocolLib is having issues sending or crafting the packets for that. I don't know the internals enough to pinpoint exactly the cause inside ProtocolLib, but other plugins are having similar problems.

I see new progress has been made on ProtocolLib, whenever I find time I'll try to upgrade the plugin.

If you desperately need this to be fixed, then clone Yamipa's repository, decompile the Minecraft server, download the symbol mappings and get to it yourself.

@MusclePr
Copy link
Author

The following APIs appear to be missing in ProtocolLib 5.3.0.

com.comphenix.protocol.injector.player.PlayerInjectionHandler

  • Paper version 1.20.6-145-ver/1.20.6@fe7043e
  • ProtocolLib v5.3.0-SNAPSHOT-721
  • YamipaPlugin v1.3.2-SNAPSHOT-b2
2024-06-17 12:49:18 [init] Changing ownership of /data to 1000 ...
2024-06-17 12:49:19 [init] Running as uid=1000 gid=1000 with /data as 'drwxrwxrwx 1 0 0 8192 Jun 17 12:37 /data'
2024-06-17 12:49:19 [init] Resolving type given PAPER
2024-06-17 12:49:21 [mc-image-helper] 12:49:21.228 INFO  : Resolved paper to version 1.20.6 build 145
2024-06-17 12:49:22 [init] Copying any plugins from /plugins to /data/plugins
2024-06-17 12:49:23 [mc-image-helper] 12:49:23.624 INFO  : Created/updated 2 properties in /data/server.properties
2024-06-17 12:49:25 [init] Setting initial memory to 4G and max to 4G
2024-06-17 12:49:26 [init] Starting the Minecraft server...
2024-06-17 12:49:26 Starting org.bukkit.craftbukkit.Main
2024-06-17 12:49:27 System Info: Java 21 (OpenJDK 64-Bit Server VM 21.0.3+9-LTS) Host: Linux 6.6.26-linuxkit (amd64)
2024-06-17 12:49:27 Loading libraries, please wait...
2024-06-17 12:49:27 WARN StatusConsoleListener Advanced terminal features are not available in this environment
2024-06-17 12:49:29 [12:49:29 INFO]: Environment: Environment[sessionHost=https://sessionserver.mojang.com, servicesHost=https://api.minecraftservices.com, name=PROD]
2024-06-17 12:49:30 [12:49:30 INFO]: Loaded 1175 recipes
2024-06-17 12:49:30 [12:49:30 INFO]: Loaded 1276 advancements
2024-06-17 12:49:31 [12:49:31 INFO]: Starting minecraft server version 1.20.6
2024-06-17 12:49:31 [12:49:31 INFO]: Loading properties
2024-06-17 12:49:31 [12:49:31 INFO]: This server is running Paper version 1.20.6-145-ver/1.20.6@fe7043e (2024-06-15T21:16:04Z) (Implementing API version 1.20.6-R0.1-SNAPSHOT)
2024-06-17 12:49:31 [12:49:31 INFO]: Server Ping Player Sample Count: 12
2024-06-17 12:49:31 [12:49:31 INFO]: Using 4 threads for Netty based IO
2024-06-17 12:49:31 [12:49:31 WARN]: [!] The timings profiler has been enabled but has been scheduled for removal from Paper in the future.
2024-06-17 12:49:31     We recommend installing the spark profiler as a replacement: https://spark.lucko.me/
2024-06-17 12:49:31     For more information please visit: https://github.com/PaperMC/Paper/issues/8948
2024-06-17 12:49:31 [12:49:31 INFO]: [ChunkTaskScheduler] Chunk system is using 1 I/O threads, 6 worker threads, and gen parallelism of 6 threads
2024-06-17 12:49:32 [12:49:32 INFO]: Default game type: SURVIVAL
2024-06-17 12:49:32 [12:49:32 INFO]: Generating keypair
2024-06-17 12:49:32 [12:49:32 INFO]: Starting Minecraft server on *:25565
2024-06-17 12:49:32 [12:49:32 INFO]: Using epoll channel type
2024-06-17 12:49:32 [12:49:32 INFO]: Paper: Using libdeflate (Linux x86_64) compression from Velocity.
2024-06-17 12:49:32 [12:49:32 INFO]: Paper: Using OpenSSL 3.0.x (Linux x86_64) cipher from Velocity.
2024-06-17 12:49:32 [12:49:32 INFO]: [ProtocolLib] Loading server plugin ProtocolLib v5.3.0-SNAPSHOT
2024-06-17 12:49:32 [12:49:32 WARN]: [ProtocolLib] Version (MC: 1.20.6) has not yet been tested! Proceed with caution.
2024-06-17 12:49:32 [12:49:32 INFO]: [YamipaPlugin] Loading server plugin YamipaPlugin v1.3.2-SNAPSHOT-b2
2024-06-17 12:49:32 [12:49:32 INFO]: Server permissions file permissions.yml is empty, ignoring it
2024-06-17 12:49:32 [12:49:32 INFO]: [ProtocolLib] Enabling ProtocolLib v5.3.0-SNAPSHOT
2024-06-17 12:49:32 [12:49:32 INFO]: Preparing level "world"
2024-06-17 12:49:32 [12:49:32 INFO]: Preparing start region for dimension minecraft:overworld
2024-06-17 12:49:33 [12:49:33 INFO]: Time elapsed: 743 ms
2024-06-17 12:49:33 [12:49:33 INFO]: Preparing start region for dimension minecraft:the_nether
2024-06-17 12:49:34 [12:49:34 INFO]: Time elapsed: 438 ms
2024-06-17 12:49:34 [12:49:34 INFO]: Preparing start region for dimension minecraft:the_end
2024-06-17 12:49:34 [12:49:34 INFO]: Time elapsed: 338 ms
2024-06-17 12:49:34 [12:49:34 INFO]: [YamipaPlugin] Enabling YamipaPlugin v1.3.2-SNAPSHOT-b2
2024-06-17 12:49:34 [12:49:34 INFO]: [YamipaPlugin] Enabled image animation support
2024-06-17 12:49:34 [12:49:34 ERROR]: Error occurred while enabling YamipaPlugin v1.3.2-SNAPSHOT-b2 (Is it up to date?)
2024-06-17 12:49:34 java.lang.NoClassDefFoundError: com/comphenix/protocol/injector/player/PlayerInjectionHandler
2024-06-17 12:49:34 at YamipaPlugin-1.3.2-SNAPSHOT-b2.jar/io.josemmo.bukkit.plugin.renderer.FakeEntity.<clinit>(FakeEntity.java:26) ~[YamipaPlugin-1.3.2-SNAPSHOT-b2.jar:?]
2024-06-17 12:49:34 at YamipaPlugin-1.3.2-SNAPSHOT-b2.jar/io.josemmo.bukkit.plugin.renderer.ImageRenderer.loadConfig(ImageRenderer.java:144) ~[YamipaPlugin-1.3.2-SNAPSHOT-b2.jar:?]
2024-06-17 12:49:34 at YamipaPlugin-1.3.2-SNAPSHOT-b2.jar/io.josemmo.bukkit.plugin.renderer.ImageRenderer.start(ImageRenderer.java:72) ~[YamipaPlugin-1.3.2-SNAPSHOT-b2.jar:?]
2024-06-17 12:49:34 at YamipaPlugin-1.3.2-SNAPSHOT-b2.jar/io.josemmo.bukkit.plugin.YamipaPlugin.onEnable(YamipaPlugin.java:116) ~[YamipaPlugin-1.3.2-SNAPSHOT-b2.jar:?]
2024-06-17 12:49:34 at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:288) ~[paper-api-1.20.6-R0.1-SNAPSHOT.jar:?]
2024-06-17 12:49:34 at io.papermc.paper.plugin.manager.PaperPluginInstanceManager.enablePlugin(PaperPluginInstanceManager.java:202) ~[paper-1.20.6.jar:1.20.6-145-fe7043e]
2024-06-17 12:49:34 at io.papermc.paper.plugin.manager.PaperPluginManagerImpl.enablePlugin(PaperPluginManagerImpl.java:109) ~[paper-1.20.6.jar:1.20.6-145-fe7043e]
2024-06-17 12:49:34 at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:520) ~[paper-api-1.20.6-R0.1-SNAPSHOT.jar:?]
2024-06-17 12:49:34 at org.bukkit.craftbukkit.CraftServer.enablePlugin(CraftServer.java:626) ~[paper-1.20.6.jar:1.20.6-145-fe7043e]
2024-06-17 12:49:34 at org.bukkit.craftbukkit.CraftServer.enablePlugins(CraftServer.java:575) ~[paper-1.20.6.jar:1.20.6-145-fe7043e]
2024-06-17 12:49:34 at net.minecraft.server.MinecraftServer.loadWorld0(MinecraftServer.java:675) ~[paper-1.20.6.jar:1.20.6-145-fe7043e]
2024-06-17 12:49:34 at net.minecraft.server.MinecraftServer.loadLevel(MinecraftServer.java:437) ~[paper-1.20.6.jar:1.20.6-145-fe7043e]
2024-06-17 12:49:34 at net.minecraft.server.dedicated.DedicatedServer.initServer(DedicatedServer.java:323) ~[paper-1.20.6.jar:1.20.6-145-fe7043e]
2024-06-17 12:49:34 at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1136) ~[paper-1.20.6.jar:1.20.6-145-fe7043e]
2024-06-17 12:49:34 at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:323) ~[paper-1.20.6.jar:1.20.6-145-fe7043e]
2024-06-17 12:49:34 at java.base/java.lang.Thread.run(Unknown Source) ~[?:?]
2024-06-17 12:49:34 Caused by: java.lang.ClassNotFoundException: com.comphenix.protocol.injector.player.PlayerInjectionHandler
2024-06-17 12:49:34 at org.bukkit.plugin.java.PluginClassLoader.loadClass0(PluginClassLoader.java:197) ~[paper-api-1.20.6-R0.1-SNAPSHOT.jar:?]
2024-06-17 12:49:34 at org.bukkit.plugin.java.PluginClassLoader.loadClass(PluginClassLoader.java:164) ~[paper-api-1.20.6-R0.1-SNAPSHOT.jar:?]
2024-06-17 12:49:34 at java.base/java.lang.ClassLoader.loadClass(Unknown Source) ~[?:?]
2024-06-17 12:49:34 ... 16 more
2024-06-17 12:49:34 [12:49:34 INFO]: [YamipaPlugin] Disabling YamipaPlugin v1.3.2-SNAPSHOT-b2
2024-06-17 12:49:34 [12:49:34 INFO]: Starting remote control listener
2024-06-17 12:49:34 [12:49:34 INFO]: Thread RCON Listener started
2024-06-17 12:49:34 [12:49:34 INFO]: RCON running on 0.0.0.0:25575
2024-06-17 12:49:34 [12:49:34 INFO]: Running delayed init tasks
2024-06-17 12:49:34 [12:49:34 INFO]: Done (3.524s)! For help, type "help"
2024-06-17 12:49:34 [12:49:34 INFO]: Timings Reset

for more informations:
dmulloy2/ProtocolLib#2992

@Ingrim4
Copy link
Contributor

Ingrim4 commented Jun 17, 2024

That technically wasn't an API, it was internal code that a plugin shouldn't depend on because it's part of the injector. The plugin used reflections to even get access to the class because we don't expose it:

PLAYER_INJECTION_HANDLER = (PlayerInjectionHandler) field.get(CONNECTION);

This should however be an easy fix simply remove the code that tries to access PlayerInjectionHandler and only use the ProtocolManager to send packets

@MusclePr
Copy link
Author

MusclePr commented Jun 17, 2024

Thank you for answering.
And I'm sorry.
My comment had nothing to do with this issue.
The run passed successfully, except for the asynchronous calls.

@MusclePr
Copy link
Author

MusclePr commented Jun 18, 2024

@josemmo
This is a proposed fix for compatibility, If you keep PLAYER_INJECTION_HANDLER.
Because ClassNotFoundException cannot be catch (Exception e).

src/main/java/io/josemmo/bukkit/plugin/renderer/FakeEntity.java:

@@ -32,6 +32,8 @@ public abstract class FakeEntity {
             if (PLAYER_INJECTION_HANDLER == null) {
                 throw new RuntimeException("No valid candidate field found in ProtocolManager");
             }
+        } catch (NoClassDefFoundError e) {
+            LOGGER.severe("Failed to get PlayerInjectionHandler from ProtocolLib", e);
         } catch (Exception e) {
             LOGGER.severe("Failed to get PlayerInjectionHandler from ProtocolLib", e);
         }

wtlgo added a commit to wtlgo/yamipa that referenced this issue Jun 18, 2024
@wtlgo
Copy link

wtlgo commented Jun 18, 2024

I just tried to apply the proposed fix in #128. Now the plugin loads without errors, but images are still not visible in the game. Anyways, it's a progress.

@wtlgo
Copy link

wtlgo commented Jun 18, 2024

Found another issue.

NbtFactory.setItemTag(itemStack, itemStackNbt);

At this line, ProtocolLib throws an exception, which is not visible in the logs for some reason, but got caught by my debugger. I'm trying to figure out why it happens.

com.comphenix.protocol.reflect.FieldAccessException: Field index 0 is out of bounds for length 0
	at ProtocolLib.jar/com.comphenix.protocol.reflect.FieldAccessException.fromFormat(FieldAccessException.java:49) ~[ProtocolLib.jar:?]
	at ProtocolLib.jar/com.comphenix.protocol.reflect.StructureModifier.write(StructureModifier.java:318) ~[ProtocolLib.jar:?]
	at ProtocolLib.jar/com.comphenix.protocol.wrappers.nbt.NbtFactory.setItemTag(NbtFactory.java:154) ~[ProtocolLib.jar:?]
	at YamipaPlugin-1.3.2-SNAPSHOT-b2.jar/io.josemmo.bukkit.plugin.renderer.FakeItemFrame.getRenderPackets(FakeItemFrame.java:161) ~[YamipaPlugin-1.3.2-SNAPSHOT-b2.jar:?]
	at YamipaPlugin-1.3.2-SNAPSHOT-b2.jar/io.josemmo.bukkit.plugin.renderer.FakeImage.spawnOnceLoaded(FakeImage.java:454) ~[YamipaPlugin-1.3.2-SNAPSHOT-b2.jar:?]
	at YamipaPlugin-1.3.2-SNAPSHOT-b2.jar/io.josemmo.bukkit.plugin.renderer.FakeImage.lambda$spawn$13(FakeImage.java:438) ~[YamipaPlugin-1.3.2-SNAPSHOT-b2.jar:?]
	at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:572) ~[?:?]
	at java.base/java.util.concurrent.FutureTask.run$$$capture(FutureTask.java:317) ~[?:?]
	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java) ~[?:?]
	at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:304) ~[?:?]
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144) ~[?:?]
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642) ~[?:?]
	at java.base/java.lang.Thread.run(Thread.java:1570) ~[?:?]

@wtlgo
Copy link

wtlgo commented Jun 18, 2024

Same problem at

packets.add(maps[step].getPixelsPacket());

com.comphenix.protocol.reflect.FieldAccessException: Field index 0 is out of bounds for length 0
	at ProtocolLib.jar/com.comphenix.protocol.reflect.FieldAccessException.fromFormat(FieldAccessException.java:49) ~[ProtocolLib.jar:?]
	at ProtocolLib.jar/com.comphenix.protocol.reflect.StructureModifier.write(StructureModifier.java:315) ~[ProtocolLib.jar:?]
	at YamipaPlugin-1.3.2-SNAPSHOT-b2.jar/io.josemmo.bukkit.plugin.packets.MapDataPacket.setId(MapDataPacket.java:34) ~[YamipaPlugin-1.3.2-SNAPSHOT-b2.jar:?]
	at YamipaPlugin-1.3.2-SNAPSHOT-b2.jar/io.josemmo.bukkit.plugin.renderer.FakeMap.getPixelsPacket(FakeMap.java:152) ~[YamipaPlugin-1.3.2-SNAPSHOT-b2.jar:?]
	at YamipaPlugin-1.3.2-SNAPSHOT-b2.jar/io.josemmo.bukkit.plugin.renderer.FakeItemFrame.getRenderPackets(FakeItemFrame.java:154) ~[YamipaPlugin-1.3.2-SNAPSHOT-b2.jar:?]
	at YamipaPlugin-1.3.2-SNAPSHOT-b2.jar/io.josemmo.bukkit.plugin.renderer.FakeImage.spawnOnceLoaded(FakeImage.java:454) ~[YamipaPlugin-1.3.2-SNAPSHOT-b2.jar:?]
	at YamipaPlugin-1.3.2-SNAPSHOT-b2.jar/io.josemmo.bukkit.plugin.renderer.FakeImage.lambda$spawn$13(FakeImage.java:438) ~[YamipaPlugin-1.3.2-SNAPSHOT-b2.jar:?]
	at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:572) ~[?:?]
	at java.base/java.util.concurrent.FutureTask.run$$$capture(FutureTask.java:317) ~[?:?]
	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java) ~[?:?]
	at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:304) ~[?:?]
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144) ~[?:?]
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642) ~[?:?]
	at java.base/java.lang.Thread.run(Thread.java:1570) ~[?:?]

@josemmo
Copy link
Owner

josemmo commented Jun 18, 2024

Just to be clear: the main reason Yamipa is not rendering images in Minecraft 1.20.5+ is because of dmulloy2/ProtocolLib#3019.

Yes, the missing PLAYER_INJECTION_HANDLER class is also a bug introduced a few days ago with the reworking of some ProtocolLib internals and that needs to be fixed in Yamipa, but that's not why it wasn't working in the first place.

So for second time, please be patient until this gets fixed.

@wtlgo
Copy link

wtlgo commented Jun 18, 2024

Yeah, sorry, I was just trying to investigate what is going wrong to maybe help you out a little, I wasn't aware you already got to the root of the problem 😅

@MusclePr
Copy link
Author

Since it seems that it will take many many time to support ProtocolLib, I decided to try to support 1.20.6 and 1.21 using fork of Custom Images as a reference.

@RedstoneFuture
Copy link

RedstoneFuture commented Sep 22, 2024

The ProtocolLib team seems to be very busy and can't keep up with the fixes. I was recommended by developer friends to use PacketEvents or TinyProtocol/nms directly. ProtocolLib supposedly offers hardly any more advantages.

@Ingrim4
Copy link
Contributor

Ingrim4 commented Sep 22, 2024

I disagree while both ProtocolLib and PacketEvents address similar issues, their underlying mechanics are quite different. ProtocolLib acts as a wrapper around Mojang's game objects, while PacketEvents implements specific read/write methods for each packet across supported Minecraft versions.

One of PacketEvents' main advantages is its interoperability between server and client code, which is less critical for server-only plugins. However, because PacketEvents creates its own implementations of packets and wrapped objects, there's a higher risk of mismatches with what Mojang's client expects. In contrast, ProtocolLib uses the original Mojang packets, simply adding its own interface on top, minimizing compatibility issues.

Another key difference is that PacketEvents requires developers to manage threading carefully. Each packet is processed on the Netty thread it’s received or sent on, which can lead to errors if one listener blocks that thread. Since multiple connections share a single thread, a delay in one listener could impact multiple players. Their official example on thread safety illustrates another shortcoming: it clones a packet event object, and if the developer doesn’t clean up that clone, it can lead to memory leaks as Netty won’t release the underlying buffer. ProtocolLib's default API does not have this issue.

While PacketEvents allows for lower-level coding, it also increases the potential for bugs. This doesn't necessarily mean PacketEvents is a bad plugin; rather, switching between the two isn't straightforward and requires careful consideration of these differences.

@josemmo Have you maybe look into fixing the issue you're having with ProtocolLib yourself. I could also look into the issue but as far as I know NMS for items got removed in 1.21.

@josemmo
Copy link
Owner

josemmo commented Sep 25, 2024

The current blocker with ProtocolLib lies in the NbtFactory class and its item stack serializer:

// Create and attach filled map
ItemStack itemStack = MinecraftReflection.getBukkitItemStack(new ItemStack(Material.FILLED_MAP));
NbtCompound itemStackNbt = NbtFactory.ofCompound("tag");
itemStackNbt.put("map", maps[step].getId());
NbtFactory.setItemTag(itemStack, itemStackNbt);
// Build entity metadata packet
EntityMetadataPacket metadataPacket = new EntityMetadataPacket();
metadataPacket.setId(id)
.setInvisible(true)
.setItem(itemStack)
.setRotation(rotation)
.build();
packets.add(metadataPacket);

public @NotNull EntityMetadataPacket setItem(@NotNull ItemStack item) {
WrappedDataWatcher.Serializer serializer = WrappedDataWatcher.Registry.getItemStackSerializer(false);
if (USE_DATA_WATCHER) {
dataWatcher.setObject(new WrappedDataWatcher.WrappedDataWatcherObject(ITEM_INDEX, serializer), item);
} else {
values.add(new WrappedDataValue(
ITEM_INDEX,
serializer,
BukkitConverters.getItemStackConverter().getGeneric(item)
));
}
return this;
}

If someone manages to adapt these pieces of code to the latest versions of Minecraft using ProtocolLib, the next release of Yamipa becomes pretty straightforward.

@Ingrim4
Copy link
Contributor

Ingrim4 commented Sep 27, 2024

But why are you using reflections to set the map id? I just checked the implementation of ItemMetaMap and as far as I can tell it should fit your use case just fine.

1.16.5

        if (hasMapId()) {
            tag.setInt(MAP_ID.NBT, getMapId());
        }

1.20.5

        if (hasMapId()) {
            tag.put(MAP_ID, new MapId(getMapId()));
        }

Regarding the DataWatcher what exactly is the problem or do you have an open issue you can link to because I couldn't find one?

@josemmo
Copy link
Owner

josemmo commented Sep 28, 2024

Hello @Ingrim4,

I don't understand where should I put that code. Can you give more details or submit a PR fixing the issue?

@Ingrim4
Copy link
Contributor

Ingrim4 commented Sep 28, 2024

What I'm suggesting is to use the ItemMetaMap interface from bukkit to set the map id like so:

ItemStack map = new ItemStack(Material.FILLED_MAP);
ItemMetaMap mapMeta = (ItemMetaMap) map.getItemMeta();
mapMeta.setMapId(maps[step].getId());
map.setItemMeta(mapMeta);

@MusclePr
Copy link
Author

I solved it a few months ago, but I'm stuck on another part.
It seems that setArea() of the MapDataPacket class is not working correctly, but perhaps the field of PacketType.Play.Server.MAP has changed as well?

https://wiki.vg/Protocol#Map_Data

Is this information only for the latest version? Does it match?

@Ingrim4
Copy link
Contributor

Ingrim4 commented Oct 1, 2024

In the latest version map packet class is defined as follows:

public record ClientboundMapItemDataPacket(
	MapId mapId,
	byte scale,
	boolean locked,
	Optional<List<MapDecoration>> decorations,
	Optional<MapPatch> colorPatch
) implements Packet<ClientGamePacketListener> {

	public ClientboundMapItemDataPacket(
		MapId mapId,
		byte scale,
		boolean locked,
		@Nullable Collection<MapDecoration> decorations,
		@Nullable MapPatch colorPatch
	) {
		this(
			mapId,
			scale,
			locked,
			decorations != null ? Optional.of(List.copyOf(decorations)) : Optional.empty(),
			Optional.ofNullable(colorPatch)
		);
	}
}

public static record MapPatch(int startX, int startY, int width, int height, byte[] mapColors) {}

@CptGummiball
Copy link

On 1.21.1 (Spigot) the plugin doesn't start at all. Fortunately, images that have already been set are still retained.

josemmo added a commit that referenced this issue Oct 5, 2024
- Updated FakeItemFrame class

> Suggested by @Ingrim4 in #125
@josemmo
Copy link
Owner

josemmo commented Oct 5, 2024

Unfortunately, the more I debug this issue, the more I'm convinced there's little I can do without changing the code of ProtocolLib (which I'm not familiar enough with).

Here's where we're at:

  • Yamipa fully works in Minecraft 1.20.6 except for the PacketType.Play.Server.ENTITY_METADATA packet, which throws an exception during serialization
  • I see no issues with the PacketType.Play.Server.MAP or at least that's not the culprit of the crashes (btw, please don't post code from Mojang here)

This is the exception that is thrown at FakeItemFrame#getRenderPackets():

Unable to send packet PacketContainer[type=ENTITY_METADATA[class=ClientboundSetEntityDataPacket, id=88], structureModifier=StructureModifier[fieldType=class java.lang.Object, data=[com.comphenix.protocol.reflect.accessors.DefaultFieldAccessor@52ee9de9, com.comphenix.protocol.reflect.accessors.DefaultFieldAccessor@64897c2d]]] to josemmo
java.lang.IllegalStateException: Unable to invoke method public void net.minecraft.server.network.ServerCommonPacketListenerImpl.send(net.minecraft.network.protocol.Packet)
        at ProtocolLib-5.3.0-SNAPSHOT-732.jar/com.comphenix.protocol.reflect.accessors.DefaultMethodAccessor.invoke(DefaultMethodAccessor.java:25) ~[ProtocolLib-5.3.0-SNAPSHOT-732.jar:?]
        at ProtocolLib-5.3.0-SNAPSHOT-732.jar/com.comphenix.protocol.injector.netty.channel.PacketListenerInvoker.send(PacketListenerInvoker.java:201) ~[ProtocolLib-5.3.0-SNAPSHOT-732.jar:?]
        at ProtocolLib-5.3.0-SNAPSHOT-732.jar/com.comphenix.protocol.injector.netty.channel.NettyChannelInjector.sendClientboundPacket(NettyChannelInjector.java:274) ~[ProtocolLib-5.3.0-SNAPSHOT-732.jar:?]
        at YamipaPlugin.jar/io.josemmo.bukkit.plugin.renderer.FakeEntity.tryToSendPacket(FakeEntity.java:91) ~[YamipaPlugin.jar:?]
        at YamipaPlugin.jar/io.josemmo.bukkit.plugin.renderer.FakeEntity.tryToSendPackets(FakeEntity.java:108) ~[YamipaPlugin.jar:?]
        at YamipaPlugin.jar/io.josemmo.bukkit.plugin.renderer.FakeImage.nextStep(FakeImage.java:556) ~[YamipaPlugin.jar:?]
        at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:572) ~[?:?]
        at java.base/java.util.concurrent.FutureTask.runAndReset(FutureTask.java:358) ~[?:?]
        at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:305) ~[?:?]
        at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144) ~[?:?]
        at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642) ~[?:?]
        at java.base/java.lang.Thread.run(Thread.java:1583) ~[?:?]
Caused by: java.lang.ClassCastException: Cannot cast io.josemmo.bukkit.plugin.packets.EntityMetadataPacket to net.minecraft.network.protocol.Packet
        at java.base/java.lang.Class.cast(Class.java:4067) ~[?:?]
        at ProtocolLib-5.3.0-SNAPSHOT-732.jar/com.comphenix.protocol.reflect.accessors.DefaultMethodAccessor.invoke(DefaultMethodAccessor.java:23) ~[ProtocolLib-5.3.0-SNAPSHOT-732.jar:?]
        ... 11 more

Unless someone at ProtocolLib looks at this issue, the more feasible approach going forward is to migrate to PacketEvents as suggested by @RedstoneFuture.

@ampersandhd
Copy link

Will the Migration to PacketEvents include 1.21.x Support?

@Ingrim4
Copy link
Contributor

Ingrim4 commented Oct 6, 2024

That isn't a ProtocolLib issue your just calling an internal method of ProtocolLib with an invalid type (sendClientboundPacket expects the raw packet handle, also it's internal so maybe you shouldn't call it). The same error shouldn't be thrown for the official send method: CONNECTION.sendServerPacket(player, packet);.

@ampersandhd
Copy link

@Ingrim4 Could you provide a PR?

@josemmo
Copy link
Owner

josemmo commented Oct 6, 2024

Some points I'd like to clarify:

Yes, Yamipa uses an internal method of ProtocolLib. This is done for performance reasons, as rendering images takes a bunch of bandwidth and afaik ProtocolManager#sendServerPacket() is thread-blocking, which is not ideal as we need to send several packets to multiple players in the same area.

Let's not use the internal Injector#sendClientboundPacket() method, then. This patch will do it:

  protected static void tryToSendPacket(@NotNull Player player, @NotNull PacketContainer packet) {
      try {
+          CONNECTION.sendServerPacket(player, packet);
-          if (NETWORK_MANAGER_INJECTOR == null) { // Use single-threaded packet sending if reflection failed
-              CONNECTION.sendServerPacket(player, packet);
-          } else { // Use non-blocking packet sending if available (faster, the expected case)
-              NETWORK_MANAGER_INJECTOR.getInjector(player).sendClientboundPacket(packet, null, false);
-          }
      } catch (IllegalStateException e) {
          // Server is shutting down and cannot send the packet, ignore
      } catch (Exception e) {
          LOGGER.severe("Failed to send FakeEntity packet", e);
      }
  }

Well, even after that, Yamipa is still not rendering the images. To make matters worse, there seems to be an issue with multithreading, as some packets fail to be sent correctly without throwing an exception. For instance, this test world should have item frames covering all iron blocks (but there are seemingly random gaps):

2024-10-06_15 23 17

In conclusion: I have no idea why this doesn't work in the latest versions of Minecraft. I'm pretty sure it has something to do with ProtocolLib, though I'd love to be proven wrong because that would mean someone finally found a fix for this issue.

@Ingrim4 Ingrim4 mentioned this issue Oct 6, 2024
3 tasks
@Ingrim4
Copy link
Contributor

Ingrim4 commented Oct 6, 2024

The PR #137 is done, and no changes to ProtocolLib were necessary. The only issue I encountered with ProtocolLib is that Optional<T> is always initialized as Optional.of(new Object()) when using writeDefaults() disregarding the correct type. This seems like something that ProtocolLib may want to address.

@ampersandhd
Copy link

The PR #137 is done, and no changes to ProtocolLib were necessary. The only issue I encountered with ProtocolLib is that Optional<T> is always initialized as Optional.of(new Object()) when using writeDefaults() disregarding the correct type. This seems like something that ProtocolLib may want to address.

[17:06:39] [Server thread/INFO]: [YamipaPlugin] Enabling YamipaPlugin v1.3.2-SNAPSHOT-b2 [17:06:39] [Server thread/ERROR]: Error occurred while enabling YamipaPlugin v1.3.2-SNAPSHOT-b2 (Is it up to date?) java.lang.ExceptionInInitializerError: null at YamipaPlugin-1.3.2-SNAPSHOT-b2.jar/io.josemmo.bukkit.plugin.commands.ImageCommandBridge.register(ImageCommandBridge.java:29) ~[YamipaPlugin-1.3.2-SNAPSHOT-b2.jar:?] at YamipaPlugin-1.3.2-SNAPSHOT-b2.jar/io.josemmo.bukkit.plugin.YamipaPlugin.onEnable(YamipaPlugin.java:90) ~[YamipaPlugin-1.3.2-SNAPSHOT-b2.jar:?] at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:288) ~[paper-api-1.21-R0.1-SNAPSHOT.jar:?] at io.papermc.paper.plugin.manager.PaperPluginInstanceManager.enablePlugin(PaperPluginInstanceManager.java:202) ~[paper-1.21.jar:1.21-39-aa8d38d] at io.papermc.paper.plugin.manager.PaperPluginManagerImpl.enablePlugin(PaperPluginManagerImpl.java:109) ~[paper-1.21.jar:1.21-39-aa8d38d] at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:520) ~[paper-api-1.21-R0.1-SNAPSHOT.jar:?] at org.bukkit.craftbukkit.CraftServer.enablePlugin(CraftServer.java:629) ~[paper-1.21.jar:1.21-39-aa8d38d] at org.bukkit.craftbukkit.CraftServer.enablePlugins(CraftServer.java:578) ~[paper-1.21.jar:1.21-39-aa8d38d] at net.minecraft.server.MinecraftServer.loadWorld0(MinecraftServer.java:690) ~[paper-1.21.jar:1.21-39-aa8d38d] at net.minecraft.server.MinecraftServer.loadLevel(MinecraftServer.java:452) ~[paper-1.21.jar:1.21-39-aa8d38d] at net.minecraft.server.dedicated.DedicatedServer.initServer(DedicatedServer.java:327) ~[paper-1.21.jar:1.21-39-aa8d38d] at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1157) ~[paper-1.21.jar:1.21-39-aa8d38d] at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:329) ~[paper-1.21.jar:1.21-39-aa8d38d] at java.base/java.lang.Thread.run(Unknown Source) ~[?:?] Caused by: java.lang.RuntimeException: Failed to get internal classes due to incompatible Minecraft server at YamipaPlugin-1.3.2-SNAPSHOT-b2.jar/io.josemmo.bukkit.plugin.utils.Internals.<clinit>(Internals.java:53) ~[YamipaPlugin-1.3.2-SNAPSHOT-b2.jar:?] ... 14 more Caused by: java.lang.RuntimeException: Failed to find NMS class: commands.CommandDispatcher at ProtocolLib (4).jar/com.comphenix.protocol.utility.MinecraftReflection.lambda$getMinecraftClass$4(MinecraftReflection.java:1507) ~[ProtocolLib (4).jar:?] at java.base/java.util.Optional.orElseThrow(Unknown Source) ~[?:?] at ProtocolLib (4).jar/com.comphenix.protocol.utility.MinecraftReflection.getMinecraftClass(MinecraftReflection.java:1507) ~[ProtocolLib (4).jar:?] at YamipaPlugin-1.3.2-SNAPSHOT-b2.jar/io.josemmo.bukkit.plugin.utils.Internals.<clinit>(Internals.java:38) ~[YamipaPlugin-1.3.2-SNAPSHOT-b2.jar:?] ... 14 more [17:06:39] [Server thread/INFO]: [YamipaPlugin] Disabling YamipaPlugin v1.3.2-SNAPSHOT-b2

Which Version of ProtocolLib did you use?

@Ingrim4
Copy link
Contributor

Ingrim4 commented Oct 6, 2024

Fixed, forgot that paper now has mojang class mappings all the time. ProtocolLib = latest dev build

@ampersandhd
Copy link

Fixed, forgot that paper now has mojang class mappings all the time. ProtocolLib = latest dev build

Plugin is now starting but pictures are invisible.

@Ingrim4
Copy link
Contributor

Ingrim4 commented Oct 7, 2024

I just tried it with paper 1.21, spigot 1.20.4 and 1.21 and it works perfectly fine for me. Are you sure you build the latest commit from my fork and are you using the latest dev build of ProtocolLib?
javaw_wIVNt0csJy

@MusclePr
Copy link
Author

MusclePr commented Oct 9, 2024

I have confirmed that it works properly with PR #137.
Thank you very much.

Confirmation procedure

  1. checkout PR137
git remote add Ingrim4 https://github.com/Ingrim4/yamipa.git
git fetch Ingrim4 feat/support-1.21
git switch feat/support-1.21
  1. build
mvn package
  1. make test/compose.yml (first time only)
services:
  mc:
    image: itzg/minecraft-server:latest
    container_name: ${TEST_CONTAINER:-test}
    environment:
      TZ: "${TZ:-Asia/Tokyo}"
      EULA: "true"
      TYPE: "${TEST_TYPE:-paper}"
      VERSION: "${TEST_VERSION:-1.21.1}"
      MODE: "creative"
      FORCE_GAMEMODE: "true"
      MODRINTH_PROJECTS: "viaversion,viabackwards"
      MODS: "https://ci.dmulloy2.net/job/ProtocolLib/lastSuccessfulBuild/artifact/build/libs/ProtocolLib.jar"
      RCON_CMDS_STARTUP: |-
        ${TEST_OPERATOR:-op Muscle_p}
    ports:
      - "${TEST_PORT:-25565}:25565"
    volumes:
      - ./data-${TEST_TYPE:-paper}-${TEST_VERSION:-1.21.1}:/data
      - ./plugins:/plugins:ro
  1. make test/.env (If you need a custom variation)
TEST_CONTAINER=test
TEST_PORT=25565
TEST_VERSION="1.20.6"
TEST_TYPE="spigot"
TEST_OPERATOR="op <your MCID>"
  1. start test server
cd test
cp ../target/YamipaPlugin-1.3.2-SNAPSHOT-b2.jar plugins/Yamipa.jar
docker compose up
  1. test manually
  • launch minecraft client
  • connect to localhost:25565
  • input /yamipa commands
  1. down test server
docker compose down

@ampersandhd
Copy link

Can approve working PR #137.
Thank you, too @Ingrim4

Tested with
Paper 1.21-126
ProtocolLib 5.3.0 Snapshot 732

Can't wait for the release :)
@josemmo

@josemmo
Copy link
Owner

josemmo commented Oct 9, 2024

Thanks @Ingrim4 for all your work! 👏👏

Will try to find some time this weekend to draft a new release.

@josemmo
Copy link
Owner

josemmo commented Oct 13, 2024

The wait is finally over, Yamipa v1.3.2 is out! 🥳🎉

Thanks to everyone who worked on this, especially @Ingrim4!

@josemmo josemmo closed this as completed Oct 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: confirmed This issue has been confirmed and waiting for a resolution type: feature New feature or request
Projects
None yet
Development

No branches or pull requests

10 participants