本文整理汇总了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));
}
}
}
}
示例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;
}
示例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
));
}
示例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;
}
示例5: getFromId
import org.bukkit.potion.PotionEffectType; //导入方法依赖的package包/类
private PotionEffectType getFromId() {
return PotionEffectType.getById(this.type);
}
示例6: getOriginal
import org.bukkit.potion.PotionEffectType; //导入方法依赖的package包/类
@Override
public Object getOriginal() {
return new PotionEffect(PotionEffectType.getById(type),duration,lv);
}