Add RenderType enum wrapper
This commit is contained in:
parent
c933e817de
commit
4c878facbe
|
@ -867,6 +867,17 @@ public abstract class AbstractStructure {
|
||||||
EnumWrappers.getDisplaySlotConverter());
|
EnumWrappers.getDisplaySlotConverter());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieve a read/write structure for the RenderType enum.
|
||||||
|
* @return A modifier for RenderType enum fields.
|
||||||
|
*/
|
||||||
|
public StructureModifier<EnumWrappers.RenderType> getRenderTypes() {
|
||||||
|
return structureModifier.withType(
|
||||||
|
EnumWrappers.getRenderTypeClass(),
|
||||||
|
EnumWrappers.getRenderTypeConverter());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieve a read/write structure for the MinecraftKey class.
|
* Retrieve a read/write structure for the MinecraftKey class.
|
||||||
* @return A modifier for MinecraftKey fields.
|
* @return A modifier for MinecraftKey fields.
|
||||||
|
|
|
@ -485,6 +485,11 @@ public abstract class EnumWrappers {
|
||||||
TEAM_WHITE;
|
TEAM_WHITE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public enum RenderType {
|
||||||
|
INTEGER,
|
||||||
|
HEARTS
|
||||||
|
}
|
||||||
|
|
||||||
private static Class<?> PROTOCOL_CLASS = null;
|
private static Class<?> PROTOCOL_CLASS = null;
|
||||||
private static Class<?> CLIENT_COMMAND_CLASS = null;
|
private static Class<?> CLIENT_COMMAND_CLASS = null;
|
||||||
private static Class<?> CHAT_VISIBILITY_CLASS = null;
|
private static Class<?> CHAT_VISIBILITY_CLASS = null;
|
||||||
|
@ -507,6 +512,7 @@ public abstract class EnumWrappers {
|
||||||
private static Class<?> CHAT_TYPE_CLASS = null;
|
private static Class<?> CHAT_TYPE_CLASS = null;
|
||||||
private static Class<?> ENTITY_POSE_CLASS = null;
|
private static Class<?> ENTITY_POSE_CLASS = null;
|
||||||
private static Class<?> DISPLAY_SLOT_CLASS = null;
|
private static Class<?> DISPLAY_SLOT_CLASS = null;
|
||||||
|
private static Class<?> RENDER_TYPE_CLASS = null;
|
||||||
|
|
||||||
private static boolean INITIALIZED = false;
|
private static boolean INITIALIZED = false;
|
||||||
private static Map<Class<?>, EquivalentConverter<?>> FROM_NATIVE = new HashMap<>();
|
private static Map<Class<?>, EquivalentConverter<?>> FROM_NATIVE = new HashMap<>();
|
||||||
|
@ -591,6 +597,7 @@ public abstract class EnumWrappers {
|
||||||
CHAT_TYPE_CLASS = getEnum(PacketType.Play.Server.CHAT.getPacketClass(), 0);
|
CHAT_TYPE_CLASS = getEnum(PacketType.Play.Server.CHAT.getPacketClass(), 0);
|
||||||
ENTITY_POSE_CLASS = MinecraftReflection.getNullableNMS("world.entity.EntityPose", "world.entity.Pose", "EntityPose");
|
ENTITY_POSE_CLASS = MinecraftReflection.getNullableNMS("world.entity.EntityPose", "world.entity.Pose", "EntityPose");
|
||||||
DISPLAY_SLOT_CLASS = MinecraftReflection.getNullableNMS("world.scores.DisplaySlot");
|
DISPLAY_SLOT_CLASS = MinecraftReflection.getNullableNMS("world.scores.DisplaySlot");
|
||||||
|
RENDER_TYPE_CLASS = MinecraftReflection.getNullableNMS("world.scores.criteria.IScoreboardCriteria$EnumScoreboardHealthDisplay", "IScoreboardCriteria$EnumScoreboardHealthDisplay");
|
||||||
|
|
||||||
associate(PROTOCOL_CLASS, Protocol.class, getProtocolConverter());
|
associate(PROTOCOL_CLASS, Protocol.class, getProtocolConverter());
|
||||||
associate(CLIENT_COMMAND_CLASS, ClientCommand.class, getClientCommandConverter());
|
associate(CLIENT_COMMAND_CLASS, ClientCommand.class, getClientCommandConverter());
|
||||||
|
@ -768,6 +775,11 @@ public abstract class EnumWrappers {
|
||||||
return DISPLAY_SLOT_CLASS;
|
return DISPLAY_SLOT_CLASS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static Class<?> getRenderTypeClass() {
|
||||||
|
initialize();
|
||||||
|
return RENDER_TYPE_CLASS;
|
||||||
|
}
|
||||||
|
|
||||||
// Get the converters
|
// Get the converters
|
||||||
public static EquivalentConverter<Protocol> getProtocolConverter() {
|
public static EquivalentConverter<Protocol> getProtocolConverter() {
|
||||||
return new EnumConverter<>(getProtocolClass(), Protocol.class);
|
return new EnumConverter<>(getProtocolClass(), Protocol.class);
|
||||||
|
@ -853,6 +865,10 @@ public abstract class EnumWrappers {
|
||||||
return new EnumConverter<>(getDisplaySlotClass(), DisplaySlot.class);
|
return new EnumConverter<>(getDisplaySlotClass(), DisplaySlot.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static EquivalentConverter<RenderType> getRenderTypeConverter() {
|
||||||
|
return new EnumConverter<>(getRenderTypeClass(), RenderType.class);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @since 1.13+
|
* @since 1.13+
|
||||||
* @return {@link EnumConverter} or null (if bellow 1.13 / nms EnumPose class cannot be found)
|
* @return {@link EnumConverter} or null (if bellow 1.13 / nms EnumPose class cannot be found)
|
||||||
|
|
Loading…
Reference in New Issue