use of simple.brainsynder.api.ItemBuilder in project SimplePets by brainsynder-Dev.
the class EntityArmorStandPet method setOwner.
@Override
public void setOwner(boolean flag) {
minime = flag;
if (flag) {
ItemBuilder builder = ItemBuilder.getSkull(simple.brainsynder.utils.SkullType.PLAYER);
getEntity().setChestplate(new ItemBuilder(Material.DIAMOND_CHESTPLATE).build());
getEntity().setLeggings(new ItemBuilder(Material.IRON_LEGGINGS).build());
getEntity().setBoots(new ItemBuilder(Material.GOLDEN_BOOTS).build());
WebAPI.findTexture(getOwner().getUniqueId().toString(), PetCore.get(), texture -> {
builder.setTexture(texture);
if (isOwner())
getEntity().setHelmet(builder.build());
});
} else {
ItemStack air = new ItemStack(Material.AIR);
getEntity().setHelmet(air);
getEntity().setChestplate(air);
getEntity().setLeggings(air);
getEntity().setBoots(air);
org.bukkit.inventory.PlayerInventory inventory = getOwner().getInventory();
if (!getItems(EnumItemSlot.HEAD).isSimilar(checkItem(inventory.getHelmet())))
setSlot(EnumItemSlot.HEAD, checkItem(inventory.getHelmet()));
if (!getItems(EnumItemSlot.CHEST).isSimilar(checkItem(inventory.getChestplate())))
setSlot(EnumItemSlot.CHEST, checkItem(inventory.getChestplate()));
if (!getItems(EnumItemSlot.LEGS).isSimilar(checkItem(inventory.getLeggings())))
setSlot(EnumItemSlot.LEGS, checkItem(inventory.getLeggings()));
if (!getItems(EnumItemSlot.FEET).isSimilar(checkItem(inventory.getBoots())))
setSlot(EnumItemSlot.FEET, checkItem(inventory.getBoots()));
}
}
use of simple.brainsynder.api.ItemBuilder 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 simple.brainsynder.api.ItemBuilder 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 simple.brainsynder.api.ItemBuilder in project SimplePets by brainsynder-Dev.
the class Stand method getItem.
@Override
public ItemBuilder getItem() {
ItemBuilder item = type.getDataItemByName("stand", 0);
if (entityPet instanceof IEntityArmorStandPet) {
IEntityArmorStandPet var = (IEntityArmorStandPet) entityPet;
item.withName(item.getName().replace("%value%", String.valueOf(var.isSmall())));
} else if (entityPet instanceof IEntityPolarBearPet) {
IEntityPolarBearPet var = (IEntityPolarBearPet) entityPet;
item.withName(item.getName().replace("%value%", String.valueOf(var.isStanding())));
}
return item;
}
use of simple.brainsynder.api.ItemBuilder in project SimplePets by brainsynder-Dev.
the class Eating method getItem.
@Override
public ItemBuilder getItem() {
ItemBuilder item = type.getDataItemByName(getTargetName(), 0);
if (item != null) {
if (entityPet instanceof IHorseAbstract) {
IHorseAbstract var = (IHorseAbstract) entityPet;
item.withName(item.getName().replace("%value%", String.valueOf(var.isEating())));
}
}
return item;
}
Aggregations