Search in sources :

Example 6 with DyeColorWrapper

use of simplepets.brainsynder.wrapper.DyeColorWrapper in project SimplePets by brainsynder-Dev.

the class Color method onLeftClick.

@Override
public void onLeftClick() {
    if (entityPet instanceof IColorable) {
        IColorable var = (IColorable) entityPet;
        DyeColorWrapper wrapper = DyeColorWrapper.WHITE;
        if (var.getColor() != null)
            wrapper = var.getColor();
        var.setColor(DyeColorWrapper.getNext(wrapper));
    }
}
Also used : DyeColorWrapper(simplepets.brainsynder.wrapper.DyeColorWrapper) IColorable(simplepets.brainsynder.api.entity.misc.IColorable)

Example 7 with DyeColorWrapper

use of simplepets.brainsynder.wrapper.DyeColorWrapper in project SimplePets by brainsynder-Dev.

the class Color method getDefaultItems.

@Override
public List<ItemBuilder> getDefaultItems() {
    List<ItemBuilder> items = new ArrayList<>();
    for (DyeColorWrapper color : DyeColorWrapper.values()) {
        ItemBuilder item = ItemBuilder.getColored(simple.brainsynder.utils.MatType.WOOL, color.getWoolData());
        item.withName(" ");
        item.addLore("&6Previous: %prev_color%%prev_name%", "&6Current: %curr_color%%curr_name%", "&6Next: %next_color%%next_name%");
        items.add(item);
    }
    return items;
}
Also used : ItemBuilder(simple.brainsynder.api.ItemBuilder) DyeColorWrapper(simplepets.brainsynder.wrapper.DyeColorWrapper) ArrayList(java.util.ArrayList)

Example 8 with DyeColorWrapper

use of simplepets.brainsynder.wrapper.DyeColorWrapper in project SimplePets by brainsynder-Dev.

the class BodyColor method onLeftClick.

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

Example 9 with DyeColorWrapper

use of simplepets.brainsynder.wrapper.DyeColorWrapper in project SimplePets by brainsynder-Dev.

the class BodyColor method getItem.

@Override
public ItemBuilder getItem() {
    ItemBuilder item = type.getDataItemByName("bodycolor", 0);
    if (getEntityPet() instanceof IEntityTropicalFishPet) {
        IEntityTropicalFishPet var = (IEntityTropicalFishPet) getEntityPet();
        DyeColorWrapper wrapper = DyeColorWrapper.WHITE;
        if (var.getBodyColor() != null)
            wrapper = var.getBodyColor();
        item = type.getDataItemByName("bodycolor", 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 10 with DyeColorWrapper

use of simplepets.brainsynder.wrapper.DyeColorWrapper in project SimplePets by brainsynder-Dev.

the class BodyColor method getDefaultItems.

@Override
public List<ItemBuilder> getDefaultItems() {
    List<ItemBuilder> items = new ArrayList<>();
    for (DyeColorWrapper color : DyeColorWrapper.values()) {
        ItemBuilder item = ItemBuilder.getColored(simple.brainsynder.utils.MatType.WOOL, color.getWoolData());
        item.withName(" ");
        item.addLore("&6Previous: %prev_color%%prev_name%", "&6Current: %curr_color%%curr_name%", "&6Next: %next_color%%next_name%");
        items.add(item);
    }
    return items;
}
Also used : ItemBuilder(simple.brainsynder.api.ItemBuilder) DyeColorWrapper(simplepets.brainsynder.wrapper.DyeColorWrapper) ArrayList(java.util.ArrayList)

Aggregations

DyeColorWrapper (simplepets.brainsynder.wrapper.DyeColorWrapper)16 ArrayList (java.util.ArrayList)8 ItemBuilder (simple.brainsynder.api.ItemBuilder)8 IColorable (simplepets.brainsynder.api.entity.misc.IColorable)6 IEntityTropicalFishPet (simplepets.brainsynder.api.entity.passive.IEntityTropicalFishPet)6 JSONArray (org.json.simple.JSONArray)4