本文整理匯總了Java中com.google.common.collect.HashMultimap.isEmpty方法的典型用法代碼示例。如果您正苦於以下問題:Java HashMultimap.isEmpty方法的具體用法?Java HashMultimap.isEmpty怎麽用?Java HashMultimap.isEmpty使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.google.common.collect.HashMultimap
的用法示例。
在下文中一共展示了HashMultimap.isEmpty方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: addInformation
import com.google.common.collect.HashMultimap; //導入方法依賴的package包/類
@Override
@SideOnly(Side.CLIENT)
@SuppressWarnings({ "rawtypes", "unchecked" })
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean isComplex) {
if (stack.getItemDamage() == 0)
return;
List<PotionEffect> effects = getEffects(stack);
HashMultimap<String, AttributeModifier> attributes = HashMultimap.create();
if (effects == null || effects.isEmpty()) {
String s = StatCollector.translateToLocal("potion.empty").trim();
list.add(EnumChatFormatting.GRAY + s);
} else
for (PotionEffect potioneffect : effects) {
String s1 = StatCollector.translateToLocal(potioneffect.getEffectName()).trim();
Potion potion = Potion.potionTypes[potioneffect.getPotionID()];
Map<IAttribute, AttributeModifier> map = potion.func_111186_k();
if (map != null && map.size() > 0)
for (Entry<IAttribute, AttributeModifier> entry : map.entrySet()) {
AttributeModifier attributemodifier = entry.getValue();
AttributeModifier attributemodifier1 = new AttributeModifier(attributemodifier.getName(), potion.func_111183_a(potioneffect.getAmplifier(), attributemodifier), attributemodifier.getOperation());
attributes.put(entry.getKey().getAttributeUnlocalizedName(), attributemodifier1);
}
if (potioneffect.getAmplifier() > 0)
s1 = s1 + " " + StatCollector.translateToLocal("potion.potency." + potioneffect.getAmplifier()).trim();
if (potioneffect.getDuration() > 20)
s1 = s1 + " (" + Potion.getDurationString(potioneffect) + ")";
if (potion.isBadEffect())
list.add(EnumChatFormatting.RED + s1);
else
list.add(EnumChatFormatting.GRAY + s1);
}
if (!attributes.isEmpty()) {
list.add("");
list.add(EnumChatFormatting.DARK_PURPLE + StatCollector.translateToLocal("potion.effects.whenDrank"));
for (Entry<String, AttributeModifier> entry1 : attributes.entries()) {
AttributeModifier attributemodifier2 = entry1.getValue();
double d0 = attributemodifier2.getAmount();
double d1;
if (attributemodifier2.getOperation() != 1 && attributemodifier2.getOperation() != 2)
d1 = attributemodifier2.getAmount();
else
d1 = attributemodifier2.getAmount() * 100.0D;
if (d0 > 0.0D)
list.add(EnumChatFormatting.BLUE + StatCollector.translateToLocalFormatted("attribute.modifier.plus." + attributemodifier2.getOperation(), new Object[] { ItemStack.field_111284_a.format(d1), StatCollector.translateToLocal("attribute.name." + entry1.getKey()) }));
else if (d0 < 0.0D) {
d1 *= -1.0D;
list.add(EnumChatFormatting.RED + StatCollector.translateToLocalFormatted("attribute.modifier.take." + attributemodifier2.getOperation(), new Object[] { ItemStack.field_111284_a.format(d1), StatCollector.translateToLocal("attribute.name." + entry1.getKey()) }));
}
}
}
}