use of net.minecraft.server.v1_16_R2.Item in project ORCID-Source by ORCID.
the class WorkManagerImpl method createItemList.
private List<Item> createItemList(WorkEntity workEntity) {
Item item = new Item();
item.setItemName(workEntity.getTitle());
item.setItemType(ItemType.WORK);
item.setPutCode(String.valueOf(workEntity.getId()));
return Arrays.asList(item);
}
use of net.minecraft.server.v1_16_R2.Item in project ORCID-Source by ORCID.
the class ExternalIDValidatorTest method testValidateNotificationItems.
@Test
public void testValidateNotificationItems() {
Item i = new Item();
Item i2 = new Item();
Items items = new Items();
ExternalID id1 = new ExternalID();
id1.setRelationship(Relationship.SELF);
id1.setType("doi");
id1.setValue("value1");
id1.setUrl(new Url("http://value1.com"));
ExternalID id2 = new ExternalID();
id2.setRelationship(Relationship.SELF);
id2.setType("source-work-id");
id2.setValue("value2");
id2.setUrl(new Url("http://value1.com"));
i.setExternalIdentifier(id1);
i2.setExternalIdentifier(id2);
items.getItems().add(i);
items.getItems().add(i2);
// both valid
validator.validateNotificationItems(items);
// IDS one valid, one invalid
id2.setType("blah");
try {
validator.validateNotificationItems(items);
fail("no exception thrown for invalid type");
} catch (Exception e) {
if (!(e instanceof ActivityIdentifierValidationException))
throw e;
}
// IDS one valid, one VALID due to null (at least we have to do this if we want other tests to pass!)
id2.setType(null);
validator.validateNotificationItems(items);
}
use of net.minecraft.server.v1_16_R2.Item in project ORCID-Source by ORCID.
the class EmailMessageSenderTest method createActivity.
private Item createActivity(ItemType actType, String actName, String doi) {
Item act = new Item();
act.setItemType(actType);
act.setItemName(actName);
ExternalID extId = new ExternalID();
extId.setType("doi");
extId.setValue(doi);
act.setExternalIdentifier(extId);
return act;
}
use of net.minecraft.server.v1_16_R2.Item in project MyPet by xXKeyleXx.
the class ConfigItem method load.
public void load(MaterialHolder material, String data) {
MinecraftKey key = new MinecraftKey(material.getLegacyName().getName());
Item item = Item.REGISTRY.get(key);
if (item == null) {
return;
}
net.minecraft.server.v1_8_R3.ItemStack is = new net.minecraft.server.v1_8_R3.ItemStack(item, 1, material.getLegacyName().getData());
if (data != null) {
NBTTagCompound tag = null;
String nbtString = data.trim();
if (nbtString.startsWith("{") && nbtString.endsWith("}")) {
try {
tag = MojangsonParser.parse(nbtString);
} catch (Exception e) {
MyPetApi.getLogger().warning("Error" + ChatColor.RESET + " in config: " + ChatColor.UNDERLINE + e.getLocalizedMessage() + ChatColor.RESET + " caused by:");
MyPetApi.getLogger().warning(item.getName() + " " + nbtString);
}
if (tag != null) {
is.setTag(tag);
}
}
}
this.item = CraftItemStack.asCraftMirror(is);
}
use of net.minecraft.server.v1_16_R2.Item in project powerbot by powerbot.
the class DrawItems method repaint.
public void repaint(final Graphics render) {
if (!ctx.game.loggedIn()) {
return;
}
render.setFont(new Font("Arial", 0, 10));
render.setColor(Color.green);
if (ctx.bank.opened()) {
final Component container = ctx.widgets.component(Constants.BANK_WIDGET, Constants.BANK_ITEMS);
final Rectangle r = container.viewportRect();
if (r != null) {
for (final Item item : ctx.bank.select()) {
final Component c = item.component();
if (c == null) {
continue;
}
final Rectangle r2 = c.boundingRect();
if (r2 == null) {
continue;
}
if (c.relativePoint().y == 0 || !r.contains(r2)) {
continue;
}
final Point p = c.screenPoint();
render.drawString(c.itemId() + "", p.x, p.y + c.height());
}
}
}
if (ctx.backpack.component().visible()) {
for (final Item item : ctx.backpack.select()) {
final Component c = item.component();
if (c == null) {
continue;
}
final Point p = c.screenPoint();
render.drawString(c.itemId() + "", p.x, p.y + c.height());
}
}
if (ctx.equipment.component().visible()) {
for (final Item item : ctx.equipment.select()) {
if (item == null) {
continue;
}
final Component c = item.component();
if (c == null) {
continue;
}
final Point p = c.screenPoint();
render.drawString(c.itemId() + "", p.x, p.y + c.height());
}
}
}
Aggregations