[BUG] Fake Item Display Vanishes when Applying Translation and Scale Vector
Dearliet opened this issue ยท 2 comments
When attempting to spawn a fake item display using ProtocolLib, applying the translation and scale vector causes the itemstack of the display entity to vanish.
Steps to Reproduce:
- Install the following dependencies:
<dependency>
<groupId>io.papermc.paper</groupId>
<artifactId>paper-api</artifactId>
<version>1.20.1-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.comphenix.protocol</groupId>
<artifactId>ProtocolLib</artifactId>
<version>5.0.0</version>
<scope>provided</scope>
</dependency>
- Copy and paste this code snippet which is responsible for spawning the fake item display with the help of the two packet wrapper classes,
WrapperPlayServerEntityMetadata
andWrapperPlayServerSpawnEntity
.
Not a bug, someone helped me find a solution.
All you have to do is utilize theorg.joml.Vector3f
class for serialization instead of using getVectorSerializer()
:
val vectorSerializer = WrappedDataWatcher.Registry.get(Vector3f::class.javaObjectType)
val translation = WrappedDataWatcher.WrappedDataWatcherObject(10, vectorSerializer)
val scale = WrappedDataWatcher.WrappedDataWatcherObject(11, vectorSerializer)
val watcher = WrappedDataWatcher()
watcher.setObject(translation, Vector3f(0f, 0f, 0f))
watcher.setObject(scale, Vector3f(1f, 1f, 1f))
Not a solution, Vector3F should be able to be used alongside the VectorSerializer. @dmulloy2
Bumping against this as well with error:
java.lang.ClassCastException: class com.comphenix.protocol.wrappers.Vector3F cannot be cast to class net.minecraft.core.Vector3f (com.comphenix.protocol.wrappers.Vector3F is in unnamed module of loader 'ProtocolLib (6).jar' @587bf368; net.minecraft.core.Vector3f is in unnamed module of loader java.net.URLClassLoader @759ebb3d)
Yes changing it to minecraft vector3f would work, but thats not what is correct I suppose?