本文整理汇总了Java中net.minecraft.server.MobEffectList类的典型用法代码示例。如果您正苦于以下问题:Java MobEffectList类的具体用法?Java MobEffectList怎么用?Java MobEffectList使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
MobEffectList类属于net.minecraft.server包,在下文中一共展示了MobEffectList类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: 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);
}
示例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;
}
示例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;
}
示例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);
}
示例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)));
}
示例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")));
}
示例12: hasPotionEffect
import net.minecraft.server.MobEffectList; //导入依赖的package包/类
public boolean hasPotionEffect(PotionEffectType type) {
return getHandle().hasEffect(MobEffectList.byId[type.getId()]);
}
示例13: CraftPotionEffectType
import net.minecraft.server.MobEffectList; //导入依赖的package包/类
public CraftPotionEffectType(MobEffectList handle) {
super(handle.id);
this.handle = handle;
}
示例14: getHandle
import net.minecraft.server.MobEffectList; //导入依赖的package包/类
public MobEffectList getHandle() {
return handle;
}
示例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
}