Create an index of interesting blocks
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user