Search in sources :

Example 1 with IEntityTropicalFishPet

use of simplepets.brainsynder.api.entity.passive.IEntityTropicalFishPet in project SimplePets by brainsynder-Dev.

the class BodyColor method onRightClick.

@Override
public void onRightClick() {
    if (entityPet instanceof IEntityTropicalFishPet) {
        IEntityTropicalFishPet var = (IEntityTropicalFishPet) entityPet;
        DyeColorWrapper wrapper = DyeColorWrapper.WHITE;
        if (var.getBodyColor() != null)
            wrapper = var.getBodyColor();
        var.setBodyColor(DyeColorWrapper.getPrevious(wrapper));
    }
}
Also used : DyeColorWrapper(simplepets.brainsynder.wrapper.DyeColorWrapper) IEntityTropicalFishPet(simplepets.brainsynder.api.entity.passive.IEntityTropicalFishPet)

Example 2 with IEntityTropicalFishPet

use of simplepets.brainsynder.api.entity.passive.IEntityTropicalFishPet in project SimplePets by brainsynder-Dev.

the class PatternColor method getItem.

@Override
public ItemBuilder getItem() {
    ItemBuilder item = new ItemBuilder(Material.AIR);
    if (getEntityPet() instanceof IEntityTropicalFishPet) {
        IEntityTropicalFishPet var = (IEntityTropicalFishPet) getEntityPet();
        DyeColorWrapper wrapper = DyeColorWrapper.WHITE;
        if (var.getPatternColor() != null)
            wrapper = var.getPatternColor();
        item = type.getDataItemByName("patterncolor", wrapper.getWoolData());
        DyeColorWrapper prev = DyeColorWrapper.getPrevious(wrapper);
        DyeColorWrapper next = DyeColorWrapper.getNext(wrapper);
        List<String> lore = new ArrayList<>();
        for (Object s : (JSONArray) item.toJSON().get("lore")) {
            String str = String.valueOf(s);
            lore.add(str.replace("%prev_color%", "§" + prev.getChatChar()).replace("%prev_name%", WordUtils.capitalize(prev.name().toLowerCase().replace("_", " "))).replace("%curr_color%", "§" + wrapper.getChatChar()).replace("%curr_name%", WordUtils.capitalize(wrapper.name().toLowerCase().replace("_", " "))).replace("%next_color%", "§" + next.getChatChar()).replace("%next_name%", WordUtils.capitalize(next.name().toLowerCase().replace("_", " "))));
        }
        item.withLore(lore);
    }
    return item;
}
Also used : ItemBuilder(simple.brainsynder.api.ItemBuilder) DyeColorWrapper(simplepets.brainsynder.wrapper.DyeColorWrapper) ArrayList(java.util.ArrayList) JSONArray(org.json.simple.JSONArray) IEntityTropicalFishPet(simplepets.brainsynder.api.entity.passive.IEntityTropicalFishPet)

Example 3 with IEntityTropicalFishPet

use of simplepets.brainsynder.api.entity.passive.IEntityTropicalFishPet in project SimplePets by brainsynder-Dev.

the class Pattern method getItem.

@Override
public ItemBuilder getItem() {
    ItemBuilder item = type.getDataItemByName("pattern", 0);
    if (getEntityPet() instanceof IEntityTropicalFishPet) {
        IEntityTropicalFishPet var = (IEntityTropicalFishPet) getEntityPet();
        TropicalPattern typeID = TropicalPattern.KOB;
        if (var.getPattern() != null)
            typeID = var.getPattern();
        TropicalPattern prev = TropicalPattern.getPrevious(typeID);
        TropicalPattern next = TropicalPattern.getNext(typeID);
        List<String> lore = new ArrayList<>();
        for (Object s : (JSONArray) item.toJSON().get("lore")) {
            String str = String.valueOf(s);
            lore.add(str.replace("%prev_state%", WordUtils.capitalize(prev.name().toLowerCase().replace("_", " "))).replace("%curr_state%", WordUtils.capitalize(typeID.name().toLowerCase().replace("_", " "))).replace("%next_state%", WordUtils.capitalize(next.name().toLowerCase().replace("_", " "))));
        }
        item.withLore(lore);
    }
    return item;
}
Also used : TropicalPattern(simplepets.brainsynder.wrapper.TropicalPattern) ItemBuilder(simple.brainsynder.api.ItemBuilder) ArrayList(java.util.ArrayList) JSONArray(org.json.simple.JSONArray) IEntityTropicalFishPet(simplepets.brainsynder.api.entity.passive.IEntityTropicalFishPet)

Example 4 with IEntityTropicalFishPet

use of simplepets.brainsynder.api.entity.passive.IEntityTropicalFishPet in project SimplePets by brainsynder-Dev.

the class Pattern method onLeftClick.

@Override
public void onLeftClick() {
    if (entityPet instanceof IEntityTropicalFishPet) {
        IEntityTropicalFishPet var = (IEntityTropicalFishPet) entityPet;
        TropicalPattern wrapper = TropicalPattern.KOB;
        if (var.getPattern() != null)
            wrapper = var.getPattern();
        var.setPattern(TropicalPattern.getNext(wrapper));
    }
}
Also used : TropicalPattern(simplepets.brainsynder.wrapper.TropicalPattern) IEntityTropicalFishPet(simplepets.brainsynder.api.entity.passive.IEntityTropicalFishPet)

Example 5 with IEntityTropicalFishPet

use of simplepets.brainsynder.api.entity.passive.IEntityTropicalFishPet in project SimplePets by brainsynder-Dev.

the class Pattern method onRightClick.

@Override
public void onRightClick() {
    if (entityPet instanceof IEntityTropicalFishPet) {
        IEntityTropicalFishPet var = (IEntityTropicalFishPet) entityPet;
        TropicalPattern wrapper = TropicalPattern.KOB;
        if (var.getPattern() != null)
            wrapper = var.getPattern();
        var.setPattern(TropicalPattern.getPrevious(wrapper));
    }
}
Also used : TropicalPattern(simplepets.brainsynder.wrapper.TropicalPattern) IEntityTropicalFishPet(simplepets.brainsynder.api.entity.passive.IEntityTropicalFishPet)

Aggregations

IEntityTropicalFishPet (simplepets.brainsynder.api.entity.passive.IEntityTropicalFishPet)9 DyeColorWrapper (simplepets.brainsynder.wrapper.DyeColorWrapper)6 ArrayList (java.util.ArrayList)3 JSONArray (org.json.simple.JSONArray)3 ItemBuilder (simple.brainsynder.api.ItemBuilder)3 TropicalPattern (simplepets.brainsynder.wrapper.TropicalPattern)3