本文整理汇总了Java中net.minecraft.server.MobEffectList.getId方法的典型用法代码示例。如果您正苦于以下问题:Java MobEffectList.getId方法的具体用法?Java MobEffectList.getId怎么用?Java MobEffectList.getId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.minecraft.server.MobEffectList
的用法示例。
在下文中一共展示了MobEffectList.getId方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addCustomEffect
import net.minecraft.server.MobEffectList; //导入方法依赖的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;
}
示例2: removeCustomEffect
import net.minecraft.server.MobEffectList; //导入方法依赖的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;
}
示例3: addCustomEffect
import net.minecraft.server.MobEffectList; //导入方法依赖的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;
}
示例4: removeCustomEffect
import net.minecraft.server.MobEffectList; //导入方法依赖的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;
}
示例5: testEffectCompleteness
import net.minecraft.server.MobEffectList; //导入方法依赖的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);
}
示例6: CraftPotionEffectType
import net.minecraft.server.MobEffectList; //导入方法依赖的package包/类
public CraftPotionEffectType(MobEffectList handle) {
super(MobEffectList.getId(handle));
this.handle = handle;
}