Create an index of interesting blocks

This commit is contained in:
2020-09-24 17:46:00 -06:00
parent 6b2df0c27e
commit b723143299
4 changed files with 37 additions and 1 deletions
+8
View File
@@ -10,6 +10,8 @@ from minecraft.networking.types import (
from protocol.types import Nbt, Slot, Entry
import blocks
class ChunkDataPacket(Packet):
id = 0x20
@@ -75,6 +77,7 @@ class Chunk:
self.z = z
self.empty = empty
self.entities = []
self.sub_index = {}
def __repr__(self):
return 'Chunk(%r, %r, %r)' % (self.x, self.y, self.z)
@@ -111,6 +114,11 @@ class Chunk:
n = self.palette[n]
self.blocks.append(n)
if n in blocks.INDEXED_IDS:
if n not in self.sub_index:
self.sub_index[n] = []
self.sub_index[n].append(i)
def write_fields(self, packet_buffer):
pass # TODO