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;
}
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));
}
}
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));
}
}
Aggregations