Search in sources :

Example 16 with TagDouble

use of de.keyle.knbt.TagDouble in project MyPet by xXKeyleXx.

the class Pickup method save.

@Override
public void save(TagCompound tagCompound) {
    tagCompound.getCompoundData().put("addset_range", new TagString(addRangeRadioButton.isSelected() ? "add" : "set"));
    tagCompound.getCompoundData().put("range", new TagDouble(Double.parseDouble(rangeInput.getText())));
    tagCompound.getCompoundData().put("exp_pickup", new TagByte(expPickupCheckBox.isSelected()));
}
Also used : TagString(de.keyle.knbt.TagString) TagByte(de.keyle.knbt.TagByte) TagDouble(de.keyle.knbt.TagDouble)

Example 17 with TagDouble

use of de.keyle.knbt.TagDouble in project MyPet by xXKeyleXx.

the class Ranged method load.

@Override
public void load(TagCompound TagCompound) {
    if (!TagCompound.getCompoundData().containsKey("addset_damage") || TagCompound.getAs("addset_damage", TagString.class).getStringData().equals("add")) {
        addDamageRadioButton.setSelected(true);
    } else {
        setDamageRadioButton.setSelected(true);
    }
    if (TagCompound.getCompoundData().containsKey("damage")) {
        TagCompound.getCompoundData().put("damage_double", new TagDouble(TagCompound.getAs("damage", TagInt.class).getIntData()));
        TagCompound.getCompoundData().remove("damage");
    }
    if (TagCompound.getCompoundData().containsKey("damage_double")) {
        damageInput.setText("" + TagCompound.getAs("damage_double", TagDouble.class).getDoubleData());
    }
    if (TagCompound.getCompoundData().containsKey("projectile")) {
        String projectileName = TagCompound.getAs("projectile", TagString.class).getStringData();
        for (int i = 0; i < projectileComboBox.getItemCount(); i++) {
            if (((String) projectileComboBox.getItemAt(i)).replace(" ", "").equalsIgnoreCase(projectileName)) {
                projectileComboBox.setSelectedIndex(i);
                break;
            }
        }
    }
    if (!TagCompound.getCompoundData().containsKey("addset_rateoffire") || TagCompound.getAs("addset_rateoffire", TagString.class).getStringData().equals("add")) {
        addRateOfFireRadioButton.setSelected(true);
    } else {
        setRateOfFireRadioButton.setSelected(true);
    }
    if (TagCompound.getCompoundData().containsKey("rateoffire")) {
        rateOfFireInput.setText("" + TagCompound.getAs("rateoffire", TagInt.class).getIntData());
    }
}
Also used : TagInt(de.keyle.knbt.TagInt) TagString(de.keyle.knbt.TagString) TagString(de.keyle.knbt.TagString) TagDouble(de.keyle.knbt.TagDouble)

Aggregations

TagDouble (de.keyle.knbt.TagDouble)17 TagString (de.keyle.knbt.TagString)17 TagInt (de.keyle.knbt.TagInt)14 DamageInfo (de.Keyle.MyPet.api.skill.skills.DamageInfo)1 HealInfo (de.Keyle.MyPet.api.skill.skills.HealInfo)1 LifeInfo (de.Keyle.MyPet.api.skill.skills.LifeInfo)1 LightningInfo (de.Keyle.MyPet.api.skill.skills.LightningInfo)1 RangedInfo (de.Keyle.MyPet.api.skill.skills.RangedInfo)1 TagByte (de.keyle.knbt.TagByte)1