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


Java ParticleEffect.Builder方法代码示例

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


在下文中一共展示了ParticleEffect.Builder方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: 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

示例2: 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

示例3: from

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

示例4: type

import org.spongepowered.api.effect.particle.ParticleEffect; //导入方法依赖的package包/类
@Override
public ParticleEffect.Builder type(ParticleType particleType) {
    this.type = (LanternParticleType) checkNotNull(particleType, "particleType");
    return this;
}
 
开发者ID:LanternPowered,项目名称:LanternServer,代码行数:6,代码来源:LanternParticleEffectBuilder.java


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