Example #1
0
 def read(self, nbt: NBT, network: bool = False):
     size = nbt.getInt(network)
     if nbt.endianness == NBT.LITTLE_ENDIAN:
         array = struct.unpack("<L" * len(self.value), *nbt.get(size * 4))
     else:
         array = struct.unpack(">L" * len(self.value), *nbt.get(size * 4))
     self.value = [v for key in array for v in key]
Example #2
0
 def read(self, nbt: NBT, network: bool = False):
     self.value = {}
     self.tagType = nbt.getByte()
     size = nbt.getInt(network)
     i = 0
     while i < size and not nbt.feof():
         if self.tagType == NBT.TAG_Byte:
             tag = ByteTag("")
Example #3
0
 def read(self, nbt: NBT, network: bool = False):
     self.value = nbt.getString(network)
Example #4
0
 def write(self, nbt: NBT, network: bool = False):
     nbt.putString(self.value, network)
Example #5
0
 def write(self, nbt: NBT, network: bool = False):
     nbt.putShort(self.value)
Example #6
0
 def read(self, nbt: NBT, network: bool = False):
     self.value = nbt.getShort()
Example #7
0
 def write(self, nbt: NBT, network: bool = False):
     nbt.putInt(len(self.value), network)
     if nbt.endianness == NBT.LITTLE_ENDIAN:
         nbt.put(struct.pack("<L" * len(self.value), *self.value))
     else:
         nbt.put(struct.pack(">L" * len(self.value), *self.value))
Example #8
0
 def read(self, nbt: NBT, network: bool = False):
     self.value = nbt.getDouble()
Example #9
0
 def write(self, nbt: NBT, network: bool = False):
     nbt.putDouble(self.value)