Search in sources :

Example 1 with PufferState

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

the class PufferSize method getItem.

@Override
public ItemBuilder getItem() {
    ItemBuilder item = type.getDataItemByName("puffersize", 0);
    if (getEntityPet() instanceof IEntityPufferFishPet) {
        IEntityPufferFishPet var = (IEntityPufferFishPet) getEntityPet();
        PufferState typeID = PufferState.SMALL;
        if (var.getPuffState() != null)
            typeID = var.getPuffState();
        PufferState prev = PufferState.getPrevious(typeID);
        PufferState next = PufferState.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 : ItemBuilder(simple.brainsynder.api.ItemBuilder) PufferState(simplepets.brainsynder.wrapper.PufferState) IEntityPufferFishPet(simplepets.brainsynder.api.entity.hostile.IEntityPufferFishPet) ArrayList(java.util.ArrayList) JSONArray(org.json.simple.JSONArray)

Example 2 with PufferState

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

the class PufferSize method onLeftClick.

@Override
public void onLeftClick() {
    if (entityPet instanceof IEntityPufferFishPet) {
        IEntityPufferFishPet var = (IEntityPufferFishPet) entityPet;
        PufferState wrapper = PufferState.SMALL;
        if (var.getPuffState() != null)
            wrapper = var.getPuffState();
        var.setPuffState(PufferState.getNext(wrapper));
    }
}
Also used : PufferState(simplepets.brainsynder.wrapper.PufferState) IEntityPufferFishPet(simplepets.brainsynder.api.entity.hostile.IEntityPufferFishPet)

Example 3 with PufferState

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

the class PufferSize method onRightClick.

@Override
public void onRightClick() {
    if (entityPet instanceof IEntityPufferFishPet) {
        IEntityPufferFishPet var = (IEntityPufferFishPet) entityPet;
        PufferState wrapper = PufferState.SMALL;
        if (var.getPuffState() != null)
            wrapper = var.getPuffState();
        var.setPuffState(PufferState.getPrevious(wrapper));
    }
}
Also used : PufferState(simplepets.brainsynder.wrapper.PufferState) IEntityPufferFishPet(simplepets.brainsynder.api.entity.hostile.IEntityPufferFishPet)

Aggregations

IEntityPufferFishPet (simplepets.brainsynder.api.entity.hostile.IEntityPufferFishPet)3 PufferState (simplepets.brainsynder.wrapper.PufferState)3 ArrayList (java.util.ArrayList)1 JSONArray (org.json.simple.JSONArray)1 ItemBuilder (simple.brainsynder.api.ItemBuilder)1