Search in sources :

Example 1 with DyeColorWrapper

use of simplepets.brainsynder.wrapper.DyeColorWrapper 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 DyeColorWrapper

use of simplepets.brainsynder.wrapper.DyeColorWrapper 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 DyeColorWrapper

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

the class ShulkerColor method getDefaultItems.

@Override
public List<ItemBuilder> getDefaultItems() {
    List<ItemBuilder> items = new ArrayList<>();
    for (DyeColorWrapper color : DyeColorWrapper.values()) {
        String name = color.name();
        if (name.equalsIgnoreCase("SILVER") && (ServerVersion.getVersion() == ServerVersion.v1_13_R1 || ServerVersion.getVersion() == ServerVersion.v1_13_R2)) {
            name = "LIGHT_GRAY";
        }
        ItemBuilder item = new ItemBuilder(Utilities.findMaterial(name + "_SHULKER_BOX"));
        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 4 with DyeColorWrapper

use of simplepets.brainsynder.wrapper.DyeColorWrapper 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 5 with DyeColorWrapper

use of simplepets.brainsynder.wrapper.DyeColorWrapper 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)

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