Example #1
0
  @Override
  protected void readEntityFromNBT(NBTTagCompound tag) {

    String blockName = tag.getString(TAG_BLOCK_NAME);

    Block block = BlockProperties.getBlockByName(blockName);

    if (block == null) {
      setDead();
      return;
    }

    int blockMeta = tag.getInteger(TAG_BLOCK_META);
    setBlockNameAndMeta(blockName, blockMeta);

    if (tag.hasKey(TAG_TILE_ENTITY, Constants.NBT.TAG_COMPOUND))
      this.tileEntity = tag.getCompoundTag(TAG_TILE_ENTITY);
    else this.tileEntity = null;
  }
Example #2
0
 public Block getBlock() {
   return BlockProperties.getBlockByName(getBlockName());
 }