From 343268af242c3c0327e01b8882b73801f87c4fe4 Mon Sep 17 00:00:00 2001 From: Tanner Collin Date: Fri, 7 May 2021 00:29:41 +0000 Subject: [PATCH] Use a set for the block index to limit size --- mosfet/protocol/managers.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/mosfet/protocol/managers.py b/mosfet/protocol/managers.py index b615699..3f34190 100644 --- a/mosfet/protocol/managers.py +++ b/mosfet/protocol/managers.py @@ -69,10 +69,10 @@ class ChunksManager: for item_id, locations in chunk.sub_index.items(): if item_id not in self.index: - self.index[item_id] = [] + self.index[item_id] = set() for l in locations: coords = (dx + l%16, dy + l//256, dz + l%256//16) - self.index[item_id].append(coords) + self.index[item_id].add(coords) #self.biomes[(chunk_packet.x, None, chunk_packet.z)] = chunk_packet.biomes # FIXME if self.loading: @@ -118,8 +118,8 @@ class ChunksManager: if block in blocks.INDEXED_IDS: if block not in self.index: - self.index[block] = [] - self.index[block].append((x, y, z)) + self.index[block] = set() + self.index[block].add((x, y, z)) def check_loaded(self, chunk_distance): num = (chunk_distance * 2 + 1) ** 2