ProtocolLib

3M Downloads

MOJANG MAPPINGS SUPPORT

DoubleNico opened this issue ยท 1 comments

commented

So my feature request is because I found a problem with paper, or any other spigot fork that has mojang mappings.So the mojang mappings change the name of many many many classes, so is always a problem while getting a reflection class:
com.comphenix.protocol.reflect.FieldAccessException: No field with type net.minecraft.network.chat.IChatBaseComponent exists in class PacketPlayOutBoss., the class exists in obj minecraft code, but with mojang mappings it exists as Component, in net.minecraft.network.chat

public static Class<?> getComponentMappingClass() { try { return getMinecraftClass("network.chat.Component", "Component"); } catch (RuntimeException var1) { return setMinecraftClass("Component", Accessors.getMethodAccessor(getCraftChatMessage(), "fromString", new Class[]{String.class}).getMethod().getReturnType().getComponentType()); } }

commented

So what exactly is your feature request? ProtocolLib 4.7 already supports Mojang mappings. If you need the IChatbaseComponent class, you could use

public static Class<?> getIChatBaseComponentClass() {

and then use FuzzyReflection for finding the field with a specific class type.