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


Java PotionEffectType.getById方法代码示例

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


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

示例1: CraftMetaPotion

import org.bukkit.potion.PotionEffectType; //导入方法依赖的package包/类
CraftMetaPotion(net.minecraft.nbt.NBTTagCompound tag) {
    super(tag);

    if (tag.hasKey(POTION_EFFECTS.NBT)) {
        net.minecraft.nbt.NBTTagList list = tag.getTagList(POTION_EFFECTS.NBT, 10);
        int length = list.tagCount();
        if (length > 0) {
            customEffects = new ArrayList<PotionEffect>(length);

            for (int i = 0; i < length; i++) {
                net.minecraft.nbt.NBTTagCompound effect = list.getCompoundTagAt(i);
                PotionEffectType type = PotionEffectType.getById(effect.getByte(ID.NBT));
                int amp = effect.getByte(AMPLIFIER.NBT);
                int duration = effect.getInteger(DURATION.NBT);
                boolean ambient = effect.getBoolean(AMBIENT.NBT);
                customEffects.add(new PotionEffect(type, duration, amp, ambient));
            }
        }
    }
}
 
开发者ID:UraniumMC,项目名称:Uranium,代码行数:21,代码来源:CraftMetaPotion.java

示例2: getEffectsFromDamage

import org.bukkit.potion.PotionEffectType; //导入方法依赖的package包/类
public Collection<PotionEffect> getEffectsFromDamage(int damage) {
    if (cache.containsKey(damage))
        return cache.get(damage);

    List<?> mcEffects = net.minecraft.potion.PotionHelper.getPotionEffects(damage, false);
    List<PotionEffect> effects = new ArrayList<PotionEffect>();
    if (mcEffects == null)
        return effects;

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

    cache.put(damage, effects);

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

示例3: read

import org.bukkit.potion.PotionEffectType; //导入方法依赖的package包/类
@Override
public void read(DataInputStream input) throws IOException {
    PotionEffectType type = PotionEffectType.getById(input.readInt());
    int duration = input.readInt();
    int amplifier = input.readInt();
    boolean aimbient = input.readBoolean();
    boolean particles = input.readBoolean();
    int r = input.readInt();
    int g = input.readInt();
    int b = input.readInt();
    Color color = Color.fromRGB(r, g, b);
    
    setValue(new PotionEffect(
            type,
            duration, amplifier,
            aimbient, particles, color
    ));
}
 
开发者ID:OrigamiDream,项目名称:Leveled-Storage,代码行数:19,代码来源:PotionEffectStorage.java

示例4: getActivePotionEffects

import org.bukkit.potion.PotionEffectType; //导入方法依赖的package包/类
public Collection<PotionEffect> getActivePotionEffects() {
    List<PotionEffect> effects = new ArrayList<PotionEffect>();
    for (Object raw : getHandle().activePotionsMap.values()) {
        if (!(raw instanceof net.minecraft.potion.PotionEffect))
            continue;
        net.minecraft.potion.PotionEffect handle = (net.minecraft.potion.PotionEffect) raw;
        if (PotionEffectType.getById(handle.getPotionID()) == null) continue; // Cauldron - ignore null types
        effects.add(new PotionEffect(PotionEffectType.getById(handle.getPotionID()), handle.getDuration(), handle.getAmplifier(), handle.getIsAmbient()));
    }
    return effects;
}
 
开发者ID:UraniumMC,项目名称:Uranium,代码行数:12,代码来源:CraftLivingEntity.java

示例5: getFromId

import org.bukkit.potion.PotionEffectType; //导入方法依赖的package包/类
private PotionEffectType getFromId() {
    return PotionEffectType.getById(this.type);
}
 
开发者ID:Shynixn,项目名称:BlockBall,代码行数:4,代码来源:FastPotioneffect.java

示例6: getOriginal

import org.bukkit.potion.PotionEffectType; //导入方法依赖的package包/类
@Override
public Object getOriginal() {
    return new PotionEffect(PotionEffectType.getById(type),duration,lv);
}
 
开发者ID:DevCrafters,项目名称:SaveableSerializing,代码行数:5,代码来源:PotionEffects.java


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