Package alexiil.mc.lib.net
Class NetKeyMapper<T>
java.lang.Object
alexiil.mc.lib.net.NetKeyMapper<T>
- Direct Known Subclasses:
NetKeyMapper.OfEnum,NetKeyMapper.ToString
public abstract class NetKeyMapper<T>
extends java.lang.Object
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classNetKeyMapper.OfEnum<E extends java.lang.Enum<E>>static classNetKeyMapper.ToString<T> -
Field Summary
Fields Modifier and Type Field Description java.lang.Class<T>clazzintlengthThe known length in bytes of this key, orLENGTH_DYNAMICif this isn't a constant.static intLENGTH_DYNAMIC -
Constructor Summary
Constructors Constructor Description NetKeyMapper(java.lang.Class<T> clazz)NetKeyMapper(java.lang.Class<T> clazz, int length) -
Method Summary
Modifier and Type Method Description abstract Tread(NetByteBuf buffer, IMsgReadCtx ctx)Reads the value for the key from the buffer, optionally using the parent keys.abstract voidwrite(NetByteBuf buffer, IMsgWriteCtx ctx, T value)
-
Field Details
-
LENGTH_DYNAMIC
public static final int LENGTH_DYNAMIC- See Also:
- Constant Field Values
-
clazz
-
length
public final int lengthThe known length in bytes of this key, orLENGTH_DYNAMICif this isn't a constant.
-
-
Constructor Details
-
Method Details
-
read
Reads the value for the key from the buffer, optionally using the parent keys.Note that any of the parent keys might be null if they failed to read!
- Returns:
- null if the key couldn't be found in whatever context this requires.
- Throws:
InvalidInputDataException
-
write
-