當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。