Package net.orbyfied.j8.util.nbt
Class CompoundObjectTag<T>
java.lang.Object
net.orbyfied.j8.util.nbt.CompoundObjectTag<T>
- All Implemented Interfaces:
net.minecraft.nbt.Tag
A runtime reference to an object which is
converted to a compound tag with the data
prefixed by the class name to save it persistently.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringThe key used to store the class name in the serialized compound tags.static final HashMap<Class<?>,CompoundTagSerializer<?>> The serializers loaded mapped by class.static final StringThe name of the field that compound tag serializable classes should define and initialize with their serializer.static final net.minecraft.nbt.TagType<CompoundObjectTag<?>>Tag type.Fields inherited from interface net.minecraft.nbt.Tag
ARRAY_HEADER, MAX_DEPTH, OBJECT_HEADER, OBJECT_REFERENCE, STRING_SIZE, TAG_ANY_NUMERIC, TAG_BYTE, TAG_BYTE_ARRAY, TAG_COMPOUND, TAG_DOUBLE, TAG_END, TAG_FLOAT, TAG_INT, TAG_INT_ARRAY, TAG_LIST, TAG_LONG, TAG_LONG_ARRAY, TAG_SHORT, TAG_STRING -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription@NotNull net.minecraft.nbt.StreamTagVisitor.ValueResultaccept(net.minecraft.nbt.StreamTagVisitor visitor) voidaccept(net.minecraft.nbt.TagVisitor visitor) @NotNull net.minecraft.nbt.Tagcopy()booleanbytegetId()Class<?>@NotNull net.minecraft.nbt.TagType<?>getType()inthashCode()static CompoundObjectTag<?>loadFromCompound(net.minecraft.nbt.CompoundTag ctag) Tries to load an object from the given compound tag.static net.minecraft.nbt.CompoundTagsaveToCompound(CompoundObjectTag<?> otag, net.minecraft.nbt.CompoundTag ctag) Saves the provided compound object tag to the specified compound tag and returns it (the compound tag) back to you.toString()voidwrite(DataOutput output) net.minecraft.nbt.CompoundTagAttempts to serialize this object tag into a new compound tag.net.minecraft.nbt.CompoundTagwriteCompoundTag(net.minecraft.nbt.CompoundTag tag) Attempts to serialize this object tag into the provided compound tag.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface net.minecraft.nbt.Tag
acceptAsRoot, getAsString
-
Field Details
-
SERIALIZER_FIELD_NAME
The name of the field that compound tag serializable classes should define and initialize with their serializer.- See Also:
-
CLASS_NAME_TAG
The key used to store the class name in the serialized compound tags.- See Also:
-
LOADED_SERIALIZERS
The serializers loaded mapped by class. Used mainly as a cache, but can also be used to define or overwrite serializers for other classes. -
TAG_TYPE
Tag type.
-
-
Constructor Details
-
CompoundObjectTag
-
-
Method Details
-
loadFromCompound
Tries to load an object from the given compound tag.- Parameters:
ctag- The compound tag to load.- Returns:
- The object tag or null if it failed.
-
saveToCompound
public static net.minecraft.nbt.CompoundTag saveToCompound(CompoundObjectTag<?> otag, net.minecraft.nbt.CompoundTag ctag) Saves the provided compound object tag to the specified compound tag and returns it (the compound tag) back to you.- Parameters:
otag- The object tag to write.ctag- The compound tag to write to.- Returns:
- The (same) compound tag.
-
getObjectType
-
getObject
-
setObject
-
writeCompoundTag
public net.minecraft.nbt.CompoundTag writeCompoundTag(net.minecraft.nbt.CompoundTag tag) Attempts to serialize this object tag into the provided compound tag.- Parameters:
tag- The output compound tag.- Returns:
- The output compound tag.
-
writeCompoundTag
public net.minecraft.nbt.CompoundTag writeCompoundTag()Attempts to serialize this object tag into a new compound tag.- Returns:
- The output compound tag.
- See Also:
-
write
- Specified by:
writein interfacenet.minecraft.nbt.Tag- Throws:
IOException
-
getId
public byte getId()- Specified by:
getIdin interfacenet.minecraft.nbt.Tag
-
getType
@NotNull public @NotNull net.minecraft.nbt.TagType<?> getType()- Specified by:
getTypein interfacenet.minecraft.nbt.Tag
-
copy
@NotNull public @NotNull net.minecraft.nbt.Tag copy()- Specified by:
copyin interfacenet.minecraft.nbt.Tag
-
accept
public void accept(net.minecraft.nbt.TagVisitor visitor) - Specified by:
acceptin interfacenet.minecraft.nbt.Tag
-
accept
public @NotNull net.minecraft.nbt.StreamTagVisitor.ValueResult accept(net.minecraft.nbt.StreamTagVisitor visitor) - Specified by:
acceptin interfacenet.minecraft.nbt.Tag
-
toString
-
equals
-
hashCode
public int hashCode()
-