public PacketBlockEvent(BlockPos pos, Block block, short a, short b) { this.pos = pos; this.id = (short) Block.getIdFromBlock(block); this.a = a; this.b = b; }
public static boolean canRotate(Block block) { return Block.getIdFromBlock(block) < MAX_ID && rotateType[Block.getIdFromBlock(block)] != 0; }
@Override public void writeSpawnData(ByteBuf buffer) { buffer.writeInt(Block.getIdFromBlock(blockID)); buffer.writeInt(blockMeta); }
@Override public int getBlockId() { return Block.getIdFromBlock(this.blockData.getBlock()); }
@Override public void toBytes(@NotNull final ByteBuf buf) { BlockPosUtil.writeToByteBuf(buf, pos); buf.writeInt(Block.getIdFromBlock(block)); buf.writeInt(metadata); buf.writeInt(side); }
this.settings.setInteger( "y", y ); this.settings.setInteger( "z", z ); this.settings.setInteger( "blk", Block.getIdFromBlock( blk ) );
@Override public void writeToStream(PacketBuffer stream) { int blockId = Block.getIdFromBlock(block); if (blockId < 0) blockId = 0; stream.writeVarInt(blockId); }
@Override public void onUpdate() { super.onUpdate(); if(supertile.getWorld().isRemote || redstoneSignal > 0 || !canOperate()) return; int cost = getCost(); if(mana >= cost && ticksExisted % getDelay() == 0) { BlockPos coords = getCoordsToPut(); if(coords != null) { ItemStack stack = getOreToPut(); if(!stack.isEmpty()) { Block block = Block.getBlockFromItem(stack.getItem()); int meta = stack.getItemDamage(); supertile.getWorld().setBlockState(coords, block.getStateFromMeta(meta), 1 | 2); if(ConfigHandler.blockBreakParticles) supertile.getWorld().playEvent(2001, coords, Block.getIdFromBlock(block) + (meta << 12)); supertile.getWorld().playSound(null, supertile.getPos(), ModSounds.orechid, SoundCategory.BLOCKS, 2F, 1F); mana -= cost; sync(); } } } }
@Override public int hashCode() { int code = this.wildcard ? Block.getIdFromBlock(this.blockState.getBlock()) : this.blockState.hashCode(); if (this.nbt != null) code ^= nbt.hashCode(); return code; }
/** * Generates some egg shell particles and a breaking sound. */ public void playEggCrackEffect() { dragon.worldObj.playEvent(2001, dragon.getPosition(), Block.getIdFromBlock(BlockDragonBreedEgg.INSTANCE)); }
public float getWeight_fast(IBlockState blockState) { this.compileMatches(); int blockID = Block.getIdFromBlock(blockState.getBlock()); return blockID >= 0 && blockID < this._fastMatch.length ? this._fastMatch[blockID] : Float.NaN; }
/** * Creates a packet with coordinates. * @param location The location data. * @param block The blockState. */ public SanguinaryPedestalBlockReplacePacket(BlockPos location, Block block) { this(location.getX(), location.getY(), location.getZ(), Block.getIdFromBlock(block)); }
public static PlotBlock getPlotBlock(BlockState state) { if (state == null) { return PlotBlock.get(0, 0); } IBlockState ibs = ((IBlockState) state); Block block = ibs.getBlock(); int id = Block.getIdFromBlock(block); int data = block.getMetaFromState(ibs); return PlotBlock.get(id, data); }
@Override public void addDescriptionToPacket(PacketBase packet) { packet.addShort(Block.getIdFromBlock(state.getBlock())); packet.addByte(state.getBlock().getMetaFromState(state)); }
private boolean checkIsOre(Coordonate coordonate) { Block block = coordonate.world().getBlock(coordonate.x, coordonate.y, coordonate.z); if (block instanceof BlockOre) return true; if (block instanceof OreBlock) return true; if (block instanceof BlockRedstoneOre) return true; if (PortableOreScannerItem.RenderStorage.getBlockKeyFactor()[Block.getIdFromBlock(block) + (coordonate.world().getBlockMetadata(coordonate.x, coordonate.y, coordonate.z) << 12)] != 0) return true; return false; }
@Override public void writeEntityToNBT(NBTTagCompound nbt) { super.writeEntityToNBT(nbt); nbt.setInteger("blockID", Block.getIdFromBlock(blockID)); nbt.setInteger("blockMeta", blockMeta); if (this.getOwnerId() == null) nbt.setString("OwnerUUID", ""); else nbt.setString("OwnerUUID", this.getOwnerId().toString()); }
public void setLastBlock(ItemStack itemStack, Block block) { if (itemStack.getTagCompound() == null) { itemStack.setTagCompound(new NBTTagCompound()); } int blockID = Block.getIdFromBlock(block); if (itemStack.getTagCompound().getInteger("LastBlock") != blockID) { itemStack.getTagCompound().setInteger("LastBlock", blockID); } }
private void openPyramid(World world, BlockPos pos, int offsetX, int offsetZ) { EntityLightningBolt entitybolt = new EntityLightningBolt(world, 0D, 0D, 0D, false); entitybolt.setLocationAndAngles(pos.getX() + offsetX, pos.getY(), pos.getZ() + offsetZ, 0F, 0F); world.addWeatherEffect(entitybolt); world.playEvent(null, 2001, pos, Block.getIdFromBlock(world.getBlockState(pos).getBlock())); world.setBlockToAir(pos); world.playEvent(null, 2001, pos.add(offsetX, 0, 0), Block.getIdFromBlock(world.getBlockState(pos.add(offsetX, 0, 0)).getBlock())); world.setBlockToAir(pos.add(offsetX, 0, 0)); world.playEvent(null, 2001, pos.add(0, 0, offsetZ), Block.getIdFromBlock(world.getBlockState(pos.add(0, 0, offsetZ)).getBlock())); world.setBlockToAir(pos.add(0, 0, offsetZ)); world.playEvent(null, 2001, pos.add(offsetX, 0, offsetZ), Block.getIdFromBlock(world.getBlockState(pos.add(offsetX, 0, offsetZ)).getBlock())); world.setBlockToAir(pos.add(offsetX, 0, offsetZ)); }
@Override public SPacketUpdateTileEntity getUpdatePacket() { NBTTagCompound access = getUpdateTag(); access.setInteger("WaterStored", myTank.getFluidAmount()); access.setShort("BurnTime", (short) burnTime); access.setShort("CookTime", (short) cookTime); access.setShort("CurrentItemBurnTime", (short) currentItemBurnTime); access.setInteger("DisguiseBlock", Block.getIdFromBlock(disguiseBlock)); access.setInteger("DisguiseMetadata", disguiseMeta); return new SPacketUpdateTileEntity(pos, 1, access); }
@Override public SPacketUpdateTileEntity getUpdatePacket() { NBTTagCompound access = super.getUpdateTag(); access.setInteger("spinup", spinup); access.setFloat("extendedLength", extendedLength); access.setInteger("extendedTicks", extendedTicks); access.setInteger("block", Block.getIdFromBlock(smooshingBlock)); access.setInteger("smooshingMeta", smooshingMeta); access.setBoolean("running", running); access.setBoolean("blockBreakerMode", blockBreakerMode); access.setBoolean("hasBeenSet", hasBeenSet); return new SPacketUpdateTileEntity(pos, 1, access); }