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


Java ParticleOptions类代码示例

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


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

示例1: generateDefaultList

import org.spongepowered.api.effect.particle.ParticleOptions; //导入依赖的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

示例2: registerParticle

import org.spongepowered.api.effect.particle.ParticleOptions; //导入依赖的package包/类
private void registerParticle(int internalType, String id, boolean velocity,
        Map<ParticleOption<?>, Object> extraOptions) {
    final ImmutableMap.Builder<ParticleOption<?>, Object> options = ImmutableMap.builder();
    options.put(ParticleOptions.OFFSET, Vector3d.ZERO);
    options.put(ParticleOptions.QUANTITY, 1);
    if (velocity) {
        options.put(ParticleOptions.VELOCITY, Vector3d.ZERO);
    }
    options.putAll(extraOptions);
    registerEffect(id, OptionalInt.of(internalType), options.build());
}
 
开发者ID:LanternPowered,项目名称:LanternServer,代码行数:12,代码来源:ParticleTypeRegistryModule.java

示例3: getBlockState

import org.spongepowered.api.effect.particle.ParticleOptions; //导入依赖的package包/类
private static int getBlockState(LanternParticleEffect effect, Optional<BlockState> defaultBlockState) {
    final Optional<BlockState> blockState = effect.getOption(ParticleOptions.BLOCK_STATE);
    if (blockState.isPresent()) {
        return BlockRegistryModule.get().getStateInternalIdAndData(blockState.get());
    } else {
        final Optional<ItemStackSnapshot> optSnapshot = effect.getOption(ParticleOptions.ITEM_STACK_SNAPSHOT);
        if (optSnapshot.isPresent()) {
            final ItemStackSnapshot snapshot = optSnapshot.get();
            final Optional<BlockType> blockType = snapshot.getType().getBlock();
            if (blockType.isPresent()) {
                final BlockState state;
                if (blockType.get().getDefaultState().getTraits().isEmpty()) {
                    state = blockType.get().getDefaultState();
                } else {
                    final BlockState.Builder builder = BlockState.builder().blockType(blockType.get());
                    //noinspection unchecked
                    snapshot.getValues().forEach(value -> builder.add((Key) value.getKey(), value.get()));
                    state = builder.build();
                }
                return BlockRegistryModule.get().getStateInternalIdAndData(state);
            } else {
                return 0;
            }
        } else {
            return BlockRegistryModule.get().getStateInternalIdAndData(defaultBlockState.get());
        }
    }
}
 
开发者ID:LanternPowered,项目名称:LanternServer,代码行数:29,代码来源:ProcessorPlayOutParticleEffect.java

示例4: castOn

import org.spongepowered.api.effect.particle.ParticleOptions; //导入依赖的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

示例5: onMiningProgress

import org.spongepowered.api.effect.particle.ParticleOptions; //导入依赖的package包/类
@Listener(order = Order.BEFORE_POST)
public void onMiningProgress(MiningProgressEvent event) {
    Player player = event.getPlayer();
    BlockSnapshot snapshot = event.getSnapshot();
    Location<World> location = snapshot.getLocation()
            .orElseThrow(() -> new IllegalStateException("Could not access the location of the block that is being mined."));

    CustomItemLibrary.getInstance().getService().getBlock(location)
        .filter(SimpleCustomBlock.class::isInstance)
        .map(SimpleCustomBlock.class::cast)
        .ifPresent(customBlock -> {
            SimpleCustomBlockDefinition definition = customBlock.getDefinition();
            double hardness = definition.getHardness();
            Optional<ItemStack> itemInHand = player.getItemInHand(HandTypes.MAIN_HAND);
            boolean correctToolUsed = definition.getCorrectToolPredicate().isCorrectTool(itemInHand.orElse(null));
            double requiredDuration = MiningManager.computeDuration(player, itemInHand.orElse(null),
                                                                    correctToolUsed, hardness);

            if (event.getDuration() >= requiredDuration) {
                Cause cause = event.getCause();
                CustomBlockBreakEvent customEvent = CustomBlockBreakEvent.of(customBlock, cause);

                Sponge.getEventManager().post(customEvent);

                if(customEvent.isCancelled())
                    return;

                if(correctToolUsed) {
                    spawnDrops(snapshot, customBlock, player, cause);
                }

                World world = location.getExtent();
                ParticleEffect particleEffect = ParticleEffect.builder()
                        .type(ParticleTypes.BREAK_BLOCK)
                        .option(ParticleOptions.BLOCK_STATE, definition.getEffectState())
                        .build();
                Vector3d particlePosition = location.getBlockPosition().toDouble();

                world.spawnParticles(particleEffect, particlePosition);
                event.setCancelled(true);
                customBlock.remove(cause);
            } else {
                ArmorStand damageIndicatorArmorStand = getOrSpawnDamageIndicatorArmorStand(customBlock);
                String currentModel = definition.isGenerateDamageIndicatorModels() ? customBlock.getModel() : null;
                double progress = event.getDuration() / requiredDuration;
                String damageIndicatorModel = getDamageIndicatorModel(currentModel, progress);
                ItemStack damageIndicatorItemStack = DurabilityRegistry.getInstance()
                        .createItemUnsafe(DAMAGE_INDICATOR_ITEM_TYPE, definition.getPluginContainer(), damageIndicatorModel);

                damageIndicatorArmorStand.setHelmet(damageIndicatorItemStack);
            }
        });
}
 
开发者ID:Limeth,项目名称:CustomItemLibrary,代码行数:54,代码来源:SimpleCustomBlockRegistry.java

示例6: ParticleOptionRegistryModule

import org.spongepowered.api.effect.particle.ParticleOptions; //导入依赖的package包/类
public ParticleOptionRegistryModule() {
    super(ParticleOptions.class);
}
 
开发者ID:LanternPowered,项目名称:LanternServer,代码行数:4,代码来源:ParticleOptionRegistryModule.java

示例7: getEffect

import org.spongepowered.api.effect.particle.ParticleOptions; //导入依赖的package包/类
public ParticleEffect getEffect() {
    ParticleEffect particle = ParticleEffect.builder().type(ParticleTypes.BLOCK_CRACK).option(ParticleOptions.BLOCK_STATE, state).option(ParticleOptions.QUANTITY, count).offset(p_offset).build();
    return particle;
}
 
开发者ID:Bammerbom,项目名称:UltimateCore,代码行数:5,代码来源:BloodEffect.java


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