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


Java MobEffectList.getId方法代码示例

本文整理汇总了Java中net.minecraft.server.MobEffectList.getId方法的典型用法代码示例。如果您正苦于以下问题:Java MobEffectList.getId方法的具体用法?Java MobEffectList.getId怎么用?Java MobEffectList.getId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在net.minecraft.server.MobEffectList的用法示例。


在下文中一共展示了MobEffectList.getId方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: addCustomEffect

import net.minecraft.server.MobEffectList; //导入方法依赖的package包/类
@Override
public boolean addCustomEffect(PotionEffect effect, boolean override) {
    int effectId = effect.getType().getId();
    MobEffect existing = null;
    for (MobEffect mobEffect : getHandle().h) {
        if (MobEffectList.getId(mobEffect.getMobEffect()) == effectId) {
            existing = mobEffect;
        }
    }
    if (existing != null) {
        if (!override) {
            return false;
        }
        getHandle().h.remove(existing);
    }
    getHandle().a(CraftPotionUtil.fromBukkit(effect));
    getHandle().refreshEffects();
    return true;
}
 
开发者ID:bergerkiller,项目名称:SpigotSource,代码行数:20,代码来源:CraftTippedArrow.java

示例2: removeCustomEffect

import net.minecraft.server.MobEffectList; //导入方法依赖的package包/类
@Override
public boolean removeCustomEffect(PotionEffectType effect) {
    int effectId = effect.getId();
    MobEffect existing = null;
    for (MobEffect mobEffect : getHandle().h) {
        if (MobEffectList.getId(mobEffect.getMobEffect()) == effectId) {
            existing = mobEffect;
        }
    }
    if (existing == null) {
        return false;
    }
    Validate.isTrue(getBasePotionData().getType() != PotionType.UNCRAFTABLE || getHandle().h.size() != 1, "Tipped Arrows must have at least 1 effect");
    getHandle().h.remove(existing);
    getHandle().refreshEffects();
    return true;
}
 
开发者ID:bergerkiller,项目名称:SpigotSource,代码行数:18,代码来源:CraftTippedArrow.java

示例3: addCustomEffect

import net.minecraft.server.MobEffectList; //导入方法依赖的package包/类
@Override
public boolean addCustomEffect(PotionEffect effect, boolean override) {
    int effectId = effect.getType().getId();
    MobEffect existing = null;
    for (MobEffect mobEffect : getHandle().effects) {
        if (MobEffectList.getId(mobEffect.getMobEffect()) == effectId) {
            existing = mobEffect;
        }
    }
    if (existing != null) {
        if (!override) {
            return false;
        }
        getHandle().effects.remove(existing);
    }
    getHandle().a(CraftPotionUtil.fromBukkit(effect));
    getHandle().refreshEffects();
    return true;
}
 
开发者ID:bergerkiller,项目名称:SpigotSource,代码行数:20,代码来源:CraftAreaEffectCloud.java

示例4: removeCustomEffect

import net.minecraft.server.MobEffectList; //导入方法依赖的package包/类
@Override
public boolean removeCustomEffect(PotionEffectType effect) {
    int effectId = effect.getId();
    MobEffect existing = null;
    for (MobEffect mobEffect : getHandle().effects) {
        if (MobEffectList.getId(mobEffect.getMobEffect()) == effectId) {
            existing = mobEffect;
        }
    }
    if (existing == null) {
        return false;
    }
    getHandle().effects.remove(existing);
    getHandle().refreshEffects();
    return true;
}
 
开发者ID:bergerkiller,项目名称:SpigotSource,代码行数:17,代码来源:CraftAreaEffectCloud.java

示例5: testEffectCompleteness

import net.minecraft.server.MobEffectList; //导入方法依赖的package包/类
@Test
public void testEffectCompleteness() throws Throwable {
    Map<PotionType, String> effects = new EnumMap(PotionType.class);
    for (PotionRegistry reg : PotionRegistry.a) {
        List<MobEffect> eff = reg.a();
        if (eff.size() != 1) continue;
        int id = MobEffectList.getId(eff.get(0).getMobEffect());
        PotionEffectType type = PotionEffectType.getById(id);
        assertNotNull(String.valueOf(id), PotionEffectType.getById(id));

        PotionType enumType = PotionType.getByEffect(type);
        assertNotNull(type.getName(), enumType);

        effects.put(enumType, enumType.name());
    }

    assertEquals(effects.entrySet().size(), PotionType.values().length - /* PotionTypes with no Effects */ 5);
}
 
开发者ID:bergerkiller,项目名称:SpigotSource,代码行数:19,代码来源:PotionTest.java

示例6: CraftPotionEffectType

import net.minecraft.server.MobEffectList; //导入方法依赖的package包/类
public CraftPotionEffectType(MobEffectList handle) {
    super(MobEffectList.getId(handle));
    this.handle = handle;
}
 
开发者ID:bergerkiller,项目名称:SpigotSource,代码行数:5,代码来源:CraftPotionEffectType.java


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