@Override public IBlockState getBlockState(final BlockPos pos) { if (!isValid(pos)) { return Blocks.AIR.getDefaultState(); } final int x = pos.getX(); final int y = pos.getY(); final int z = pos.getZ(); final Block block = Block.REGISTRY.getObjectById(this.blocks[x][y][z]); return block.getStateFromMeta(this.metadata[x][y][z]); }
private void copyToSchematic(final ISchematic schematic) { final MBlockPos pos = new MBlockPos(); for (int x = 0; x < Constants.SchematicChunk.WIDTH; x++) { for (int y = 0; y < Constants.SchematicChunk.HEIGHT; y++) { for (int z = 0; z < Constants.SchematicChunk.LENGTH; z++) { final short id = this.blocks[x][y][z]; final byte meta = this.metadata[x][y][z]; final Block block = Block.REGISTRY.getObjectById(id); pos.set(this.baseX + x, this.baseY + y, this.baseZ + z); schematic.setBlockState(pos, block.getStateFromMeta(meta)); } } } for (final TileEntity tileEntity : this.tileEntities) { schematic.setTileEntity(tileEntity.getPos(), tileEntity); } }
@Override public void readDesc(MCDataInput packet) { //noinspection unchecked this.pipeBlock = (BlockPipe<PipeType, NodeDataType, ?>) Block.REGISTRY.getObjectById(packet.readVarInt()); this.pipeType = packet.readEnum(pipeBlock.getPipeTypeClass()); this.material = Material.MATERIAL_REGISTRY.getObjectById(packet.readVarInt()); this.insulationColor = packet.readInt(); this.activeConnections = packet.readVarInt(); this.blockedConnections = packet.readVarInt(); byte[] dataArray = packet.readArray(packet.readVarInt()); getCoverableImplementation().readInitialSyncData(new PacketBuffer(Unpooled.wrappedBuffer(dataArray))); this.reinitializeShape(); }
final Block block = Block.REGISTRY.getObjectById(blockID); pos.set(x, y, z); try {