当前位置: 首页>>代码示例>>Java>>正文


Java ItemPotion.getEffects方法代码示例

本文整理汇总了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;
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:23,代码来源:AutoPot.java

示例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;
}
 
开发者ID:OpenMods,项目名称:OpenPeripheral-Integration,代码行数:27,代码来源:ItemPotionMetaProvider.java


注:本文中的net.minecraft.item.ItemPotion.getEffects方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。