Class Util
java.lang.Object
me.andreasmelone.glowingeyes.common.util.Util
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic <MAP extends Map<K,V>, K extends Serializable, V extends Serializable>
MAPdeserializeMap(byte[] serializedMap) Deserialize a map from a byte arraystatic floatround(float value) static floatround(float value, int places) static StringsanitizeForId(String name) static <K extends Serializable,V extends Serializable>
byte[]serializeMap(Map<K, V> map) Serialize a map to a byte arraystatic <K,V> net.minecraft.nbt.CompoundTag toCompoundTag(com.mojang.serialization.Codec<K> codecK, com.mojang.serialization.Codec<V> codecV, Map<K, V> map) static <K,V> Map<K, V> toMap(com.mojang.serialization.Codec<K> codecK, com.mojang.serialization.Codec<V> codecV, net.minecraft.nbt.CompoundTag tag)
-
Constructor Details
-
Util
public Util()
-
-
Method Details
-
serializeMap
Serialize a map to a byte array- Type Parameters:
K- the key type of the map, has to be serializableV- the value type of the map, has to be serializable- Parameters:
map- the map to serialize- Returns:
- the byte array containing the serialized map, in case of an error an empty byte array
-
deserializeMap
public static <MAP extends Map<K,V>, MAP deserializeMapK extends Serializable, V extends Serializable> (byte[] serializedMap) Deserialize a map from a byte array- Type Parameters:
MAP- the type of the map, including K and VK- the key type of the map, has to be serializableV- the value type of the map, has to be serializable- Parameters:
serializedMap- the byte array containing the serialized map- Returns:
- the deserialized map, in case of an error null, please make sure to handle properly
-
toCompoundTag
public static <K,V> net.minecraft.nbt.CompoundTag toCompoundTag(com.mojang.serialization.Codec<K> codecK, com.mojang.serialization.Codec<V> codecV, Map<K, V> map) -
toMap
public static <K,V> Map<K,V> toMap(com.mojang.serialization.Codec<K> codecK, com.mojang.serialization.Codec<V> codecV, net.minecraft.nbt.CompoundTag tag) -
round
public static float round(float value, int places) -
round
public static float round(float value) -
sanitizeForId
-