protected void a(NBTTagCompound var1) {
    if (var1.getBoolean("CustomDisplayTile")) {
      int var2 = var1.getInt("DisplayData");
      Block var3;
      if (var1.hasKeyOfType("DisplayTile", 8)) {
        var3 = Block.getByName(var1.getString("DisplayTile"));
        if (var3 == null) {
          this.setDisplayBlock(Blocks.AIR.getBlockData());
        } else {
          this.setDisplayBlock(var3.fromLegacyData(var2));
        }
      } else {
        var3 = Block.getById(var1.getInt("DisplayTile"));
        if (var3 == null) {
          this.setDisplayBlock(Blocks.AIR.getBlockData());
        } else {
          this.setDisplayBlock(var3.fromLegacyData(var2));
        }
      }

      this.SetDisplayBlockOffset(var1.getInt("DisplayOffset"));
    }

    if (var1.hasKeyOfType("CustomName", 8) && var1.getString("CustomName").length() > 0) {
      this.b = var1.getString("CustomName");
    }
  }
Example #2
0
  public boolean d(Block block) {
    if (block == this.j) {
      return this.k;
    } else {
      this.j = block;
      if (this.hasTag() && this.tag.hasKeyOfType("CanPlaceOn", 9)) {
        NBTTagList nbttaglist = this.tag.getList("CanPlaceOn", 8);

        for (int i = 0; i < nbttaglist.size(); ++i) {
          Block block1 = Block.getByName(nbttaglist.getString(i));

          if (block1 == block) {
            this.k = true;
            return true;
          }
        }
      }

      this.k = false;
      return false;
    }
  }
  private static WorldGenFlatLayerInfo a(int i, String s, int j) {
    String[] astring = i >= 3 ? s.split("\\*", 2) : s.split("x", 2);
    int k = 1;
    int l = 0;

    if (astring.length == 2) {
      try {
        k = Integer.parseInt(astring[0]);
        if (j + k >= 256) {
          k = 256 - j;
        }

        if (k < 0) {
          k = 0;
        }
      } catch (Throwable throwable) {
        return null;
      }
    }

    Block block = null;

    try {
      String s1 = astring[astring.length - 1];

      if (i < 3) {
        astring = s1.split(":", 2);
        if (astring.length > 1) {
          l = Integer.parseInt(astring[1]);
        }

        block = Block.getById(Integer.parseInt(astring[0]));
      } else {
        astring = s1.split(":", 3);
        block = astring.length > 1 ? Block.getByName(astring[0] + ":" + astring[1]) : null;
        if (block != null) {
          l = astring.length > 2 ? Integer.parseInt(astring[2]) : 0;
        } else {
          block = Block.getByName(astring[0]);
          if (block != null) {
            l = astring.length > 1 ? Integer.parseInt(astring[1]) : 0;
          }
        }

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

      if (block == Blocks.AIR) {
        l = 0;
      }

      if (l < 0 || l > 15) {
        l = 0;
      }
    } catch (Throwable throwable1) {
      return null;
    }

    WorldGenFlatLayerInfo worldgenflatlayerinfo = new WorldGenFlatLayerInfo(i, k, block, l);

    worldgenflatlayerinfo.b(j);
    return worldgenflatlayerinfo;
  }