@Override public void removeBlockEntity(BlockEntity blockEntity) { this.tiles.remove(blockEntity.getId()); int index = ((blockEntity.z & 0x0f) << 12) | ((blockEntity.x & 0x0f) << 8) | (blockEntity.y & 0xff); this.tileList.remove(index); if (this.isInit) { this.hasChanged = true; } }
@Override public void addBlockEntity(BlockEntity blockEntity) { this.tiles.put(blockEntity.getId(), blockEntity); int index = (((int) blockEntity.z & 0x0f) << 12) | (((int) blockEntity.x & 0x0f) << 8) | ((int) blockEntity.y & 0xff); if (this.tileList.containsKey(index) && !this.tileList.get(index).equals(blockEntity)) { this.tileList.get(index).close(); } this.tileList.put(index, blockEntity); if (this.isInit) { this.hasChanged = true; } }