本文整理汇总了Java中net.minecraft.item.ItemPotion.getEffects方法的典型用法代码示例。如果您正苦于以下问题:Java ItemPotion.getEffects方法的具体用法?Java ItemPotion.getEffects怎么用?Java ItemPotion.getEffects使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.minecraft.item.ItemPotion
的用法示例。
在下文中一共展示了ItemPotion.getEffects方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getPotionFromInventory
import net.minecraft.item.ItemPotion; //导入方法依赖的package包/类
private int getPotionFromInventory() {
int pot = -1;
int counter = 0;
int i = 1;
while (i < 45) {
ItemStack is;
ItemPotion potion;
Item item;
if (this.mc.thePlayer.inventoryContainer.getSlot(i).getHasStack() && (item = (is = this.mc.thePlayer.inventoryContainer.getSlot(i).getStack()).getItem()) instanceof ItemPotion && (potion = (ItemPotion)item).getEffects(is) != null) {
for (Object o : potion.getEffects(is)) {
PotionEffect effect = (PotionEffect)o;
if (effect.getPotionID() != Potion.heal.id || !ItemPotion.isSplash((int)is.getItemDamage())) continue;
++counter;
pot = i;
}
}
++i;
}
Character colorFormatCharacter = new Character('\u00a7');
this.suffix = OptionManager.getOption((String)"Hyphen", (Module)ModuleManager.getModule(HUD.class)).value ? colorFormatCharacter + "7 - " + counter : colorFormatCharacter + "7 " + counter;
return pot;
}
示例2: getMeta
import net.minecraft.item.ItemPotion; //导入方法依赖的package包/类
@Override
public Object getMeta(ItemPotion target, ItemStack stack) {
final Map<String, Object> results = Maps.newHashMap();
results.put("splash", ItemPotion.isSplash(stack.getItemDamage()));
final List<Map<String, Object>> effectsInfo = Lists.newArrayList();
@SuppressWarnings("unchecked")
final List<PotionEffect> effects = target.getEffects(stack);
if (effects != null) {
for (PotionEffect effect : effects) {
final Map<String, Object> entry = Maps.newHashMap();
entry.put("duration", effect.getDuration() / 20); // ticks!
entry.put("amplifier", effect.getAmplifier());
entry.put("effect", getPotionInfo(effect.getPotionID()));
effectsInfo.add(entry);
}
}
results.put("effects", effectsInfo);
return results;
}