示例#1
0
文件: Beacon.java 项目: EALS634/MyPet
  @Override
  public void load(TagCompound tagCompound) {

    if (tagCompound.getCompoundData().containsKey("buff_speed_boost_enable")) {
      speedBoostChangeCheckBox.setSelected(true);
      if (tagCompound.getAs("buff_speed_boost_enable", TagByte.class).getBooleanData()) {
        speedBostEnableCheckBox.setSelected(true);
        if (tagCompound.getCompoundData().containsKey("buff_speed_boost_level")) {
          speedBoostSpinner.setValue(
              tagCompound.getAs("buff_speed_boost_level", TagInt.class).getIntData());
        }
      }
    }
    if (tagCompound.getCompoundData().containsKey("buff_haste_enable")) {
      hasteChangeCheckBox.setSelected(true);
      if (tagCompound.getAs("buff_haste_enable", TagByte.class).getBooleanData()) {
        hasteEnableCheckBox.setSelected(true);
        if (tagCompound.getCompoundData().containsKey("buff_haste_level")) {
          hasteSpinner.setValue(tagCompound.getAs("buff_haste_level", TagInt.class).getIntData());
        }
      }
    }
    if (tagCompound.getCompoundData().containsKey("buff_strength_enable")) {
      strengthChangeCheckBox.setSelected(true);
      if (tagCompound.getAs("buff_strength_enable", TagByte.class).getBooleanData()) {
        strengthEnableCheckBox.setSelected(true);
        if (tagCompound.getCompoundData().containsKey("buff_strength_level")) {
          strengthSpinner.setValue(
              tagCompound.getAs("buff_strength_level", TagInt.class).getIntData());
        }
      }
    }
    if (tagCompound.getCompoundData().containsKey("buff_jump_boost_enable")) {
      jumpBoostChangeCheckBox.setSelected(true);
      if (tagCompound.getAs("buff_jump_boost_enable", TagByte.class).getBooleanData()) {
        jumpBoostEnableCheckBox.setSelected(true);
        if (tagCompound.getCompoundData().containsKey("buff_jump_boost_level")) {
          jumpBoostSpinner.setValue(
              tagCompound.getAs("buff_jump_boost_level", TagInt.class).getIntData());
        }
      }
    }
    if (tagCompound.getCompoundData().containsKey("buff_regeneration_enable")) {
      regenerationChangeCheckBox.setSelected(true);
      if (tagCompound.getAs("buff_regeneration_enable", TagByte.class).getBooleanData()) {
        regenerationEnableCheckBox.setSelected(true);
        if (tagCompound.getCompoundData().containsKey("buff_regeneration_level")) {
          regenerationSpinner.setValue(
              tagCompound.getAs("buff_regeneration_level", TagInt.class).getIntData());
        }
      }
    }
    if (tagCompound.getCompoundData().containsKey("buff_resistance_enable")) {
      resistanceChangeCheckBox.setSelected(true);
      if (tagCompound.getAs("buff_resistance_enable", TagByte.class).getBooleanData()) {
        resistanceEnableCheckBox.setSelected(true);
        if (tagCompound.getCompoundData().containsKey("buff_resistance_level")) {
          resistanceSpinner.setValue(
              tagCompound.getAs("buff_resistance_level", TagInt.class).getIntData());
        }
      }
    }
    if (tagCompound.getCompoundData().containsKey("buff_fire_resistance_enable")) {
      fireResistanceChangeCheckBox.setSelected(true);
      if (tagCompound.getAs("buff_fire_resistance_enable", TagByte.class).getBooleanData()) {
        fireResistanceEnableCheckBox.setSelected(true);
      }
    }
    if (tagCompound.getCompoundData().containsKey("buff_water_breathing_enable")) {
      waterBreathingChangeCheckBox.setSelected(true);
      if (tagCompound.getAs("buff_water_breathing_enable", TagByte.class).getBooleanData()) {
        waterBreathingEnableCheckBox.setSelected(true);
      }
    }
    if (tagCompound.getCompoundData().containsKey("buff_invisibility_enable")) {
      invisibilityChangeCheckBox.setSelected(true);
      if (tagCompound.getAs("buff_invisibility_enable", TagByte.class).getBooleanData()) {
        invisibilityEnableCheckBox.setSelected(true);
      }
    }
    if (tagCompound.getCompoundData().containsKey("buff_night_vision_enable")) {
      nightVisionChangeCheckBox.setSelected(true);
      if (tagCompound.getAs("buff_night_vision_enable", TagByte.class).getBooleanData()) {
        nightVisionEnableCheckBox.setSelected(true);
      }
    }
    if (tagCompound.getCompoundData().containsKey("buff_health_boost_enable")) {
      healthBoostChangeCheckBox.setSelected(true);
      if (tagCompound.getAs("buff_health_boost_enable", TagByte.class).getBooleanData()) {
        healthBoostEnableCheckBox.setSelected(true);
        if (tagCompound.getCompoundData().containsKey("buff_health_boost_level")) {
          healthBoostSpinner.setValue(
              tagCompound.getAs("buff_health_boost_level", TagInt.class).getIntData());
        }
      }
    }
    if (tagCompound.getCompoundData().containsKey("buff_absorption_enable")) {
      absorptionChangeCheckBox.setSelected(true);
      if (tagCompound.getAs("buff_absorption_enable", TagByte.class).getBooleanData()) {
        absorptionEnableCheckBox.setSelected(true);
        if (tagCompound.getCompoundData().containsKey("buff_absorption_level")) {
          absorptionSpinner.setValue(
              tagCompound.getAs("buff_absorption_level", TagInt.class).getIntData());
        }
      }
    }

    if (!tagCompound.getCompoundData().containsKey("addset_duration")
        || tagCompound.getAs("addset_duration", TagString.class).getStringData().equals("add")) {
      addDurationRadioButton.setSelected(true);
    } else {
      setDurationRadioButton.setSelected(true);
    }
    if (tagCompound.getCompoundData().containsKey("duration")) {
      durationInput.setText("" + tagCompound.getAs("duration", TagInt.class).getIntData());
    }

    if (!tagCompound.getCompoundData().containsKey("addset_range")
        || tagCompound.getAs("addset_range", TagString.class).getStringData().equals("add")) {
      addRangeRadioButton.setSelected(true);
    } else {
      setRangeRadioButton.setSelected(true);
    }
    if (tagCompound.getCompoundData().containsKey("range")) {
      rangeInput.setText("" + tagCompound.getAs("range", TagDouble.class).getDoubleData());
    }

    if (tagCompound.getCompoundData().containsKey("addset_selection_count")
        && tagCompound
            .getAs("addset_selection_count", TagString.class)
            .getStringData()
            .equals("add")) {
      addSelectionCount.setSelected(false);
    } else {
      setSelectionCount.setSelected(true);
    }
    if (tagCompound.getCompoundData().containsKey("selection_count")) {
      selectionCountSpinner.setValue(
          tagCompound.getAs("selection_count", TagInt.class).getIntData());
    }
  }