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