@Override public void writePacketNBT(NBTTagCompound cmp) { cmp.setInteger(TAG_MANA, mana); cmp.setInteger(TAG_MANA_REQUIRED, manaRequired); cmp.setInteger(TAG_STAGE, stage.ordinal()); cmp.setInteger(TAG_STAGE_TICKS, stageTicks); cmp.setInteger(TAG_STAGE_3_END_TICKS, stage3EndTicks); NBTTagCompound itemCmp = new NBTTagCompound(); if(!itemToEnchant.isEmpty()) itemCmp = itemToEnchant.writeToNBT(itemCmp); cmp.setTag(TAG_ITEM, itemCmp); String enchStr = enchants.stream() .map(e -> Enchantment.REGISTRY.getNameForObject(e.enchantment) + "=" + e.enchantmentLevel) .collect(Collectors.joining(",")); cmp.setString(TAG_ENCHANTS, enchStr); }
@SideOnly( Side.CLIENT ) public String getModID() { if( this.uniqueID == null ) { this.uniqueID = Item.REGISTRY.getNameForObject( this.getDefinition().getItem() ); } if( this.uniqueID == null ) { return "** Null"; } return this.uniqueID.getResourceDomain() == null ? "** Null" : this.uniqueID.getResourceDomain(); }
private boolean canPullItem(EntityItem item) { if(item.isDead || SubTileSolegnolia.hasSolegnoliaAround(item)) return false; ItemStack stack = item.getItem(); if(stack.isEmpty() || stack.getItem() instanceof IManaItem || stack.getItem() instanceof IRelic || BLACKLIST.contains(Item.REGISTRY.getNameForObject(stack.getItem())) || BotaniaAPI.isItemBlacklistedFromMagnet(stack)) return false; BlockPos pos = new BlockPos(item); if(BotaniaAPI.isBlockBlacklistedFromMagnet(item.world.getBlockState(pos))) return false; if(BotaniaAPI.isBlockBlacklistedFromMagnet(item.world.getBlockState(pos.down()))) return false; return true; }
@Override public NBTTagCompound writeToNBT(NBTTagCompound tag) { tag.setString("ItemName", String.valueOf(Item.REGISTRY.getNameForObject(item))); return tag; }
public SpellPiece(Spell spell) { this.spell = spell; registryKey = PsiAPI.spellPieceRegistry.getNameForObject(getClass()); initParams(); }
/** * If the given biome is blacklisted for usage. * @param biome The biome * @return If blacklisted */ public boolean isUsageBlacklisted(Biome biome) { return usageBlacklistIds.contains(Biome.REGISTRY.getNameForObject(biome).toString()); } }
public static List<String> getVariantNames(Item item) { List<String> list = variantNames.get(item); if (list == null) { list = Collections.singletonList(Item.REGISTRY.getNameForObject(item).toString()); } return list; }
private static ModContainer identifyItem(Item item) { final ResourceLocation id = Item.REGISTRY.getNameForObject(item); return findModContainer(id); }
private boolean isValidBiome(Set<String> biomeSet, Biome biome) { ResourceLocation object = Biome.REGISTRY.getNameForObject(biome); return biomeSet.contains(object.toString()); }
private static void loadFromConfig(Configuration config, String key, ShedPattern defaultPattern) { String itemName = ""; int metadata = 0; int rate = -1; int lexiconSize = 40; if(defaultPattern != null) { itemName = Item.REGISTRY.getNameForObject(defaultPattern.getItemStack().getItem()).toString(); metadata = defaultPattern.getItemStack().getItemDamage(); rate = defaultPattern.rate; lexiconSize = defaultPattern.lexiconSize; } Property prop = config.get("Shedding", key + ".item", itemName); prop.setComment("Configuration of Shedding for "+key); itemName = prop.getString(); rate = config.get("Shedding", key + ".rate", rate).getInt(); metadata = config.get("Shedding", key + ".metadata", metadata).getInt(); lexiconSize = config.get("Shedding", key + ".lexiconDisplaySize", lexiconSize).getInt(); if(itemName != null && Item.REGISTRY.getObject(new ResourceLocation(itemName)) != null && rate != -1) patterns.add(new ShedPattern(EntityList.getClass(new ResourceLocation(key)), new ItemStack(Item.REGISTRY.getObject(new ResourceLocation(itemName)), 1, metadata), rate, lexiconSize)); }
@Override public boolean matches(ItemStack stack) { ResourceLocation resource = Item.REGISTRY.getNameForObject(stack.getItem()); return resource != null && resource.getResourceDomain().equals(mod); }
protected boolean canKineticateItem(ItemStack entityItem) { if(entityItem == null) return false; for(String name : KineticatorConfig.kineticateBlacklist) { if(REGISTRY.getNameForObject(entityItem.getItem()).toString().equals(name)) { return false; } } return true; }
@Override public NBTTagCompound writeToNBT(NBTTagCompound tag) { tag.setString("ItemName", String.valueOf(Item.REGISTRY.getNameForObject(item))); tag.setInteger("ItemMeta", meta); return tag; }
@Override public boolean matches(ItemStack itemStack) { // meat and diamonds are bad for composting ResourceLocation itemRL = Item.REGISTRY.getNameForObject(itemStack.getItem()); if (itemRL == null) return false; String itemName = itemRL.toString(); return itemNameBlacklist.contains(itemName); } });
@CCCommand(description = "Returns the itemID (String) of this ItemIdentifier") public String getIdName() { return Item.REGISTRY.getNameForObject(ident.item).toString(); }
protected boolean isNotBlacklisted(ItemStack itemStack) { if(itemStack.isEmpty()) return false; for(String name : itemBlacklist) { if(Item.REGISTRY.getNameForObject(itemStack.getItem()).toString().equals(name)) { return false; } } return true; }
@SuppressWarnings("UnusedDeclaration") @SubscribeEvent public void banBadTools(VeinminerHarvestFailedCheck event) { ItemStack currentEquipped = event.player.getHeldItemMainhand(); if(currentEquipped != null && currentEquipped.getItem() != null && Item.itemRegistry.getNameForObject(currentEquipped.getItem()) != null) { String item_name = Item.itemRegistry.getNameForObject(currentEquipped.getItem()).toString(); if(badTools.contains(item_name)) { event.allowContinue = Permission.FORCE_DENY; } } }
@Override public ITextComponent processStack(ItemStack stack) { return new TextComponentString(Item.REGISTRY.getNameForObject(stack.getItem()).toString()); } }, Size("amount", "count") {
@Override public NBTTagCompound writeToNBT(NBTTagCompound tag) { tag.setString("ItemName", String.valueOf(Item.REGISTRY.getNameForObject(item))); tag.setInteger("ItemMeta", meta); tag.setInteger("SellAmount", amount); tag.setLong("SellTotal", sell); return tag; }
public static NBTTagCompound writeItemStack(ItemStack stack, NBTTagCompound nbt) { ResourceLocation resourcelocation = Item.REGISTRY.getNameForObject(stack.getItem()); nbt.setString("id", resourcelocation == null ? "minecraft:air" : resourcelocation.toString()); nbt.setInteger("Count", stack.stackSize); nbt.setShort("Damage", (short)stack.getItemDamage()); if (stack.getTagCompound() != null) { nbt.setTag("tag", stack.getTagCompound()); } return nbt; }