Package net.minecraft.nbt
Class NbtByteArray
java.lang.Object
net.minecraft.nbt.NbtByteArray
- All Implemented Interfaces:
Iterable<NbtElement>
,AbstractNbtList
,NbtElement
Represents an NBT byte array. This object is mutable and backed by
byte[]
.
Its type is 0x7. Like Java arrays, accessing
indices that are out of bounds will throw ArrayIndexOutOfBoundsException
.
The backing array can be obtained via getByteArray()
.- Mappings:
Namespace Name named net/minecraft/nbt/NbtByteArray
intermediary net/minecraft/class_2479
official tx
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final int
static final NbtType
<NbtByteArray> private byte[]
Fields inherited from interface net.minecraft.nbt.NbtElement
BYTE_ARRAY_TYPE, BYTE_TYPE, COMPOUND_TYPE, DOUBLE_TYPE, END_TYPE, field_33246, field_33247, field_33248, field_33249, FLOAT_TYPE, INT_ARRAY_TYPE, INT_TYPE, LIST_TYPE, LONG_ARRAY_TYPE, LONG_TYPE, MAX_DEPTH, SHORT_TYPE, STRING_TYPE
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
accept
(NbtElementVisitor visitor) boolean
addElement
(int index, NbtElement element) Insertselement
atindex
.Optional
<byte[]> void
clear()
copy()
Returns an NBT element of equal value that won't change with this element.doAccept
(NbtScanner visitor) boolean
byte[]
Returns the underlying byte array.Returns the NBT type definition of this NBT element.int
byte
getType()
Returns the type of this NBT element.int
hashCode()
method_10534
(int int2) method_10536
(int int2) boolean
setElement
(int index, NbtElement element) Sets the element atindex
toelement
.int
size()
toString()
void
write
(DataOutput output) Writes the NBT element tooutput
.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface net.minecraft.nbt.AbstractNbtList
get, isEmpty, iterator, remove, stream
Methods inherited from interface java.lang.Iterable
forEach, spliterator
Methods inherited from interface net.minecraft.nbt.NbtElement
accept, asBoolean, asByte, asCompound, asDouble, asFloat, asInt, asIntArray, asLong, asLongArray, asNbtList, asNumber, asShort, asString
-
Field Details
-
SIZE
private static final int SIZE- See Also:
- Mappings:
Namespace Name Mixin selector named SIZE
Lnet/minecraft/nbt/NbtByteArray;SIZE:I
intermediary field_41716
Lnet/minecraft/class_2479;field_41716:I
official b
Ltx;b:I
-
TYPE
- Mappings:
Namespace Name Mixin selector named TYPE
Lnet/minecraft/nbt/NbtByteArray;TYPE:Lnet/minecraft/nbt/NbtType;
intermediary field_21024
Lnet/minecraft/class_2479;field_21024:Lnet/minecraft/class_4614;
official a
Ltx;a:Lvc;
-
value
private byte[] value- Mappings:
Namespace Name Mixin selector named value
Lnet/minecraft/nbt/NbtByteArray;value:[B
intermediary field_11493
Lnet/minecraft/class_2479;field_11493:[B
official c
Ltx;c:[B
-
-
Constructor Details
-
Method Details
-
write
Writes the NBT element tooutput
.- Specified by:
write
in interfaceNbtElement
- Throws:
IOException
- API Note:
- This is a low-level method for serializing NBT elements; consider using
NbtIo
,NbtOps
, orPacketByteBuf.writeNbt(net.minecraft.nbt.NbtElement)
instead. - Mappings:
Namespace Name Mixin selector named write
Lnet/minecraft/nbt/NbtElement;write(Ljava/io/DataOutput;)V
intermediary method_10713
Lnet/minecraft/class_2520;method_10713(Ljava/io/DataOutput;)V
official a
Lva;a(Ljava/io/DataOutput;)V
-
getSizeInBytes
public int getSizeInBytes()- Specified by:
getSizeInBytes
in interfaceNbtElement
- Mappings:
Namespace Name Mixin selector named getSizeInBytes
Lnet/minecraft/nbt/NbtElement;getSizeInBytes()I
intermediary method_47988
Lnet/minecraft/class_2520;method_47988()I
official a
Lva;a()I
-
getType
public byte getType()Returns the type of this NBT element.- Specified by:
getType
in interfaceNbtElement
- Returns:
- the type of this NBT element
- Mappings:
Namespace Name Mixin selector named getType
Lnet/minecraft/nbt/NbtElement;getType()B
intermediary method_10711
Lnet/minecraft/class_2520;method_10711()B
official b
Lva;b()B
-
getNbtType
Returns the NBT type definition of this NBT element.- Specified by:
getNbtType
in interfaceNbtElement
- Returns:
- the NBT type definition of this NBT element
- Mappings:
Namespace Name Mixin selector named getNbtType
Lnet/minecraft/nbt/NbtElement;getNbtType()Lnet/minecraft/nbt/NbtType;
intermediary method_23258
Lnet/minecraft/class_2520;method_23258()Lnet/minecraft/class_4614;
official c
Lva;c()Lvc;
-
toString
- Specified by:
toString
in interfaceNbtElement
- Overrides:
toString
in classObject
-
copy
Returns an NBT element of equal value that won't change with this element.- Specified by:
copy
in interfaceNbtElement
- Returns:
- an NBT element of equal value that won't change with this element
- Mappings:
Namespace Name Mixin selector named copy
Lnet/minecraft/nbt/NbtElement;copy()Lnet/minecraft/nbt/NbtElement;
intermediary method_10707
Lnet/minecraft/class_2520;method_10707()Lnet/minecraft/class_2520;
official d
Lva;d()Lva;
-
equals
-
hashCode
public int hashCode() -
accept
- Specified by:
accept
in interfaceNbtElement
- Mappings:
Namespace Name Mixin selector named accept
Lnet/minecraft/nbt/NbtElement;accept(Lnet/minecraft/nbt/visitor/NbtElementVisitor;)V
intermediary method_32289
Lnet/minecraft/class_2520;method_32289(Lnet/minecraft/class_5627;)V
official a
Lva;a(Lve;)V
-
getByteArray
public byte[] getByteArray()Returns the underlying byte array.- Returns:
- the underlying byte array
- API Note:
- This does not copy the array, so modifications to the returned array also apply to this NBT byte array.
- Mappings:
Namespace Name Mixin selector named getByteArray
Lnet/minecraft/nbt/NbtByteArray;getByteArray()[B
intermediary method_10521
Lnet/minecraft/class_2479;method_10521()[B
official e
Ltx;e()[B
-
size
public int size()- Specified by:
size
in interfaceAbstractNbtList
-
method_10534
- Mappings:
Namespace Name Mixin selector named method_10534
Lnet/minecraft/nbt/NbtByteArray;method_10534(I)Lnet/minecraft/nbt/NbtByte;
intermediary method_10523
Lnet/minecraft/class_2479;method_10523(I)Lnet/minecraft/class_2481;
official a
Ltx;a(I)Lty;
-
setElement
Sets the element atindex
toelement
. Does nothing if the types were incompatible.- Specified by:
setElement
in interfaceAbstractNbtList
- Returns:
- whether the element was actually set
- Mappings:
Namespace Name Mixin selector named setElement
Lnet/minecraft/nbt/AbstractNbtList;setElement(ILnet/minecraft/nbt/NbtElement;)Z
intermediary method_10535
Lnet/minecraft/class_2483;method_10535(ILnet/minecraft/class_2520;)Z
official a
Ltz;a(ILva;)Z
-
addElement
Insertselement
atindex
. Does nothing if the types were incompatible.- Specified by:
addElement
in interfaceAbstractNbtList
- Returns:
- whether the element was actually added
- Mappings:
Namespace Name Mixin selector named addElement
Lnet/minecraft/nbt/AbstractNbtList;addElement(ILnet/minecraft/nbt/NbtElement;)Z
intermediary method_10533
Lnet/minecraft/class_2483;method_10533(ILnet/minecraft/class_2520;)Z
official b
Ltz;b(ILva;)Z
-
method_10536
- Mappings:
Namespace Name Mixin selector named method_10536
Lnet/minecraft/nbt/NbtByteArray;method_10536(I)Lnet/minecraft/nbt/NbtByte;
intermediary method_17804
Lnet/minecraft/class_2479;method_17804(I)Lnet/minecraft/class_2481;
official b
Ltx;b(I)Lty;
-
clear
public void clear()- Specified by:
clear
in interfaceAbstractNbtList
-
asByteArray
- Specified by:
asByteArray
in interfaceNbtElement
- Mappings:
Namespace Name Mixin selector named asByteArray
Lnet/minecraft/nbt/NbtElement;asByteArray()Ljava/util/Optional;
intermediary method_68559
Lnet/minecraft/class_2520;method_68559()Ljava/util/Optional;
official f
Lva;f()Ljava/util/Optional;
-
doAccept
- Specified by:
doAccept
in interfaceNbtElement
- Mappings:
Namespace Name Mixin selector named doAccept
Lnet/minecraft/nbt/NbtElement;doAccept(Lnet/minecraft/nbt/scanner/NbtScanner;)Lnet/minecraft/nbt/scanner/NbtScanner$Result;
intermediary method_39850
Lnet/minecraft/class_2520;method_39850(Lnet/minecraft/class_6836;)Lnet/minecraft/class_6836$class_6838;
official a
Lva;a(Lux;)Lux$b;
-