本文整理汇总了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;未经允许,请勿转载。 |
请发表评论