public class CommonHelper
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static int[] |
bitFilters |
Constructor and Description |
---|
CommonHelper() |
Modifier and Type | Method and Description |
---|---|
static <K,V> java.util.Map<K,V> |
addEntries(java.util.Map<K,V> map,
K[] keys,
V[] vals) |
static <K,V> java.util.Map<K,V> |
addEntries(java.util.Map<K,V> map,
java.lang.Object[] kvs)
adds entries for every 2 objects in
kvs . |
static byte[] |
decodeInteger(int encoded,
int size)
Decodes an integer into an array of small numbers
|
static boolean |
disableLogMessage(java.lang.Class<?> clazz,
java.lang.String regex) |
static int |
encodeInteger(byte[] toEncode,
int size)
Encodes an array of small numbers into an integer.
|
static void |
ensureIndex(java.util.List<?> a,
int i)
ensures that
ArrayList a can call set(i, Object) |
static <V> V |
getIgnoreCase(java.util.Map<java.lang.String,V> map,
java.lang.String key) |
static java.util.ArrayList<net.minecraft.nbt.INBT> |
getList(net.minecraft.nbt.ListNBT nbt) |
static <E> java.util.Map<java.lang.String,E> |
getMap(net.minecraft.nbt.CompoundNBT nbt) |
static int |
indexOfAbsoluteMax(java.lang.Object array) |
static <T> void |
insert(java.util.ArrayList<T> a,
T value)
Sets the index of the first null element in
a to value , or adds
value to the end of a if none of the elements are null. |
static <T> T |
set(java.util.ArrayList<T> a,
T value,
int index) |
static java.lang.String |
textInQuotes(java.lang.String str) |
static java.lang.Object[] |
wrapperArray(java.lang.Object aprimitive) |
public static void ensureIndex(java.util.List<?> a, int i)
ArrayList
a
can call set(i, Object)
a
- i
- public static <T> T set(java.util.ArrayList<T> a, T value, int index)
public static <T> void insert(java.util.ArrayList<T> a, T value)
a
to value
, or adds
value
to the end of a
if none of the elements are null.a
- value
- public static <E> java.util.Map<java.lang.String,E> getMap(net.minecraft.nbt.CompoundNBT nbt)
public static java.util.ArrayList<net.minecraft.nbt.INBT> getList(net.minecraft.nbt.ListNBT nbt)
public static int indexOfAbsoluteMax(java.lang.Object array) throws java.lang.ClassCastException
array
- - An Array of either Number primitives, or actual Number objectsjava.lang.ClassCastException
- if you fail at reading javadocspublic static java.lang.Object[] wrapperArray(java.lang.Object aprimitive)
public static <K,V> java.util.Map<K,V> addEntries(java.util.Map<K,V> map, K[] keys, V[] vals)
public static <K,V> java.util.Map<K,V> addEntries(java.util.Map<K,V> map, java.lang.Object[] kvs)
kvs
.public static <V> V getIgnoreCase(java.util.Map<java.lang.String,V> map, java.lang.String key)
public static java.lang.String textInQuotes(java.lang.String str)
public static byte[] decodeInteger(int encoded, int size)
encoded
- The integer created from the #encodeInteger methodsize
- The bitwidth per smaller number. The maximum size for the smaller inclusions is equal to 2^size. Note: this method only supports sizes from 1-8 inclusive.public static int encodeInteger(byte[] toEncode, int size)
toEncode
- The array to encodesize
- The bitwidth of each small number. The maximum value for each smaller value is equal top 2^size. Numbers larger than this will have additional bits discarded.public static boolean disableLogMessage(java.lang.Class<?> clazz, java.lang.String regex)