本文整理汇总了Java中net.minecraft.server.MobEffectList类的典型用法代码示例。如果您正苦于以下问题:Java MobEffectList类的具体用法?Java MobEffectList怎么用?Java MobEffectList使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
MobEffectList类属于net.minecraft.server包,在下文中一共展示了MobEffectList类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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;
}
开发者ID:bergerkiller,项目名称:SpigotSource,代码行数:20,代码来源:CraftTippedArrow.java
示例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;
}
开发者ID:bergerkiller,项目名称:SpigotSource,代码行数:18,代码来源:CraftTippedArrow.java
示例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;
}
开发者ID:bergerkiller,项目名称:SpigotSource,代码行数:20,代码来源:CraftAreaEffectCloud.java
示例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;
}
开发者ID:bergerkiller,项目名称:SpigotSource,代码行数:17,代码来源:CraftAreaEffectCloud.java
示例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);
}
开发者ID:bergerkiller,项目名称:SpigotSource,代码行数:19,代码来源:PotionTest.java
示例6: getPotion
import net.minecraft.server.MobEffectList; //导入依赖的package包/类
public static PotionEffect getPotion(Element potion) {
PotionEffectType type = PotionEffectType.getByName(Strings.getTechnicalName(potion.getText()));
if (type == null) type = new CraftPotionEffectType(MobEffectList.getByName(potion.getText().toLowerCase().replace(" ","_")));
int duration = (int) (Strings.timeStringToExactSeconds(potion.getAttributeValue("duration")) * 20);
int amplifier = 0;
boolean ambient = false;
if (potion.getAttributeValue("amplifier") != null)
amplifier = Numbers.parseInt(potion.getAttributeValue("amplifier")) - 1;
if (potion.getAttributeValue("ambient") != null)
ambient = Boolean.parseBoolean(potion.getAttributeValue("ambient").toUpperCase());
return new PotionEffect(type, duration, amplifier, ambient);
}
开发者ID:twizmwazin,项目名称:CardinalPGM,代码行数:13,代码来源:Parser.java
示例7: addPotionEffect
import net.minecraft.server.MobEffectList; //导入依赖的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
示例8: getActivePotionEffects
import net.minecraft.server.MobEffectList; //导入依赖的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
示例9: toBukkit
import net.minecraft.server.MobEffectList; //导入依赖的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
示例10: sendDeathEffects
import net.minecraft.server.MobEffectList; //导入依赖的package包/类
public static void sendDeathEffects(Player player, boolean blackout) {
sendPacket(player, new PacketPlayOutEntityEffect(player.getEntityId(),
new MobEffect(MobEffectList.getByName("nausea"), 100, 0, true, false)));
sendPacket(player, new PacketPlayOutEntityEffect(player.getEntityId(),
new MobEffect(MobEffectList.getByName("blindness"), blackout ? Integer.MAX_VALUE : 21, 0, true, false)));
}
开发者ID:OvercastNetwork,项目名称:ProjectAres,代码行数:7,代码来源:NMSHacks.java
示例11: clearDeathEffects
import net.minecraft.server.MobEffectList; //导入依赖的package包/类
public static void clearDeathEffects(Player player) {
sendPacket(player, new PacketPlayOutRemoveEntityEffect(player.getEntityId(), MobEffectList.getByName("nausea")));
sendPacket(player, new PacketPlayOutRemoveEntityEffect(player.getEntityId(), MobEffectList.getByName("blindness")));
}
开发者ID:OvercastNetwork,项目名称:ProjectAres,代码行数:5,代码来源:NMSHacks.java
示例12: hasPotionEffect
import net.minecraft.server.MobEffectList; //导入依赖的package包/类
public boolean hasPotionEffect(PotionEffectType type) {
return getHandle().hasEffect(MobEffectList.byId[type.getId()]);
}
开发者ID:OvercastNetwork,项目名称:CraftBukkit,代码行数:4,代码来源:CraftLivingEntity.java
示例13: CraftPotionEffectType
import net.minecraft.server.MobEffectList; //导入依赖的package包/类
public CraftPotionEffectType(MobEffectList handle) {
super(handle.id);
this.handle = handle;
}
开发者ID:OvercastNetwork,项目名称:CraftBukkit,代码行数:5,代码来源:CraftPotionEffectType.java
示例14: getHandle
import net.minecraft.server.MobEffectList; //导入依赖的package包/类
public MobEffectList getHandle() {
return handle;
}
开发者ID:OvercastNetwork,项目名称:CraftBukkit,代码行数:4,代码来源:CraftPotionEffectType.java
示例15: CraftServer
import net.minecraft.server.MobEffectList; //导入依赖的package包/类
public CraftServer(MinecraftServer console, PlayerList playerList) {
this.console = console;
this.playerList = (DedicatedPlayerList) playerList;
this.serverVersion = CraftServer.class.getPackage().getImplementationVersion();
online.value = console.getPropertyManager().getBoolean("online-mode", true);
Bukkit.setServer(this);
// Register all the Enchantments and PotionTypes now so we can stop new registration immediately after
Enchantment.DAMAGE_ALL.getClass();
org.bukkit.enchantments.Enchantment.stopAcceptingRegistrations();
Potion.setPotionBrewer(new CraftPotionBrewer());
MobEffectList.BLINDNESS.getClass();
PotionEffectType.stopAcceptingRegistrations();
// Ugly hack :(
if (!Main.useConsole) {
getLogger().info("Console input is disabled due to --noconsole command argument");
}
configuration = YamlConfiguration.loadConfiguration(getConfigFile());
configuration.options().copyDefaults(true);
configuration.setDefaults(YamlConfiguration.loadConfiguration(getClass().getClassLoader().getResourceAsStream("configurations/bukkit.yml")));
saveConfig();
((SimplePluginManager) pluginManager).useTimings(configuration.getBoolean("settings.plugin-profiling"));
monsterSpawn = configuration.getInt("spawn-limits.monsters");
animalSpawn = configuration.getInt("spawn-limits.animals");
waterAnimalSpawn = configuration.getInt("spawn-limits.water-animals");
ambientSpawn = configuration.getInt("spawn-limits.ambient");
console.autosavePeriod = configuration.getInt("ticks-per.autosave");
warningState = WarningState.value(configuration.getString("settings.deprecated-verbose"));
chunkGCPeriod = configuration.getInt("chunk-gc.period-in-ticks");
chunkGCLoadThresh = configuration.getInt("chunk-gc.load-threshold");
updater = new AutoUpdater(new BukkitDLUpdaterService(configuration.getString("auto-updater.host")), getLogger(), configuration.getString("auto-updater.preferred-channel"));
updater.setEnabled(false); // Spigot
updater.setSuggestChannels(configuration.getBoolean("auto-updater.suggest-channels"));
updater.getOnBroken().addAll(configuration.getStringList("auto-updater.on-broken"));
updater.getOnUpdate().addAll(configuration.getStringList("auto-updater.on-update"));
updater.check(serverVersion);
// Spigot Start - Moved to old location of new DedicatedPlayerList in DedicatedServer
// loadPlugins();
// enablePlugins(PluginLoadOrder.STARTUP);
// Spigot End
}
开发者ID:AlmuraDev,项目名称:Almura-Server,代码行数:48,代码来源:CraftServer.java
示例16: hasPotionEffect
import net.minecraft.server.MobEffectList; //导入依赖的package包/类
public boolean hasPotionEffect(PotionEffectType type) {
return getHandle().hasEffect(MobEffectList.fromId(type.getId()));
}
开发者ID:bergerkiller,项目名称:SpigotSource,代码行数:4,代码来源:CraftLivingEntity.java
示例17: removePotionEffect
import net.minecraft.server.MobEffectList; //导入依赖的package包/类
public void removePotionEffect(PotionEffectType type) {
getHandle().removeEffect(MobEffectList.fromId(type.getId()));
}
开发者ID:bergerkiller,项目名称:SpigotSource,代码行数:4,代码来源:CraftLivingEntity.java
示例18: fromBukkit
import net.minecraft.server.MobEffectList; //导入依赖的package包/类
public static MobEffect fromBukkit(PotionEffect effect) {
MobEffectList type = MobEffectList.fromId(effect.getType().getId());
return new MobEffect(type, effect.getDuration(), effect.getAmplifier(), effect.isAmbient(), effect.hasParticles());
}
开发者ID:bergerkiller,项目名称:SpigotSource,代码行数:5,代码来源:CraftPotionUtil.java
示例19: equals
import net.minecraft.server.MobEffectList; //导入依赖的package包/类
public static boolean equals(MobEffectList mobEffect, PotionEffectType type) {
PotionEffectType typeV = PotionEffectType.getById(MobEffectList.getId(mobEffect));
return typeV.equals(type);
}
开发者ID:bergerkiller,项目名称:SpigotSource,代码行数:5,代码来源:CraftPotionUtil.java
示例20: CraftPotionEffectType
import net.minecraft.server.MobEffectList; //导入依赖的package包/类
public CraftPotionEffectType(MobEffectList handle) {
super(MobEffectList.getId(handle));
this.handle = handle;
}
开发者ID:bergerkiller,项目名称:SpigotSource,代码行数:5,代码来源:CraftPotionEffectType.java
注:本文中的net.minecraft.server.MobEffectList类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论