net.minecraft.block.Block.getIdFromBlock()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(7.1k)|赞(0)|评价(0)|浏览(194)

本文整理了Java中net.minecraft.block.Block.getIdFromBlock()方法的一些代码示例,展示了Block.getIdFromBlock()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Block.getIdFromBlock()方法的具体详情如下:
包路径:net.minecraft.block.Block
类名称:Block
方法名:getIdFromBlock

Block.getIdFromBlock介绍

暂无

代码示例

代码示例来源:origin: P3pp3rF1y/AncientWarfare2

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;
}

代码示例来源:origin: CoFH/CoFHCore

public static boolean canRotate(Block block) {
  return Block.getIdFromBlock(block) < MAX_ID && rotateType[Block.getIdFromBlock(block)] != 0;
}

代码示例来源:origin: vadis365/TheErebus

@Override
public void writeSpawnData(ByteBuf buffer) {
  buffer.writeInt(Block.getIdFromBlock(blockID));
  buffer.writeInt(blockMeta);
}

代码示例来源:origin: MCTCP/TerrainControl

@Override
public int getBlockId()
{
  return Block.getIdFromBlock(this.blockData.getBlock());
}

代码示例来源:origin: ldtteam/minecolonies

@Override
public void toBytes(@NotNull final ByteBuf buf)
{
  BlockPosUtil.writeToByteBuf(buf, pos);
  buf.writeInt(Block.getIdFromBlock(block));
  buf.writeInt(metadata);
  buf.writeInt(side);
}

代码示例来源:origin: AppliedEnergistics/Applied-Energistics-2

this.settings.setInteger( "y", y );
this.settings.setInteger( "z", z );
this.settings.setInteger( "blk", Block.getIdFromBlock( blk ) );

代码示例来源:origin: OpenMods/OpenModsLib

@Override
public void writeToStream(PacketBuffer stream) {
  int blockId = Block.getIdFromBlock(block);
  if (blockId < 0) blockId = 0;
  stream.writeVarInt(blockId);
}

代码示例来源:origin: Vazkii/Botania

@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();
      }
    }
  }
}

代码示例来源:origin: lawremi/CustomOreGen

@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;
}

代码示例来源:origin: ata4/dragon-mounts

/**
 * Generates some egg shell particles and a breaking sound.
 */
public void playEggCrackEffect() {
  dragon.worldObj.playEvent(2001, dragon.getPosition(),
      Block.getIdFromBlock(BlockDragonBreedEgg.INSTANCE));
}

代码示例来源:origin: lawremi/CustomOreGen

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;
}

代码示例来源:origin: CyclopsMC/EvilCraft

/**
 * 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));
}

代码示例来源:origin: IntellectualSites/PlotSquared

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);
}

代码示例来源:origin: CoFH/ThermalDynamics

@Override
public void addDescriptionToPacket(PacketBase packet) {
  packet.addShort(Block.getIdFromBlock(state.getBlock()));
  packet.addByte(state.getBlock().getMetaFromState(state));
}

代码示例来源:origin: Electrical-Age/ElectricalAge

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;
}

代码示例来源:origin: vadis365/TheErebus

@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());
}

代码示例来源:origin: MatterOverdrive/MatterOverdrive-Legacy-Edition

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);
  }
}

代码示例来源:origin: vadis365/TheErebus

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));
}

代码示例来源:origin: Esteemed-Innovation/Esteemed-Innovation

@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);
}

代码示例来源:origin: Esteemed-Innovation/Esteemed-Innovation

@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);
}

相关文章

Block类方法