Search in sources :

Example 1 with IColorable

use of simplepets.brainsynder.api.entity.misc.IColorable in project SimplePets by brainsynder-Dev.

the class ShulkerColor method onRightClick.

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

Example 2 with IColorable

use of simplepets.brainsynder.api.entity.misc.IColorable in project SimplePets by brainsynder-Dev.

the class ShulkerColor method getItem.

@Override
public ItemBuilder getItem() {
    ItemBuilder item = null;
    if (getEntityPet() instanceof IColorable) {
        IColorable var = (IColorable) getEntityPet();
        DyeColorWrapper typeID = DyeColorWrapper.PURPLE;
        if (var.getColor() != null)
            typeID = var.getColor();
        item = type.getDataItemByName("shulkercolor", typeID.getWoolData());
        DyeColorWrapper prev = DyeColorWrapper.getPrevious(typeID);
        DyeColorWrapper next = DyeColorWrapper.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_color%", "§" + prev.getChatChar()).replace("%prev_name%", WordUtils.capitalize(prev.name().toLowerCase())).replace("%curr_color%", "§" + typeID.getChatChar()).replace("%curr_name%", WordUtils.capitalize(typeID.name().toLowerCase())).replace("%next_color%", "§" + next.getChatChar()).replace("%next_name%", WordUtils.capitalize(next.name().toLowerCase())));
        }
        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) IColorable(simplepets.brainsynder.api.entity.misc.IColorable)

Example 3 with IColorable

use of simplepets.brainsynder.api.entity.misc.IColorable 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 4 with IColorable

use of simplepets.brainsynder.api.entity.misc.IColorable in project SimplePets by brainsynder-Dev.

the class ShulkerColor method onLeftClick.

@Override
public void onLeftClick() {
    if (entityPet instanceof IColorable) {
        IColorable var = (IColorable) entityPet;
        DyeColorWrapper wrapper = DyeColorWrapper.PURPLE;
        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 5 with IColorable

use of simplepets.brainsynder.api.entity.misc.IColorable in project SimplePets by brainsynder-Dev.

the class Color method onRightClick.

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

Aggregations

IColorable (simplepets.brainsynder.api.entity.misc.IColorable)6 DyeColorWrapper (simplepets.brainsynder.wrapper.DyeColorWrapper)6 ArrayList (java.util.ArrayList)2 JSONArray (org.json.simple.JSONArray)2 ItemBuilder (simple.brainsynder.api.ItemBuilder)2