• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java MobEffect类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



MobEffect类属于net.minecraft.server包,在下文中一共展示了MobEffect类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: getEffectsFromDamage

import net.minecraft.server.MobEffect; //导入依赖的package包/类
public Collection<PotionEffect> getEffectsFromDamage(int damage) {
    if (cache.containsKey(damage))
        return cache.get(damage);

    List<?> mcEffects = net.minecraft.server.PotionBrewer.getEffects(damage, false);
    List<PotionEffect> effects = new ArrayList<PotionEffect>();
    if (mcEffects == null)
        return effects;

    for (Object raw : mcEffects) {
        if (raw == null || !(raw instanceof MobEffect))
            continue;
        MobEffect mcEffect = (MobEffect) raw;
        PotionEffect effect = new PotionEffect(PotionEffectType.getById(mcEffect.getEffectId()),
                mcEffect.getDuration(), mcEffect.getAmplifier());
        // Minecraft PotionBrewer applies duration modifiers automatically.
        effects.add(effect);
    }

    cache.put(damage, effects);

    return effects;
}
 
开发者ID:OvercastNetwork,项目名称:CraftBukkit,代码行数:24,代码来源:CraftPotionBrewer.java


示例2: addCustomEffect

import net.minecraft.server.MobEffect; //导入依赖的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


示例3: removeCustomEffect

import net.minecraft.server.MobEffect; //导入依赖的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


示例4: addCustomEffect

import net.minecraft.server.MobEffect; //导入依赖的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


示例5: removeCustomEffect

import net.minecraft.server.MobEffect; //导入依赖的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


示例6: testEffectCompleteness

import net.minecraft.server.MobEffect; //导入依赖的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


示例7: addPotionEffect

import net.minecraft.server.MobEffect; //导入依赖的package包/类
public boolean addPotionEffect(PotionEffect effect, boolean force) {
    if (hasPotionEffect(effect.getType())) {
        if (!force) {
            return false;
        }
        removePotionEffect(effect.getType());
    }
    getHandle().addEffect(new MobEffect(effect.getType().getId(), effect.getDuration(), effect.getAmplifier(), effect.isAmbient()));
    return true;
}
 
开发者ID:OvercastNetwork,项目名称:CraftBukkit,代码行数:11,代码来源:CraftLivingEntity.java


示例8: getActivePotionEffects

import net.minecraft.server.MobEffect; //导入依赖的package包/类
public Collection<PotionEffect> getActivePotionEffects() {
    List<PotionEffect> effects = new ArrayList<PotionEffect>();
    for (Object raw : getHandle().effects.values()) {
        if (!(raw instanceof MobEffect))
            continue;
        MobEffect handle = (MobEffect) raw;
        effects.add(new PotionEffect(PotionEffectType.getById(handle.getEffectId()), handle.getDuration(), handle.getAmplifier(), handle.isAmbient()));
    }
    return effects;
}
 
开发者ID:OvercastNetwork,项目名称:CraftBukkit,代码行数:11,代码来源:CraftLivingEntity.java


示例9: addPotionEffect

import net.minecraft.server.MobEffect; //导入依赖的package包/类
public boolean addPotionEffect(PotionEffect effect, boolean force) {
    if (hasPotionEffect(effect.getType())) {
        if (!force) {
            return false;
        }
        removePotionEffect(effect.getType());
    }
    getHandle().addEffect(new MobEffect(effect.getType().getId(), effect.getDuration(), effect.getAmplifier(), effect.isAmbient(), effect.hasParticles()));
    return true;
}
 
开发者ID:tgnmc,项目名称:Craftbukkit,代码行数:11,代码来源:CraftLivingEntity.java


示例10: getActivePotionEffects

import net.minecraft.server.MobEffect; //导入依赖的package包/类
public Collection<PotionEffect> getActivePotionEffects() {
    List<PotionEffect> effects = new ArrayList<PotionEffect>();
    for (Object raw : getHandle().effects.values()) {
        if (!(raw instanceof MobEffect))
            continue;
        MobEffect handle = (MobEffect) raw;
        effects.add(new PotionEffect(PotionEffectType.getById(handle.getEffectId()), handle.getDuration(), handle.getAmplifier(), handle.isAmbient(), handle.isShowParticles()));
    }
    return effects;
}
 
开发者ID:tgnmc,项目名称:Craftbukkit,代码行数:11,代码来源:CraftLivingEntity.java


示例11: addPotionEffect

import net.minecraft.server.MobEffect; //导入依赖的package包/类
public boolean addPotionEffect(PotionEffect effect, boolean force) {
    if (hasPotionEffect(effect.getType())) {
        if (!force) {
            return false;
        }
        // removePotionEffect(effect.getType()); // Tweakkit - Now completely unecessary since this is updated internally
    }
    // Tweakkit
    getHandle().addEffect(new MobEffect(effect.getType().getId(), effect.getDuration(), effect.getAmplifier(), effect.isAmbient()), EntityPotionEffectChangeEvent.Cause.PLUGIN_ADDED);
    return true;
}
 
开发者ID:pvginkel,项目名称:Tweakkit-Server,代码行数:12,代码来源:CraftLivingEntity.java


示例12: addPotionEffect

import net.minecraft.server.MobEffect; //导入依赖的package包/类
public boolean addPotionEffect(PotionEffect effect, boolean force) {
    if (hasPotionEffect(effect.getType())) {
        if (!force) {
            return false;
        }
        removePotionEffect(effect.getType());
    }
    getHandle().addEffect(new MobEffect(MobEffectList.fromId(effect.getType().getId()), effect.getDuration(), effect.getAmplifier(), effect.isAmbient(), effect.hasParticles()));
    return true;
}
 
开发者ID:bergerkiller,项目名称:SpigotSource,代码行数:11,代码来源:CraftLivingEntity.java


示例13: getActivePotionEffects

import net.minecraft.server.MobEffect; //导入依赖的package包/类
public Collection<PotionEffect> getActivePotionEffects() {
    List<PotionEffect> effects = new ArrayList<PotionEffect>();
    for (MobEffect handle : getHandle().effects.values()) {
        effects.add(new PotionEffect(PotionEffectType.getById(MobEffectList.getId(handle.getMobEffect())), handle.getDuration(), handle.getAmplifier(), handle.isAmbient(), handle.isShowParticles()));
    }
    return effects;
}
 
开发者ID:bergerkiller,项目名称:SpigotSource,代码行数:8,代码来源:CraftLivingEntity.java


示例14: getEffects

import net.minecraft.server.MobEffect; //导入依赖的package包/类
public Collection<PotionEffect> getEffects() {
    ImmutableList.Builder<PotionEffect> builder = ImmutableList.builder();
    for (MobEffect effect : PotionUtil.getEffects(getHandle().getItem())) {
        builder.add(CraftPotionUtil.toBukkit(effect));
    }
    return builder.build();
}
 
开发者ID:bergerkiller,项目名称:SpigotSource,代码行数:8,代码来源:CraftThrownPotion.java


示例15: getCustomEffects

import net.minecraft.server.MobEffect; //导入依赖的package包/类
@Override
public List<PotionEffect> getCustomEffects() {
    ImmutableList.Builder<PotionEffect> builder = ImmutableList.builder();
    for (MobEffect effect : getHandle().h) {
        builder.add(CraftPotionUtil.toBukkit(effect));
    }
    return builder.build();
}
 
开发者ID:bergerkiller,项目名称:SpigotSource,代码行数:9,代码来源:CraftTippedArrow.java


示例16: hasCustomEffect

import net.minecraft.server.MobEffect; //导入依赖的package包/类
@Override
public boolean hasCustomEffect(PotionEffectType type) {
    for (MobEffect effect : getHandle().h) {
        if (CraftPotionUtil.equals(effect.getMobEffect(), type)) {
            return true;
        }
    }
    return false;
}
 
开发者ID:bergerkiller,项目名称:SpigotSource,代码行数:10,代码来源:CraftTippedArrow.java


示例17: getCustomEffects

import net.minecraft.server.MobEffect; //导入依赖的package包/类
@Override
public List<PotionEffect> getCustomEffects() {
    ImmutableList.Builder<PotionEffect> builder = ImmutableList.builder();
    for (MobEffect effect : getHandle().effects) {
        builder.add(CraftPotionUtil.toBukkit(effect));
    }
    return builder.build();
}
 
开发者ID:bergerkiller,项目名称:SpigotSource,代码行数:9,代码来源:CraftAreaEffectCloud.java


示例18: hasCustomEffect

import net.minecraft.server.MobEffect; //导入依赖的package包/类
@Override
public boolean hasCustomEffect(PotionEffectType type) {
    for (MobEffect effect : getHandle().effects) {
        if (CraftPotionUtil.equals(effect.getMobEffect(), type)) {
            return true;
        }
    }
    return false;
}
 
开发者ID:bergerkiller,项目名称:SpigotSource,代码行数:10,代码来源:CraftAreaEffectCloud.java


示例19: toBukkit

import net.minecraft.server.MobEffect; //导入依赖的package包/类
public static PotionEffect toBukkit(MobEffect effect) {
    PotionEffectType type = PotionEffectType.getById(MobEffectList.getId(effect.getMobEffect()));
    int amp = effect.getAmplifier();
    int duration = effect.getDuration();
    boolean ambient = effect.isAmbient();
    boolean particles = effect.isShowParticles();
    return new PotionEffect(type, duration, amp, ambient, particles);
}
 
开发者ID:bergerkiller,项目名称:SpigotSource,代码行数:9,代码来源:CraftPotionUtil.java


示例20: getEffects

import net.minecraft.server.MobEffect; //导入依赖的package包/类
public Collection<PotionEffect> getEffects(PotionType damage, boolean upgraded, boolean extended) {
    if (cache.containsKey(damage))
        return cache.get(damage);

    List<MobEffect> mcEffects = PotionRegistry.a(CraftPotionUtil.fromBukkit(new PotionData(damage, extended, upgraded))).a();

    ImmutableList.Builder<PotionEffect> builder = new ImmutableList.Builder<PotionEffect>();
    for (MobEffect effect : mcEffects) {
        builder.add(CraftPotionUtil.toBukkit(effect));
    }

    cache.put(damage, builder.build());

    return cache.get(damage);
}
 
开发者ID:bergerkiller,项目名称:SpigotSource,代码行数:16,代码来源:CraftPotionBrewer.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java Utf8StorageConverter类代码示例发布时间:2022-05-23
下一篇:
Java NameReference类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap