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

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

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

Block.getStateById介绍

暂无

代码示例

代码示例来源:origin: AlgorithmX2/Chisels-and-Bits

public IBlockState getStateById(
    final int blockStateID )
{
  return Block.getStateById( blockStateID );
}

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

@Override
public void readFromStream(PacketBuffer buf) {
  final int id = buf.readVarInt();
  state = Block.getStateById(id);
}

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

@Override
public void readSpawnData(ByteBuf additionalData) {
  this.blockState = Block.getStateById(additionalData.readInt());
  this.hasGravity = additionalData.readBoolean();
}

代码示例来源:origin: Chisel-Team/Chisel

@Override
public void fromBytes(ByteBuf buf) {
  this.pos = BlockPos.fromLong(buf.readLong());
  ItemStack chisel = ByteBufUtils.readItemStack(buf);
  Validate.notNull(chisel);
  this.chisel = chisel;
  this.state = Block.getStateById(buf.readInt());
}

代码示例来源:origin: Ellpeck/ActuallyAdditions

private static Pair<IBlockState, String> loadData(ItemStack stack) {
  if (stack.hasTagCompound()) return Pair.of(Block.getStateById(stack.getTagCompound().getInteger("state")), stack.getTagCompound().getString("name"));
  return null;
}

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

@Override
@SuppressWarnings("deprecation")
protected void readEntityFromNBT(NBTTagCompound tag) {
  if (tag.hasKey(TAG_BLOCK_STATE_ID)) {
    final int blockStateId = tag.getInteger(TAG_BLOCK_STATE_ID);
    this.blockState = Block.getStateById(blockStateId);
  } else {
    int meta = tag.getByte(TAG_BLOCK_META) & 255;
    final ResourceLocation blockId = NbtUtils.readResourceLocation(tag.getCompoundTag(TAG_BLOCK_ID));
    final Block block = Block.REGISTRY.getObject(blockId);
    this.blockState = block.getStateFromMeta(meta);
  }
  if (tag.hasKey(TAG_TILE_ENTITY, Constants.NBT.TAG_COMPOUND)) this.tileEntity = tag.getCompoundTag(TAG_TILE_ENTITY);
  else this.tileEntity = null;
}

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

@Override
  public void readSpawnData(ByteBuf data) {
    PacketBuffer pb = new PacketBuffer(data);
    ammoType = AmmoRegistry.getAmmo(new ResourceLocation(pb.readString(64)));
    this.prevRotationYaw = this.rotationYaw = pb.readFloat();
    this.prevRotationPitch = this.rotationPitch = pb.readFloat();
    this.inGround = pb.readBoolean();
    persistentBlockPos = BlockPos.fromLong(pb.readLong());
    persistentBlock = Block.getStateById(pb.readInt());
    this.rocketBurnTime = pb.readInt();
    boolean hasLauncher = pb.readBoolean();
    if (hasLauncher) {
      launcher = world.getEntityByID(pb.readInt());
    }
  }
}

相关文章

Block类方法