Package alexiil.mc.lib.net
Class ParentNetIdSingle<T>
java.lang.Object
alexiil.mc.lib.net.TreeNetIdBase
alexiil.mc.lib.net.ParentNetIdBase
alexiil.mc.lib.net.ParentNetIdSingle<T>
- Type Parameters:
T
- The type of object that will be written and read. This must not have any generic type parameters itself: as it must be representable with aClass
.
- Direct Known Subclasses:
DynamicNetId
,ParentNetIdDuel
public abstract class ParentNetIdSingle<T> extends ParentNetIdBase
A
parent node
that writes out the context for the receiver to obtain the same object.-
Field Summary
Fields Modifier and Type Field Description java.lang.Class<T>
clazz
The type of the object to be written and read.Fields inherited from class alexiil.mc.lib.net.TreeNetIdBase
DYNAMIC_LENGTH, fullName, length, name, parent, totalLength
-
Constructor Summary
Constructors Constructor Description ParentNetIdSingle(ParentNetId parent, java.lang.Class<T> clazz, java.lang.String name, int thisLength)
-
Method Summary
Modifier and Type Method Description ParentNetIdSingle<T>
child(java.lang.String name)
<U> ParentNetIdExtractor<T,U>
extractor(java.lang.Class<U> targetClass, java.lang.String subName, java.util.function.Function<U,T> forward, java.util.function.Function<T,U> backward)
protected java.lang.String
getPrintableName()
NetIdDataK<T>
idData(java.lang.String name)
NetIdDataK<T>
idData(java.lang.String name, int dataLength)
NetIdSignalK<T>
idSignal(java.lang.String name)
protected abstract T
readContext(NetByteBuf buffer, IMsgReadCtx ctx)
T
readKey(CheckingNetByteBuf buffer, IMsgReadCtx ctx)
<U extends T>
ParentNetIdCast<T,U>subType(java.lang.Class<U> subClass, java.lang.String subName)
protected abstract void
writeContext(NetByteBuf buffer, IMsgWriteCtx ctx, T value)
protected void
writeDynamicContext(CheckingNetByteBuf buffer, IMsgWriteCtx ctx, T value, java.util.List<TreeNetIdBase> resolvedPath)
void
writeKey(CheckingNetByteBuf buffer, IMsgWriteCtx ctx, T value)
Methods inherited from class alexiil.mc.lib.net.TreeNetIdBase
equals, getRealClassName, hasFixedLength, hashCode, toString
-
Field Details
-
clazz
The type of the object to be written and read.
-
-
Constructor Details
-
ParentNetIdSingle
public ParentNetIdSingle(ParentNetId parent, java.lang.Class<T> clazz, java.lang.String name, int thisLength)- Parameters:
clazz
- The type of the object to be written and read.
-
-
Method Details
-
getPrintableName
protected java.lang.String getPrintableName()- Overrides:
getPrintableName
in classTreeNetIdBase
-
idData
-
idData
-
idSignal
-
subType
public <U extends T> ParentNetIdCast<T,U> subType(java.lang.Class<U> subClass, java.lang.String subName) -
extractor
public <U> ParentNetIdExtractor<T,U> extractor(java.lang.Class<U> targetClass, java.lang.String subName, java.util.function.Function<U,T> forward, java.util.function.Function<T,U> backward) -
child
-
readContext
protected abstract T readContext(NetByteBuf buffer, IMsgReadCtx ctx) throws InvalidInputDataException- Returns:
- The read value, or null if the parent couldn't be read.
- Throws:
InvalidInputDataException
- if the byte buffer contained invalid data.
-
writeContext
-
writeDynamicContext
protected void writeDynamicContext(CheckingNetByteBuf buffer, IMsgWriteCtx ctx, T value, java.util.List<TreeNetIdBase> resolvedPath) -
writeKey
-
readKey
public final T readKey(CheckingNetByteBuf buffer, IMsgReadCtx ctx) throws InvalidInputDataException- Throws:
InvalidInputDataException
-