Example #1
0
  public static AltarUpgradeComponent getUpgrades(World world, int x, int y, int z, int altarTier) {
    AltarUpgradeComponent upgrades = new AltarUpgradeComponent();
    List<AltarComponent> list = UpgradedAltars.getAltarUpgradeListForTier(altarTier);

    for (AltarComponent ac : list) {
      if (ac.isUpgradeSlot()) {
        // Currently checks the getRuneEffect.
        // TODO Change so that it uses the metadata instead, with the BlockID.
        Block testBlock =
            Block.blocksList[world.getBlockId(x + ac.getX(), y + ac.getY(), z + ac.getZ())];

        if (testBlock instanceof BloodRune) {
          if (!world.isRemote) {
            switch (((BloodRune) testBlock)
                .getRuneEffect(
                    world.getBlockMetadata(x + ac.getX(), y + ac.getY(), z + ac.getZ()))) {
              case 1:
                upgrades.addSpeedUpgrade();
                break;

              case 2:
                upgrades.addEfficiencyUpgrade();
                break;

              case 3:
                upgrades.addSacrificeUpgrade();
                break;

              case 4:
                upgrades.addSelfSacrificeUpgrade();
                break;

              case 5:
                upgrades.addaltarCapacitiveUpgrade();
                break;

              case 6:
                upgrades.addDisplacementUpgrade();
                break;

              case 7:
                upgrades.addorbCapacitiveUpgrade();
                break;
            }
          }
        }
      }
    }

    return upgrades;
  }
Example #2
0
  public static boolean checkAltarIsValid(World world, int x, int y, int z, int altarTier) {
    switch (altarTier) {
      case 1:
        return true;

      case 2:
        for (AltarComponent ac : secondTierAltar) {
          if (ac.isBloodRune()) {
            Block testBlock =
                Block.blocksList[world.getBlockId(x + ac.getX(), y + ac.getY(), z + ac.getZ())];

            if (!(testBlock instanceof BloodRune)) {
              return false;
            }
          } else {
            int blockId = world.getBlockId(x + ac.getX(), y + ac.getY(), z + ac.getZ());
            int metadata = world.getBlockMetadata(x + ac.getX(), y + ac.getY(), z + ac.getZ());

            if (((ac.getBlockID() != blockId) || (ac.getMetadata() != metadata))
                && !(ac.getBlockID() == Block.stoneBrick.blockID
                    && !world.isAirBlock(x + ac.getX(), y + ac.getY(), z + ac.getZ()))) {
              return false;
            }
          }
        }

        return true;

      case 3:
        for (AltarComponent ac : thirdTierAltar) {
          if (ac.isBloodRune()) {
            Block testBlock =
                Block.blocksList[world.getBlockId(x + ac.getX(), y + ac.getY(), z + ac.getZ())];

            if (!(testBlock instanceof BloodRune)) {
              return false;
            }
          } else {
            int blockId = world.getBlockId(x + ac.getX(), y + ac.getY(), z + ac.getZ());
            int metadata = world.getBlockMetadata(x + ac.getX(), y + ac.getY(), z + ac.getZ());

            if (((ac.getBlockID() != blockId) || (ac.getMetadata() != metadata))
                && !(ac.getBlockID() == Block.stoneBrick.blockID
                    && !world.isAirBlock(x + ac.getX(), y + ac.getY(), z + ac.getZ()))) {
              return false;
            }
          }
        }

        return true;

      case 4:
        for (AltarComponent ac : fourthTierAltar) {
          if (ac.isBloodRune()) {
            Block testBlock =
                Block.blocksList[world.getBlockId(x + ac.getX(), y + ac.getY(), z + ac.getZ())];

            if (!(testBlock instanceof BloodRune)) {
              return false;
            }
          } else {
            int blockId = world.getBlockId(x + ac.getX(), y + ac.getY(), z + ac.getZ());
            int metadata = world.getBlockMetadata(x + ac.getX(), y + ac.getY(), z + ac.getZ());

            if (((ac.getBlockID() != blockId) || (ac.getMetadata() != metadata))
                && !(ac.getBlockID() == Block.stoneBrick.blockID
                    && !world.isAirBlock(x + ac.getX(), y + ac.getY(), z + ac.getZ()))) {
              return false;
            }
          }
        }

        return true;

      case 5:
        for (AltarComponent ac : fifthTierAltar) {
          if (ac.isBloodRune()) {
            Block testBlock =
                Block.blocksList[world.getBlockId(x + ac.getX(), y + ac.getY(), z + ac.getZ())];

            if (!(testBlock instanceof BloodRune)) {
              return false;
            }
          } else {
            int blockId = world.getBlockId(x + ac.getX(), y + ac.getY(), z + ac.getZ());
            int metadata = world.getBlockMetadata(x + ac.getX(), y + ac.getY(), z + ac.getZ());

            if (((ac.getBlockID() != blockId) || (ac.getMetadata() != metadata))
                && !(ac.getBlockID() == Block.stoneBrick.blockID
                    && !world.isAirBlock(x + ac.getX(), y + ac.getY(), z + ac.getZ()))) {
              return false;
            }
          }
        }

        return true;

      default:
        return false;
    }
  }