本文整理汇总了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 + "!");
}
}
示例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;
}
示例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;
}
示例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;
}