mirror of
https://github.com/dmulloy2/ProtocolLib.git
synced 2025-01-09 01:47:55 +01:00
AttributeModifier$Operation only to be fetched if viable (#773)
This commit is contained in:
parent
7a4a285935
commit
4baa4aa724
@ -22,9 +22,9 @@ import com.google.common.base.Preconditions;
|
|||||||
* @author Kristian
|
* @author Kristian
|
||||||
*/
|
*/
|
||||||
public class WrappedAttributeModifier extends AbstractWrapper {
|
public class WrappedAttributeModifier extends AbstractWrapper {
|
||||||
private static final Class<?> OPERATION_CLASS = MinecraftReflection.getMinecraftClass("AttributeModifier$Operation");
|
|
||||||
private static final boolean OPERATION_ENUM = MinecraftVersion.atOrAbove(MinecraftVersion.VILLAGE_UPDATE);
|
private static final boolean OPERATION_ENUM = MinecraftVersion.atOrAbove(MinecraftVersion.VILLAGE_UPDATE);
|
||||||
private static final EquivalentConverter<Operation> OPERATION_CONVERTER = new IndexedEnumConverter<>(Operation.class, OPERATION_CLASS);
|
private static final Class<?> OPERATION_CLASS;
|
||||||
|
private static final EquivalentConverter<Operation> OPERATION_CONVERTER;
|
||||||
|
|
||||||
private static class IndexedEnumConverter<T extends Enum<T>> implements EquivalentConverter<T> {
|
private static class IndexedEnumConverter<T extends Enum<T>> implements EquivalentConverter<T> {
|
||||||
private Class<T> specificClass;
|
private Class<T> specificClass;
|
||||||
@ -65,6 +65,11 @@ public class WrappedAttributeModifier extends AbstractWrapper {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static {
|
||||||
|
OPERATION_CLASS = OPERATION_ENUM ? MinecraftReflection.getMinecraftClass("AttributeModifier$Operation") : null;
|
||||||
|
OPERATION_CONVERTER = OPERATION_ENUM ? new IndexedEnumConverter<>(Operation.class, OPERATION_CLASS) : null;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents the different modifier operations.
|
* Represents the different modifier operations.
|
||||||
* <p>
|
* <p>
|
||||||
|
Loading…
Reference in New Issue
Block a user