当前位置: 首页>>代码示例>>Java>>正文


Java ParticleEffect类代码示例

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


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


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