ProtocolLib

3M Downloads

Add wrappers for metadata types: CatVariant, FrogVariant, PaintingVariant

MelonHell opened this issue ยท 2 comments

commented
  • This feature is not currently present in a development build

Is your feature request related to a problem? Please describe.
At the moment it is not possible to change the type of cat, frog, painting without using NMS

Describe the solution you'd like
Add CatVariantWrapper, FrogVariantWrapper, PaintingVariantWrapper

Describe alternatives you've considered
Using NMS like here

WrappedDataWatcher.Serializer serializer = WrappedDataWatcher.Registry.get(CatVariant.class, false);
WrappedDataWatcher.WrappedDataWatcherObject wrappedDataWatcherObject = new WrappedDataWatcher.WrappedDataWatcherObject(19, serializer);
WrappedWatchableObject wrappedWatchableObject = new WrappedWatchableObject(wrappedDataWatcherObject, CatVariant.WHITE);

Additional context
wiki.vg info:

commented

There are no enum wrappers for that as these values are registered in registries. To get them you can use something like:

    Class<?> catVariantClass = MinecraftReflection.getMinecraftClass("world.entity.animal.CatVariant");
    WrappedRegistry registry = WrappedRegistry.getRegistry(catVariantClass);
    Object catVariantWhite = registry.get(new MinecraftKey("white"));

Note that there is no need to get a value from a registry twice as (in that case) they are frozen since the startup.

commented

There are no enum wrappers for that as these values are registered in registries. To get them you can use something like:

    Class<?> catVariantClass = MinecraftReflection.getMinecraftClass("world.entity.animal.CatVariant");
    WrappedRegistry registry = WrappedRegistry.getRegistry(catVariantClass);
    Object catVariantWhite = registry.get(new MinecraftKey("white"));

Note that there is no need to get a value from a registry twice as (in that case) they are frozen since the startup.

Thanks for the advice, I'll take it.

would still like to see it in some form in the ProtocolLib