protected void writeStructureToNBT(NBTTagCompound tagCompound) { super.writeStructureToNBT(tagCompound); tagCompound.setInteger("CA", Block.REGISTRY.getIDForObject(this.cropTypeA)); tagCompound.setInteger("CB", Block.REGISTRY.getIDForObject(this.cropTypeB)); tagCompound.setInteger("CC", Block.REGISTRY.getIDForObject(this.cropTypeC)); tagCompound.setInteger("CD", Block.REGISTRY.getIDForObject(this.cropTypeD)); }
public static synchronized void clearCache() { fluidFilterState.clear(); for ( final Iterator<Block> it = Block.REGISTRY.iterator(); it.hasNext(); ) { final Block block = it.next(); final int blockId = Block.REGISTRY.getIDForObject( block ); if ( BlockBitInfo.getFluidFromBlock( block ) != null ) { fluidFilterState.set( blockId ); } } if ( FMLCommonHandler.instance().getSide() == Side.CLIENT ) { updateCacheClient(); ModUtil.cacheFastStates(); } }
public MessageDownloadChunk(final ISchematic schematic, final int baseX, final int baseY, final int baseZ) { this.baseX = baseX; this.baseY = baseY; this.baseZ = baseZ; this.blocks = new short[Constants.SchematicChunk.WIDTH][Constants.SchematicChunk.HEIGHT][Constants.SchematicChunk.LENGTH]; this.metadata = new byte[Constants.SchematicChunk.WIDTH][Constants.SchematicChunk.HEIGHT][Constants.SchematicChunk.LENGTH]; this.tileEntities = new ArrayList<TileEntity>(); this.entities = new ArrayList<Entity>(); 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++) { pos.set(baseX + x, baseY + y, baseZ + z); final IBlockState blockState = schematic.getBlockState(pos); final Block block = blockState.getBlock(); final int id = Block.REGISTRY.getIDForObject(block); this.blocks[x][y][z] = (short) id; this.metadata[x][y][z] = (byte) block.getMetaFromState(blockState); final TileEntity tileEntity = schematic.getTileEntity(pos); if (tileEntity != null) { this.tileEntities.add(tileEntity); } } } } }
@Override public boolean setBlockState(final BlockPos pos, final IBlockState blockState) { if (!isValid(pos)) { return false; } final Block block = blockState.getBlock(); final int id = Block.REGISTRY.getIDForObject(block); if (id == -1) { return false; } final int meta = block.getMetaFromState(blockState); final int x = pos.getX(); final int y = pos.getY(); final int z = pos.getZ(); this.blocks[x][y][z] = (short) id; this.metadata[x][y][z] = (byte) meta; return true; }
@Override public void writeDesc(MCDataOutput packet) { packet.writeVarInt(Block.REGISTRY.getIDForObject(pipeBlock)); packet.writeEnum(pipeType); packet.writeVarInt(Material.MATERIAL_REGISTRY.getIDForObject(material)); packet.writeInt(insulationColor); packet.writeVarInt(activeConnections); packet.writeVarInt(blockedConnections); PacketBuffer packetBuffer = new PacketBuffer(Unpooled.buffer()); getCoverableImplementation().writeInitialSyncData(packetBuffer); byte[] dataArray = packetBuffer.array(); packet.writeVarInt(dataArray.length); packet.writeArray(dataArray); }
final IBlockState blockState = schematic.getBlockState(pos.set(x, y, z)); final Block block = blockState.getBlock(); final int blockId = Block.REGISTRY.getIDForObject(block); localBlocks[index] = (byte) blockId; localMetadata[index] = (byte) block.getMetaFromState(blockState); Reference.logger.error("Block {}[{}] with TileEntity {} failed to save! Replacing with bedrock...", block, block != null ? Block.REGISTRY.getNameForObject(block) : "?", tileEntity.getClass().getName(), e); localBlocks[index] = (byte) Block.REGISTRY.getIDForObject(Blocks.BEDROCK); localMetadata[index] = 0; extraBlocks[index] = 0;
final Set<String> names = mapping.getKeySet(); for (final String name : names) { oldToNew.put(mapping.getShort(name), (short) Block.REGISTRY.getIDForObject(Block.REGISTRY.getObject(new ResourceLocation(name))));