本文整理汇总了Java中org.spongepowered.api.event.cause.entity.spawn.SpawnCause类的典型用法代码示例。如果您正苦于以下问题:Java SpawnCause类的具体用法?Java SpawnCause怎么用?Java SpawnCause使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SpawnCause类属于org.spongepowered.api.event.cause.entity.spawn包,在下文中一共展示了SpawnCause类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: spawnMinions
import org.spongepowered.api.event.cause.entity.spawn.SpawnCause; //导入依赖的package包/类
public void spawnMinions(@Nullable Living target) {
int spawnCount = Math.max(3, getPlayers(PARTICIPANT).size());
for (Location<World> spawnPt : spawnPts) {
if (Probability.getChance(11)) {
for (int i = spawnCount; i > 0; --i) {
Zombie zombie = (Zombie) getRegion().getExtent().createEntity(EntityTypes.ZOMBIE, spawnPt.getPosition());
// TODO convert to Sponge Data API
((EntityZombie) zombie).setChild(true);
EntityHealthUtil.setMaxHealth(zombie, 1);
getRegion().getExtent().spawnEntity(zombie, Cause.source(SpawnCause.builder().type(SpawnTypes.PLUGIN).build()).build());
if (target != null) {
zombie.setTarget(target);
}
}
}
}
}
开发者ID:Skelril,项目名称:Skree,代码行数:19,代码来源:ShnugglesPrimeInstance.java
示例2: apply
import org.spongepowered.api.event.cause.entity.spawn.SpawnCause; //导入依赖的package包/类
@Override
public Optional<Instruction<DamageCondition, Boss<Zombie, CatacombsBossDetail>>> apply(
DamageCondition damageCondition, Boss<Zombie, CatacombsBossDetail> zombieCatacombsBossDetailBoss
) {
Living bossEnt = zombieCatacombsBossDetailBoss.getTargetEntity().get();
Entity toHit = damageCondition.getAttacked();
toHit.setVelocity(EntityDirectionUtil.getFacingVector(bossEnt).mul(2));
Task.builder().execute(() -> {
Location<World> targetLoc = toHit.getLocation();
Task.builder().execute(() -> {
Lightning lightning = (Lightning) toHit.getWorld().createEntity(EntityTypes.LIGHTNING, targetLoc.getPosition());
toHit.getWorld().spawnEntity(lightning, Cause.source(SpawnCause.builder().type(SpawnTypes.PLUGIN).build()).build());
}).delay(750, TimeUnit.MILLISECONDS).submit(SkreePlugin.inst());
}).delay(1500, TimeUnit.MILLISECONDS).submit(SkreePlugin.inst());
return Optional.empty();
}
开发者ID:Skelril,项目名称:Skree,代码行数:18,代码来源:ThorAttack.java
示例3: spawnBoss
import org.spongepowered.api.event.cause.entity.spawn.SpawnCause; //导入依赖的package包/类
public void spawnBoss(FreakyFourBoss boss, long delay) {
loadingBoss = true;
Task.builder().execute(() -> {
Entity entity = getRegion().getExtent().createEntity(boss.getEntityType(), getCenter(boss));
getRegion().getExtent().spawnEntity(entity, Cause.source(SpawnCause.builder().type(SpawnTypes.PLUGIN).build()).build());
Boss<Living, ZoneBossDetail<FreakyFourInstance>> aBoss = new Boss<>(
(Living) entity,
new ZoneBossDetail<>(this)
);
bossManagers.get(boss).bind(aBoss);
bosses.put(boss, aBoss);
loadingBoss = false;
}).delayTicks(delay).submit(SkreePlugin.inst());
}
开发者ID:Skelril,项目名称:Skree,代码行数:17,代码来源:FreakyFourInstance.java
示例4: throwSlashPotion
import org.spongepowered.api.event.cause.entity.spawn.SpawnCause; //导入依赖的package包/类
private void throwSlashPotion(Location<World> location) {
PotionEffectType[] thrownTypes = new PotionEffectType[] {
PotionEffectTypes.INSTANT_DAMAGE, PotionEffectTypes.INSTANT_DAMAGE,
PotionEffectTypes.POISON, PotionEffectTypes.WEAKNESS
};
Entity entity = location.getExtent().createEntity(EntityTypes.SPLASH_POTION, location.getPosition());
entity.setVelocity(new Vector3d(
random.nextDouble() * .5 - .25,
random.nextDouble() * .4 + .1,
random.nextDouble() * .5 - .25
));
PotionEffectType type = Probability.pickOneOf(thrownTypes);
PotionEffect effect = PotionEffect.of(type, 2, type.isInstant() ? 1 : 15 * 20);
entity.offer(Keys.POTION_EFFECTS, Lists.newArrayList(effect));
getRegion().getExtent().spawnEntity(entity, Cause.source(SpawnCause.builder().type(SpawnTypes.PLUGIN).build()).build());
}
开发者ID:Skelril,项目名称:Skree,代码行数:21,代码来源:PatientXInstance.java
示例5: throwSlashPotion
import org.spongepowered.api.event.cause.entity.spawn.SpawnCause; //导入依赖的package包/类
private void throwSlashPotion(Location<World> location) {
PotionEffectType[] thrownTypes = new PotionEffectType[] {
PotionEffectTypes.INSTANT_DAMAGE, PotionEffectTypes.INSTANT_DAMAGE,
PotionEffectTypes.POISON, PotionEffectTypes.WEAKNESS
};
Entity entity = location.getExtent().createEntity(EntityTypes.SPLASH_POTION, location.getPosition());
entity.setVelocity(new Vector3d(
random.nextDouble() * .5 - .25,
random.nextDouble() * .4 + .1,
random.nextDouble() * .5 - .25
));
PotionEffectType type = Probability.pickOneOf(thrownTypes);
PotionEffect effect = PotionEffect.of(type, 2, type.isInstant() ? 1 : 15 * 20);
entity.offer(Keys.POTION_EFFECTS, Lists.newArrayList(effect));
location.getExtent().spawnEntity(entity, Cause.source(SpawnCause.builder().type(SpawnTypes.PLUGIN).build()).build());
}
开发者ID:Skelril,项目名称:Skree,代码行数:21,代码来源:DeadlyPotionCurse.java
示例6: spawnEntity
import org.spongepowered.api.event.cause.entity.spawn.SpawnCause; //导入依赖的package包/类
public void spawnEntity(Location<World> location, Vector3d velocity, CommandSource src)
{
velocity = velocity.mul(5);
Extent extent = location.getExtent();
Entity kitten = extent.createEntity(EntityTypes.OCELOT, location.getPosition());
kitten.offer(Keys.VELOCITY, velocity);
extent.spawnEntity(kitten, Cause.of(NamedCause.source(SpawnCause.builder().type(SpawnTypes.CUSTOM).build())));
}
开发者ID:hsyyid,项目名称:EssentialCmds,代码行数:9,代码来源:KittyCannonExecutor.java
示例7: spawnEntity
import org.spongepowered.api.event.cause.entity.spawn.SpawnCause; //导入依赖的package包/类
public void spawnEntity(Location<World> location, Player player, EntityType type, int amount)
{
for (int i = 1; i <= amount; i++)
{
Entity entity = location.getExtent().createEntity(type, location.getPosition());
location.getExtent().spawnEntity(entity, Cause.of(NamedCause.source(SpawnCause.builder().type(SpawnTypes.CUSTOM).build())));
}
}
开发者ID:hsyyid,项目名称:EssentialCmds,代码行数:9,代码来源:MobSpawnExecutor.java
示例8: spawnEntity
import org.spongepowered.api.event.cause.entity.spawn.SpawnCause; //导入依赖的package包/类
public void spawnEntity(Location<World> location, Vector3d velocity, CommandSource src)
{
Extent extent = location.getExtent();
Entity fireball = extent.createEntity(EntityTypes.FIREBALL, location.getPosition());
fireball.offer(Keys.VELOCITY, velocity);
extent.spawnEntity(fireball, Cause.of(NamedCause.source(SpawnCause.builder().type(SpawnTypes.CUSTOM).build())));
}
开发者ID:hsyyid,项目名称:EssentialCmds,代码行数:8,代码来源:FireballExecutor.java
示例9: setupStormBringer
import org.spongepowered.api.event.cause.entity.spawn.SpawnCause; //导入依赖的package包/类
private void setupStormBringer() {
Sponge.getEventManager().registerListeners(
SkreePlugin.inst(),
new BossListener<>(bossManager, Skeleton.class)
);
List<Instruction<BindCondition, Boss<Skeleton, WildernessBossDetail>>> bindProcessor = bossManager.getBindProcessor();
bindProcessor.add((condition, boss) -> {
Optional<Skeleton> optBossEnt = boss.getTargetEntity();
if (optBossEnt.isPresent()) {
Skeleton bossEnt = optBossEnt.get();
bossEnt.offer(Keys.DISPLAY_NAME, Text.of("Storm Bringer"));
bossEnt.offer(Keys.CUSTOM_NAME_VISIBLE, true);
double bossHealth = 20 * 30 * boss.getDetail().getLevel();
setMaxHealth(bossEnt, bossHealth, true);
}
return Optional.empty();
});
List<Instruction<DamageCondition, Boss<Skeleton, WildernessBossDetail>>> damageProcessor = bossManager.getDamageProcessor();
damageProcessor.add((condition, boss) -> {
Entity eToHit = condition.getAttacked();
if (!(eToHit instanceof Living)) {
return Optional.empty();
}
Living toHit = (Living) eToHit;
Location<World> targetLocation = toHit.getLocation();
for (int i = boss.getDetail().getLevel() * Probability.getRangedRandom(1, 10); i >= 0; --i) {
Task.builder().execute(() -> {
Entity lightning = targetLocation.getExtent().createEntity(EntityTypes.LIGHTNING, targetLocation.getPosition());
targetLocation.getExtent().spawnEntity(
lightning, Cause.source(SpawnCause.builder().type(SpawnTypes.PLUGIN).build()).build()
);
}).delayTicks(5 * (6 + i)).submit(SkreePlugin.inst());
}
return Optional.empty();
});
}
开发者ID:Skelril,项目名称:Skree,代码行数:41,代码来源:StormBringer.java
示例10: makeExplosiveTomb
import org.spongepowered.api.event.cause.entity.spawn.SpawnCause; //导入依赖的package包/类
private void makeExplosiveTomb(Location<World> targetLocation, Boss<Skeleton, WildernessBossDetail> boss) {
makeSphere(targetLocation, 3, 3, 3);
for (int i = 0; i < boss.getDetail().getLevel(); ++i) {
Entity explosive = targetLocation.getExtent().createEntity(EntityTypes.PRIMED_TNT, targetLocation.getPosition());
explosive.offer(Keys.FUSE_DURATION, 20 * 4);
targetLocation.getExtent().spawnEntity(
explosive, Cause.source(SpawnCause.builder().type(SpawnTypes.PLUGIN).build()).build()
);
}
}
开发者ID:Skelril,项目名称:Skree,代码行数:12,代码来源:GraveDigger.java
示例11: summon
import org.spongepowered.api.event.cause.entity.spawn.SpawnCause; //导入依赖的package包/类
public boolean summon(String wandererType, int level, Location<World> location) {
WanderingBoss<? extends Entity> wanderer = wanderers.get(wandererType);
if (wanderer == null) {
return false;
}
Entity entity = wanderer.createEntity(location);
boolean spawned = location.getExtent().spawnEntity(entity, Cause.source(SpawnCause.builder().type(SpawnTypes.PLUGIN).build()).build());
if (!spawned) {
return false;
}
return wanderer.apply(entity, new WildernessBossDetail(level));
}
开发者ID:Skelril,项目名称:Skree,代码行数:15,代码来源:WanderingMobManager.java
示例12: onEntitySpawn
import org.spongepowered.api.event.cause.entity.spawn.SpawnCause; //导入依赖的package包/类
@Listener
public void onEntitySpawn(SpawnEntityEvent event, @First SpawnCause spawnCause) {
for (Entity entity : event.getEntities()) {
if (isApplicable(entity)) {
SpawnType spawnType = spawnCause.getType();
if (spawnType != SpawnTypes.PLUGIN && !isLegalSpawn(entity)) {
event.setCancelled(true);
}
break;
}
}
}
开发者ID:Skelril,项目名称:Skree,代码行数:15,代码来源:ZoneNaturalSpawnBlocker.java
示例13: spawnBoss
import org.spongepowered.api.event.cause.entity.spawn.SpawnCause; //导入依赖的package包/类
public void spawnBoss() {
Giant spawned = (Giant) getRegion().getExtent().createEntity(EntityTypes.GIANT, getRegion().getCenter());
getRegion().getExtent().spawnEntity(spawned, Cause.source(SpawnCause.builder().type(SpawnTypes.PLUGIN).build()).build());
Boss<Giant, ZoneBossDetail<ShnugglesPrimeInstance>> boss = new Boss<>(spawned, new ZoneBossDetail<>(this));
bossManager.bind(boss);
this.boss = boss;
}
开发者ID:Skelril,项目名称:Skree,代码行数:9,代码来源:ShnugglesPrimeInstance.java
示例14: randomRockets
import org.spongepowered.api.event.cause.entity.spawn.SpawnCause; //导入依赖的package包/类
private static void randomRockets(JungleRaidInstance inst) {
if (inst.isFlagEnabled(JungleRaidFlag.RANDOM_ROCKETS)) {
for (final Player player : inst.getPlayers(PlayerClassifier.PARTICIPANT)) {
if (!Probability.getChance(30)) {
continue;
}
for (int i = 0; i < 5; i++) {
Task.builder().delayTicks(i * 4).execute(() -> {
Location targetLocation = player.getLocation();
Firework firework = (Firework) inst.getRegion().getExtent().createEntity(EntityTypes.FIREWORK, targetLocation.getPosition());
FireworkEffect fireworkEffect = FireworkEffect.builder()
.flicker(Probability.getChance(2))
.trail(Probability.getChance(2))
.color(Color.RED)
.fade(Color.YELLOW)
.shape(FireworkShapes.BURST)
.build();
firework.offer(Keys.FIREWORK_EFFECTS, Lists.newArrayList(fireworkEffect));
firework.offer(Keys.FIREWORK_FLIGHT_MODIFIER, Probability.getRangedRandom(2, 5));
inst.getRegion().getExtent().spawnEntity(
firework, Cause.source(SpawnCause.builder().type(SpawnTypes.PLUGIN).build()).build()
);
}).submit(SkreePlugin.inst());
}
}
}
}
开发者ID:Skelril,项目名称:Skree,代码行数:28,代码来源:JungleRaidEffectProcessor.java
示例15: spawnChickens
import org.spongepowered.api.event.cause.entity.spawn.SpawnCause; //导入依赖的package包/类
private void spawnChickens() {
Vector3i bvMax = getRegion().getMaximumPoint();
Vector3i bvMin = getRegion().getMinimumPoint();
for (int i = 0; i < getPlayers(PARTICIPANT).size(); ++i) {
Location<World> testLoc = new Location<>(
getRegion().getExtent(),
Probability.getRangedRandom(bvMin.getX(), bvMax.getX()),
bvMax.getY() - 10,
Probability.getRangedRandom(bvMin.getZ(), bvMax.getZ())
);
Vector2d testPos = new Vector2d(testLoc.getX(), testLoc.getZ());
Vector2d originPos = new Vector2d(startingLocation.getX(), startingLocation.getZ());
if (testPos.distanceSquared(originPos) >= 70 * 70) {
--i;
continue;
}
Chicken chicken = (Chicken) testLoc.getExtent().createEntity(EntityTypes.CHICKEN, testLoc.getPosition());
chicken.offer(Keys.PERSISTS, false);
testLoc.getExtent().spawnEntity(
chicken,
Cause.source(SpawnCause.builder().type(SpawnTypes.PLUGIN).build()).build()
);
}
}
开发者ID:Skelril,项目名称:Skree,代码行数:29,代码来源:SkyWarsInstance.java
示例16: apply
import org.spongepowered.api.event.cause.entity.spawn.SpawnCause; //导入依赖的package包/类
@Override
public Optional<Instruction<DamagedCondition, Boss<Zombie, CatacombsBossDetail>>> apply(
DamagedCondition damagedCondition, Boss<Zombie, CatacombsBossDetail> zombieCatacombsBossDetailBoss
) {
CatacombsBossDetail detail = zombieCatacombsBossDetailBoss.getDetail();
CatacombsInstance inst = detail.getZone();
Zombie boss = zombieCatacombsBossDetailBoss.getTargetEntity().get();
if (activate(detail)) {
List<Entity> arrows = VelocityEntitySpawner.sendRadial(
EntityTypes.TIPPED_ARROW,
boss,
Cause.source(SpawnCause.builder().type(SpawnTypes.PROJECTILE).build()).build()
);
Task.builder().execute(() -> {
for (Entity arrow : arrows) {
Location<World> target = arrow.getLocation();
target.getExtent().triggerExplosion(
Explosion.builder()
.location(target)
.radius(explosionStrength(detail))
.canCauseFire(allowFire(detail))
.shouldBreakBlocks(allowBlockBreak(detail))
.shouldDamageEntities(true)
.build(),
Cause.source(SkreePlugin.container()).owner(boss).build()
);
}
}).delay(getDelay(detail), TimeUnit.SECONDS).submit(SkreePlugin.inst());
}
return Optional.empty();
}
开发者ID:Skelril,项目名称:Skree,代码行数:35,代码来源:ExplosiveArrowBarrage.java
示例17: spawnCharlotteMinion
import org.spongepowered.api.event.cause.entity.spawn.SpawnCause; //导入依赖的package包/类
private void spawnCharlotteMinion(Vector3d position) {
Entity entity = getRegion().getExtent().createEntity(EntityTypes.CAVE_SPIDER, position);
getRegion().getExtent().spawnEntity(entity, Cause.source(SpawnCause.builder().type(SpawnTypes.PLUGIN).build()).build());
Boss<CaveSpider, ZoneBossDetail<FreakyFourInstance>> boss = new Boss<>(
(CaveSpider) entity,
new ZoneBossDetail<>(this)
);
charlotteMinions.add(boss);
charlotteManager.getMinionManager().bind(boss);
}
开发者ID:Skelril,项目名称:Skree,代码行数:13,代码来源:FreakyFourInstance.java
示例18: runSnipee
import org.spongepowered.api.event.cause.entity.spawn.SpawnCause; //导入依赖的package包/类
private void runSnipee() {
Living snipee = getBoss(FreakyFourBoss.SNIPEE).get();
VelocityEntitySpawner.sendRadial(
EntityTypes.TIPPED_ARROW,
snipee,
20,
1.6F,
Cause.source(SpawnCause.builder().type(SpawnTypes.PROJECTILE).build()).build()
);
}
开发者ID:Skelril,项目名称:Skree,代码行数:12,代码来源:FreakyFourInstance.java
示例19: spawnBoss
import org.spongepowered.api.event.cause.entity.spawn.SpawnCause; //导入依赖的package包/类
public void spawnBoss() {
resetDifficulty();
freezeBlocks(false);
Zombie zombie = (Zombie) getRegion().getExtent().createEntity(EntityTypes.ZOMBIE, getRegion().getCenter());
getRegion().getExtent().spawnEntity(zombie, Cause.source(SpawnCause.builder().type(SpawnTypes.PLUGIN).build()).build());
Boss<Zombie, ZoneBossDetail<PatientXInstance>> boss = new Boss<>(zombie, new ZoneBossDetail<>(this));
bossManager.bind(boss);
this.boss = boss;
}
开发者ID:Skelril,项目名称:Skree,代码行数:12,代码来源:PatientXInstance.java
示例20: freezeBlocks
import org.spongepowered.api.event.cause.entity.spawn.SpawnCause; //导入依赖的package包/类
public void freezeBlocks(int percentage, boolean throwExplosives) {
ice.forAll((pt) -> {
BlockType aboveType = getRegion().getExtent().getBlockType(pt.add(0, 1, 0));
BlockType belowType = getRegion().getExtent().getBlockType(pt.add(0, -1, 0));
if (aboveType == BlockTypes.AIR && belowType == BlockTypes.WATER || belowType == BlockTypes.FLOWING_WATER) {
if (percentage >= 100) {
getRegion().getExtent().setBlockType(
pt, BlockTypes.ICE, Cause.source(SkreePlugin.container()).build()
);
return;
}
BlockType curType = getRegion().getExtent().getBlockType(pt);
if (curType == BlockTypes.PACKED_ICE || curType == BlockTypes.ICE) {
getRegion().getExtent().setBlockType(
pt, BlockTypes.WATER, Cause.source(SkreePlugin.container()).build()
);
if (!Probability.getChance(config.snowBallChance) || !throwExplosives) {
return;
}
Location target = new Location<>(getRegion().getExtent(), pt.add(0, 1, 0));
for (int i = Probability.getRandom(3); i > 0; i--) {
Snowball melvin = (Snowball) getRegion().getExtent().createEntity(EntityTypes.SNOWBALL, target.getPosition());
melvin.setVelocity(new Vector3d(
0,
Probability.getRangedRandom(.25, 1),
0
));
getRegion().getExtent().spawnEntity(melvin, Cause.source(SpawnCause.builder().type(SpawnTypes.PLUGIN).build()).build());
}
} else if (Probability.getChance(percentage, 100)) {
getRegion().getExtent().setBlockType(
pt, BlockTypes.PACKED_ICE, Cause.source(SkreePlugin.container()).build()
);
}
}
});
}
开发者ID:Skelril,项目名称:Skree,代码行数:40,代码来源:PatientXInstance.java
注:本文中的org.spongepowered.api.event.cause.entity.spawn.SpawnCause类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论