• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java ParticleEffect类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.spongepowered.api.effect.particle.ParticleEffect的典型用法代码示例。如果您正苦于以下问题:Java ParticleEffect类的具体用法?Java ParticleEffect怎么用?Java ParticleEffect使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



ParticleEffect类属于org.spongepowered.api.effect.particle包,在下文中一共展示了ParticleEffect类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: buildContent

import org.spongepowered.api.effect.particle.ParticleEffect; //导入依赖的package包/类
@Override
protected Optional<ParticleEffect> buildContent(DataView container) throws InvalidDataException {
    if (!container.contains(DataQueries.PARTICLE_TYPE, DataQueries.PARTICLE_OPTIONS)) {
        return Optional.empty();
    }
    ParticleType particleType = container.getCatalogType(DataQueries.PARTICLE_TYPE, ParticleType.class).get();
    Map<ParticleOption<?>, Object> options = new HashMap<>();
    container.getViewList(DataQueries.PARTICLE_OPTIONS).get().forEach(view -> {
        ParticleOption option = view.getCatalogType(DataQueries.PARTICLE_OPTION_KEY, ParticleOption.class).get();
        Object value;
        if (option.getValueType().isAssignableFrom(DataSerializable.class)) {
            value = view.getSerializable(DataQueries.PARTICLE_OPTION_VALUE, option.getValueType()).get();
        } else {
            value = view.getObject(DataQueries.PARTICLE_OPTION_VALUE, option.getValueType()).get();
        }
        options.put(option, value);
    });
    return Optional.of(new LanternParticleEffect((LanternParticleType) particleType, options));
}
 
开发者ID:LanternPowered,项目名称:LanternServer,代码行数:20,代码来源:LanternParticleEffectBuilder.java


示例2: spiral

import org.spongepowered.api.effect.particle.ParticleEffect; //导入依赖的package包/类
public void spiral(IActiveCharacter character) {
	ParticleEffect build = ParticleEffect.builder().type(ParticleTypes.SMOKE)
			.quantity(1).build();

	double rot = 0.125;
	Vector3d position = character.getLocation().getPosition();
	World w = character.getLocation().getExtent();
	while (rot < 1) {
		new ParticleDecorator()
				.spiral(
						4,
						32,
						7,
						rot,
						vector3d -> {
							Vector3d vector3d1 = VectorUtils.rotateAroundAxisY(character.getLocation().add(vector3d).getPosition(), 30);
							w.spawnParticles(build, vector3d1);
						});
		rot += 0.125;
	}

}
 
开发者ID:NeumimTo,项目名称:NT-RPG,代码行数:23,代码来源:TestAction.java


示例3: onApply

import org.spongepowered.api.effect.particle.ParticleEffect; //导入依赖的package包/类
@Override
public void onApply() {
	super.onApply();
	character.setProperty(DefaultProperties.walk_speed, getGlobalScope().characterService.getCharacterProperty(character, DefaultProperties.walk_speed) + speedbonus);
	getGlobalScope().characterService.updateWalkSpeed(character);
	Location<World> location = getConsumer().getLocation();

	ParticleEffect build = ParticleEffect.builder()
			.type(ParticleTypes.CLOUD)
			.velocity(new Vector3d(0, 0.8, 0))
			.quantity(2).build();
	Vector3d[] smallCircle = ParticleDecorator.smallCircle;

	for (Vector3d vector3d : smallCircle) {
		location.getExtent().spawnParticles(build, location.getPosition().add(vector3d));
	}

	getConsumer().sendMessage(Localization.SPEED_BOOST_APPLY);

}
 
开发者ID:NeumimTo,项目名称:NT-RPG,代码行数:21,代码来源:SpeedBoost.java


示例4: generateDefaultList

import org.spongepowered.api.effect.particle.ParticleEffect; //导入依赖的package包/类
private List<Trail> generateDefaultList() {
    final ArrayList<Trail> trails = new ArrayList<>();
    trails.add(new Trail(HappyTrails.PLUGIN_ID + ":hearts", "Hearts", 10, 30, ParticleEffect.builder()
    .type(ParticleTypes.HEART)
        .quantity(7)
        .option(ParticleOptions.VELOCITY, Trail.DEFAULT_VELOCITY)
        .build()));
    this.defaultTrail = "happytrails:hearts";
    trails.add(new Trail(HappyTrails.PLUGIN_ID + ":villager_happy", "Happy Villager", 10, 30, ParticleEffect.builder()
        .type(ParticleTypes.HAPPY_VILLAGER)
        .quantity(13)
        .option(ParticleOptions.VELOCITY, Trail.DEFAULT_VELOCITY)
        .option(ParticleOptions.OFFSET, Trail.DEFAULT_VELOCITY)
        .build()));
    trails.add(new Trail(HappyTrails.PLUGIN_ID + ":villager_storm", "Stormy Villager", 10, 30, ParticleEffect.builder()
        .type(ParticleTypes.ANGRY_VILLAGER)
        .quantity(5)
        .option(ParticleOptions.VELOCITY, new Vector3d(0, 0.1, 0))
        .option(ParticleOptions.OFFSET, new Vector3d(0, 3, 0))
        .build()
    ));
    trails.add(new Trail(HappyTrails.PLUGIN_ID + ":crit_strike", "Critical Strike", 5, 20, ParticleEffect.builder()
        .type(ParticleTypes.CRITICAL_HIT)
        .quantity(10)
        .option(ParticleOptions.OFFSET, new Vector3d(10, 3, 10))
        .option(ParticleOptions.COLOR, Color.DARK_CYAN)
        .build()
    ));
    trails.add(new Trail(HappyTrails.PLUGIN_ID + ":cloud", "Clouds", 2, 10, ParticleEffect.builder()
        .type(ParticleTypes.CLOUD)
        .quantity(2)
        .option(ParticleOptions.OFFSET, new Vector3d(0, 3, 0))
        .option(ParticleOptions.VELOCITY, new Vector3d(0.01, 0.01, 0.01))
        .build()
    ));
    return trails;
}
 
开发者ID:gabizou,项目名称:HappyTrails,代码行数:38,代码来源:TrailConfig.java


示例5: Trail

import org.spongepowered.api.effect.particle.ParticleEffect; //导入依赖的package包/类
Trail(String id, String name, int period, int radius, ParticleEffect effect) {
    this.id = id;
    this.name = name;
    this.period = period;
    this.radius = radius;
    this.effect = effect;
}
 
开发者ID:gabizou,项目名称:HappyTrails,代码行数:8,代码来源:Trail.java


示例6: buildContent

import org.spongepowered.api.effect.particle.ParticleEffect; //导入依赖的package包/类
@Override
protected Optional<Trail> buildContent(DataView container) throws InvalidDataException {
    if (!container.contains(Trail.ID_QUERY, Trail.NAME_QUERY, Trail.PARTICLE_EFFECT)) {
        return Optional.empty();
    }
    final String id = container.getString(Trail.ID_QUERY).get();
    final String name = container.getString(Trail.NAME_QUERY).get();
    final ParticleEffect effect = container.getSerializable(Trail.PARTICLE_EFFECT, ParticleEffect.class).get();
    final int period = container.getInt(Trail.PERIOD).orElse(10);
    final int radius = container.getInt(Trail.RADIUS).orElse(30);
    return Optional.of(new Trail(id, name, period, radius, effect));
}
 
开发者ID:gabizou,项目名称:HappyTrails,代码行数:13,代码来源:Trail.java


示例7: playEffect

import org.spongepowered.api.effect.particle.ParticleEffect; //导入依赖的package包/类
@Deprecated
@Override
public void playEffect(Location loc, Effect effect, int data) {
    if (!Sponge.isServerAvailable()) return;
    Optional<Player> optionalP = Sponge.getServer().getPlayer(this.getUniqueId());
    ParticleType type = DummyObjectProvider.createFor(ParticleType.class, effect.name());
    optionalP.ifPresent(p -> p.spawnParticles(ParticleEffect.builder().type(type).build(), new Vector3d(loc.getX(), loc.getY(), loc.getZ())));
}
 
开发者ID:Proximyst,项目名称:Bukkit2Sponge,代码行数:9,代码来源:LinkedPlayer.java


示例8: spawnParticle

import org.spongepowered.api.effect.particle.ParticleEffect; //导入依赖的package包/类
@Override
public void spawnParticle(Particle particle, Location location, int count) {
    if (!Sponge.isServerAvailable()) return;
    Optional<Player> optionalP = Sponge.getServer().getPlayer(this.getUniqueId());
    ParticleType type = DummyObjectProvider.createFor(ParticleType.class, particle.name());
    optionalP.ifPresent(p -> p.spawnParticles(ParticleEffect.builder().type(type).quantity(count).build(), new Vector3d(location.getX(), location.getY(), location.getZ())));
}
 
开发者ID:Proximyst,项目名称:Bukkit2Sponge,代码行数:8,代码来源:LinkedPlayer.java


示例9: execute

import org.spongepowered.api.effect.particle.ParticleEffect; //导入依赖的package包/类
@Override
public void execute(CommandQueue queue, CommandEntry entry) {
    LocationTag loc = LocationTag.getFor(queue.error, entry.getArgumentObject(queue, 0));
    String effectName = entry.getArgumentObject(queue, 1).toString();
    ParticleEffect.Builder build = ParticleEffect.builder();
    Optional<ParticleType> type = Sponge.getRegistry().getType(ParticleType.class, effectName);
    if (!type.isPresent()) {
        queue.handleError(entry, "Invalid particle effect type: '" + effectName + "'!");
        return;
    }
    build.type(type.get());
    if (entry.namedArgs.containsKey("count")) {
        IntegerTag count = IntegerTag.getFor(queue.error, entry.getNamedArgumentObject(queue, "count"));
        build.quantity((int) count.getInternal());
    }
    if (entry.namedArgs.containsKey("offset")) {
        LocationTag offset = LocationTag.getFor(queue.error, entry.getNamedArgumentObject(queue, "offset"));
        build.offset(offset.getInternal().toVector3d());
    }
    if (entry.namedArgs.containsKey("motion")) {
        LocationTag motion = LocationTag.getFor(queue.error, entry.getNamedArgumentObject(queue, "motion"));
        build.velocity(motion.getInternal().toVector3d());
    }
    // TODO: Only show the particles to a list of target players.
    if (entry.namedArgs.containsKey("visibility")) {
        IntegerTag visibility = IntegerTag.getFor(queue.error, entry.getNamedArgumentObject(queue, "visibility"));
        loc.getInternal().world.spawnParticles(build.build(), loc.getInternal().toVector3d(), (int) visibility.getInternal());
    }
    else {
        loc.getInternal().world.spawnParticles(build.build(), loc.getInternal().toVector3d());
    }
    if (queue.shouldShowGood()) {
        queue.outGood("Successfully played the particle effect of type '" +
                ColorSet.emphasis + type.get().getId() + ColorSet.good + "' at location " +
                ColorSet.emphasis + loc.debug() + ColorSet.good + "!");
    }
}
 
开发者ID:DenizenScript,项目名称:Denizen2Sponge,代码行数:38,代码来源:PlayEffectCommand.java


示例10: VanishEntitySpawnEffects

import org.spongepowered.api.effect.particle.ParticleEffect; //导入依赖的package包/类
VanishEntitySpawnEffects(Vanish plugin) {
    this.plugin = plugin;
    this.effect = ParticleEffect.builder().type(ParticleTypes.LARGE_SMOKE).quantity(1).build();

    // Set up permissions/entities map.
    this.permEntityMap.put(Vanish.PERMISSION_EFFECTS_BATS, EntityTypes.BAT);
    this.permEntityMap.put(Vanish.PERMISSION_EFFECTS_CATS, EntityTypes.OCELOT);

    // Register to listen to events.
    Sponge.getEventManager().registerListeners(this.plugin, this);
}
 
开发者ID:KittehOrg,项目名称:Vanish,代码行数:12,代码来源:VanishEntitySpawnEffects.java


示例11: spawnParticles

import org.spongepowered.api.effect.particle.ParticleEffect; //导入依赖的package包/类
@Override
public void spawnParticles(ParticleEffect particleEffect, Vector3d position, int radius) {
    checkNotNull(particleEffect, "particleEffect");
    checkNotNull(position, "position");
    this.spawnParticles(this.players.stream().filter(
            player -> player.getLocation().getPosition().distanceSquared(position) < radius * radius).iterator(),
            particleEffect, position);
}
 
开发者ID:LanternPowered,项目名称:LanternServer,代码行数:9,代码来源:LanternWorld.java


示例12: spawnParticles

import org.spongepowered.api.effect.particle.ParticleEffect; //导入依赖的package包/类
@Override
public void spawnParticles(ParticleEffect particleEffect, Vector3d position, int radius) {
    checkNotNull(position, "position");
    checkNotNull(particleEffect, "particleEffect");
    if (getPosition().distanceSquared(position) < radius * radius) {
        spawnParticles(particleEffect, position);
    }
}
 
开发者ID:LanternPowered,项目名称:LanternServer,代码行数:9,代码来源:LanternPlayer.java


示例13: processRemoval

import org.spongepowered.api.effect.particle.ParticleEffect; //导入依赖的package包/类
private void processRemoval(@Nullable ParticleEffect key, @Nullable ICachedMessage value, RemovalCause cause) {
    if (value instanceof CachedFireworksMessage) {
        final ByteBufParameterList parameterList = (ByteBufParameterList) ((CachedFireworksMessage) value)
                .entityMetadataMessage.getParameterList();
        parameterList.getByteBuffer().ifPresent(ByteBuffer::release);
    }
}
 
开发者ID:LanternPowered,项目名称:LanternServer,代码行数:8,代码来源:ProcessorPlayOutParticleEffect.java


示例14: reset

import org.spongepowered.api.effect.particle.ParticleEffect; //导入依赖的package包/类
@Override
public ParticleEffect.Builder reset() {
    super.reset();
    this.type = null;
    this.options = new HashMap<>();
    return this;
}
 
开发者ID:LanternPowered,项目名称:LanternServer,代码行数:8,代码来源:LanternParticleEffectBuilder.java


示例15: draw

import org.spongepowered.api.effect.particle.ParticleEffect; //导入依赖的package包/类
public void draw(Location world, Vector3d[] vector3ds, ParticleEffect effect) {
	for (Vector3d vector3d : vector3ds) {
		if (vector3d != null) {
			Location add = world.add(vector3d);
			draw(add, add.getPosition(), effect);
		}
	}
}
 
开发者ID:NeumimTo,项目名称:NT-RPG,代码行数:9,代码来源:ParticleDecorator.java


示例16: drawSquare

import org.spongepowered.api.effect.particle.ParticleEffect; //导入依赖的package包/类
public static void drawSquare(Location<World> location, int i, ParticleEffect effect) {
	for (int k = -i; k <= i; k++) {
		for (int z = -i; z <= i; z++) {
			drawParticle(location.getExtent(), location.getBlockZ() - z, location.getBlockY(), location.getBlockX() - k, effect);
		}
	}
}
 
开发者ID:NeumimTo,项目名称:NT-RPG,代码行数:8,代码来源:ParticleUtils.java


示例17: castOn

import org.spongepowered.api.effect.particle.ParticleEffect; //导入依赖的package包/类
@Override
public SkillResult castOn(Living target, IActiveCharacter source, ExtendedSkillInfo info) {
	SkillDamageSourceBuilder builder = new SkillDamageSourceBuilder();
	builder.fromSkill(this);
	IEntity e = entityService.get(target);
	builder.setTarget(e);
	builder.setCaster(source);
	SkillDamageSource s = builder.build();
	float damage = getFloatNodeValue(info, SkillNodes.DAMAGE);
	boolean damage1 = e.getEntity().damage(damage, s);
	if (damage1) {
		Vector3d r = source.getEntity().getRotation();
		Vector3d dir = Quaterniond.fromAxesAnglesDeg(r.getX(), -r.getY(), r.getZ()).getDirection();
		Location<World> location = e.getEntity().getLocation();
		location.getExtent().spawnParticles(ParticleEffect.builder()
						.option(ParticleOptions.COLOR, Color.ofRgb(207, 23, 255))
						.option(ParticleOptions.QUANTITY, 3)
						.velocity(dir.normalize())
						.build(),
				e.getEntity().getLocation().getPosition()
		);

		location.getExtent().spawnParticles(ParticleEffect.builder()
						.option(ParticleOptions.COLOR, Color.RED)
						.option(ParticleOptions.QUANTITY, 5)
						.velocity(dir.normalize().mul(1.5))
						.build(),
				e.getEntity().getLocation().getPosition());
	}
	return SkillResult.OK;
}
 
开发者ID:NeumimTo,项目名称:NT-RPG,代码行数:32,代码来源:Harmtouch.java


示例18: execute

import org.spongepowered.api.effect.particle.ParticleEffect; //导入依赖的package包/类
@Override
public CommandResult execute(CommandSource src, CommandContext args) throws CommandException {
  Player targetPlayer = args.<Player>getOne(Text.of("player")).get();

  IntegratedRunnable runnable = new IntegratedRunnable() {
    @Override
    public boolean run(int times) {
      for (int i = 0; i < 75; ++i) {
        ParticleEffect effect = ParticleEffect.builder().type(ParticleTypes.HEART).quantity(1).build();

        targetPlayer.getWorld().spawnParticles(effect, targetPlayer.getLocation().getPosition().add(
            getRangedRandom(-5.0, 5.0),
            getRangedRandom(-2, 5.0),
            getRangedRandom(-5.0, 5.0)
        ));
      }
      return true;
    }

    @Override
    public void end() {
    }
  };

  TimedRunnable timedRunnable = new TimedRunnable<>(runnable, 20);

  timedRunnable.setTask(Task.builder().execute(
      timedRunnable
  ).intervalTicks(5).submit(SkreePlugin.inst()));


  return CommandResult.success();
}
 
开发者ID:Skelril,项目名称:Skree,代码行数:34,代码来源:HeartsCommand.java


示例19: playCreateEffect

import org.spongepowered.api.effect.particle.ParticleEffect; //导入依赖的package包/类
private static void playCreateEffect(Location<World> loc)
{
    ParticleEffect effect = ParticleEffect.builder().type(ParticleTypes.CLOUD).build();

    Vector3d center = loc.getPosition().add(0.5, 0.5, 0.5);
    for (Direction effectDir : Direction.values())
    {
        if (effectDir.isCardinal() || effectDir.isUpright())
        {
            loc.getExtent().spawnParticles(effect, center.add(effectDir.asOffset().div(1.9)));
        }
    }
    loc.getExtent().playSound(SoundTypes.BLOCK_ANVIL_USE, loc.getPosition(), 1);
}
 
开发者ID:CubeEngine,项目名称:modules-extra,代码行数:15,代码来源:ItemDuctListener.java


示例20: playEffect

import org.spongepowered.api.effect.particle.ParticleEffect; //导入依赖的package包/类
@Override
public void playEffect(Location location, Effect effect, int data, int radius) {
    if (effect.getType() == Effect.Type.SOUND) {
        //noinspection ConstantConditions
        getHandle().playSound(EffectConverter.toSound(effect, data), VectorConverter.create3d(location), radius);
    } else {
        //noinspection ConstantConditions
        //TODO: define a quantity
        getHandle().spawnParticles(
                ParticleEffect.builder().type(EffectConverter.toParticle(effect)).build(),
                VectorConverter.create3d(location),
                radius);
    }
}
 
开发者ID:LapisBlue,项目名称:Pore,代码行数:15,代码来源:PoreWorld.java



注:本文中的org.spongepowered.api.effect.particle.ParticleEffect类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java GenericExceptionHandler类代码示例发布时间:2022-05-21
下一篇:
Java CertificateFactorySpi类代码示例发布时间:2022-05-21
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap