Search in sources :

Example 1 with EntityZombie

use of net.minecraft.entity.monster.EntityZombie in project Skree by Skelril.

the class PatientXInstance method spawnCreatures.

public void spawnCreatures() {
    Zombie boss = getBoss().get();
    Collection<Living> entities = getContained(Living.class);
    if (entities.size() > 500) {
        sendAttackBroadcast("Ring-a-round the rosie, a pocket full of posies...", AttackSeverity.NORMAL);
        EntityHealthUtil.toFullHealth(boss);
        for (Entity entity : entities) {
            if (entity instanceof Player) {
                entity.offer(Keys.HEALTH, 0D);
            } else if (!entity.equals(boss)) {
                entity.remove();
            }
        }
        return;
    }
    double amt = getPlayers(PARTICIPANT).size() * difficulty;
    Location l = getCenter();
    for (int i = 0; i < amt; i++) {
        Entity zombie = getRegion().getExtent().createEntity(EntityTypes.ZOMBIE, l.getPosition());
        // TODO convert to Sponge Data API
        ((EntityZombie) zombie).setCanPickUpLoot(false);
        ((EntityZombie) zombie).setChild(true);
        getRegion().getExtent().spawnEntity(zombie, Cause.source(SpawnCause.builder().type(SpawnTypes.PLUGIN).build()).build());
    }
}
Also used : Entity(org.spongepowered.api.entity.Entity) Player(org.spongepowered.api.entity.living.player.Player) EntityZombie(net.minecraft.entity.monster.EntityZombie) Zombie(org.spongepowered.api.entity.living.monster.Zombie) EntityZombie(net.minecraft.entity.monster.EntityZombie) Living(org.spongepowered.api.entity.living.Living) Location(org.spongepowered.api.world.Location)

Example 2 with EntityZombie

use of net.minecraft.entity.monster.EntityZombie in project ICBM-Classic by BuiltBrokenModding.

the class BlastMutation method doExplode.

@Override
public void doExplode() {
    if (!this.world().isRemote) {
        AxisAlignedBB bounds = AxisAlignedBB.getBoundingBox(position.x() - this.getRadius(), position.y() - this.getRadius(), position.z() - this.getRadius(), position.x() + this.getRadius(), position.y() + this.getRadius(), position.z() + this.getRadius());
        List<EntityLiving> entitiesNearby = world().getEntitiesWithinAABB(EntityLiving.class, bounds);
        for (EntityLiving entity : entitiesNearby) {
            if (entity instanceof EntityPig) {
                EntityPigZombie newEntity = new EntityPigZombie(world());
                newEntity.preventEntitySpawning = true;
                newEntity.setPosition(entity.posX, entity.posY, entity.posZ);
                entity.setDead();
            } else if (entity instanceof EntityVillager) {
                EntityZombie newEntity = new EntityZombie(world());
                newEntity.preventEntitySpawning = true;
                newEntity.setPosition(entity.posX, entity.posY, entity.posZ);
                entity.setDead();
            }
        }
    }
}
Also used : AxisAlignedBB(net.minecraft.util.AxisAlignedBB) EntityLiving(net.minecraft.entity.EntityLiving) EntityZombie(net.minecraft.entity.monster.EntityZombie) EntityPig(net.minecraft.entity.passive.EntityPig) EntityPigZombie(net.minecraft.entity.monster.EntityPigZombie) EntityVillager(net.minecraft.entity.passive.EntityVillager)

Example 3 with EntityZombie

use of net.minecraft.entity.monster.EntityZombie in project VoodooCraft by Mod-DevCafeTeam.

the class TestItem method itemInteractionForEntity.

@Override
public boolean itemInteractionForEntity(ItemStack stack, EntityPlayer playerIn, EntityLivingBase target, EnumHand hand) {
    World world = playerIn.world;
    BlockPos pos = target.getPosition();
    EntityVillager villager = new EntityVillager(world);
    EntityZombie zombie = new EntityZombie(world);
    if (!world.isRemote) {
        if (target instanceof EntityZombie) {
            villager.setPosition(pos.getX(), pos.getY(), pos.getZ());
            world.spawnEntity(villager);
            target.setDead();
            return true;
        } else if (target instanceof EntityVillager) {
            zombie.setPosition(pos.getX(), pos.getY(), pos.getZ());
            world.spawnEntity(zombie);
            target.setDead();
            return true;
        }
    }
    return false;
}
Also used : EntityZombie(net.minecraft.entity.monster.EntityZombie) EntityVillager(net.minecraft.entity.passive.EntityVillager) BlockPos(net.minecraft.util.math.BlockPos) World(net.minecraft.world.World)

Example 4 with EntityZombie

use of net.minecraft.entity.monster.EntityZombie in project SpongeCommon by SpongePowered.

the class ZombieAgeableDataProcessor method set.

@Override
protected boolean set(EntityZombie entityCast, Map<Key<?>, Object> keyValues) {
    boolean adult = (Boolean) keyValues.get(Keys.IS_ADULT);
    EntityZombie entity = entityCast;
    entity.setChild(!adult);
    return true;
}
Also used : EntityZombie(net.minecraft.entity.monster.EntityZombie)

Example 5 with EntityZombie

use of net.minecraft.entity.monster.EntityZombie in project Skree by Skelril.

the class PatientXInstance method runAttack.

public void runAttack(PatientXAttack attackCase) {
    Optional<Zombie> optBoss = getBoss();
    if (!optBoss.isPresent()) {
        return;
    }
    Zombie boss = optBoss.get();
    Collection<Player> contained = getPlayers(PARTICIPANT);
    if (contained.isEmpty()) {
        return;
    }
    switch(attackCase) {
        case MUSICAL_CHAIRS:
            sendAttackBroadcast("Let's play musical chairs!", AttackSeverity.NORMAL);
            for (Player player : contained) {
                do {
                    player.setLocation(getRandomDest());
                } while (player.getLocation().getPosition().distanceSquared(boss.getLocation().getPosition()) <= 5 * 5);
                // TODO convert to Sponge
                if (((EntityZombie) boss).canEntityBeSeen(tf(player))) {
                    player.offer(Keys.HEALTH, Probability.getRandom(player.get(Keys.MAX_HEALTH).get()));
                    sendAttackBroadcast("Don't worry, I have a medical degree...", AttackSeverity.NORMAL);
                    sendAttackBroadcast("...or was that a certificate of insanity?", AttackSeverity.NORMAL);
                }
            }
            attackDur = System.currentTimeMillis() + 2000;
            break;
        case SMASHING_HIT:
            for (Player player : contained) {
                final double old = player.get(Keys.HEALTH).get();
                player.offer(Keys.HEALTH, 3D);
                Task.builder().execute(() -> {
                    if (!player.isRemoved() || !contains(player)) {
                        return;
                    }
                    player.offer(Keys.HEALTH, old * .75);
                }).delay(2, TimeUnit.SECONDS).submit(SkreePlugin.inst());
            }
            attackDur = System.currentTimeMillis() + 3000;
            sendAttackBroadcast("This special attack will be a \"smashing hit\"!", AttackSeverity.NORMAL);
            break;
        case BOMB_PERFORMANCE:
            double tntQuantity = Math.max(2, difficulty / 2.4);
            for (Player player : contained) {
                for (double i = Probability.getRangedRandom(tntQuantity, Math.pow(2, Math.min(9, tntQuantity))); i > 0; i--) {
                    PrimedTNT explosive = (PrimedTNT) getRegion().getExtent().createEntity(EntityTypes.PRIMED_TNT, player.getLocation().getPosition());
                    explosive.setVelocity(new Vector3d(random.nextDouble() * 1 - .5, random.nextDouble() * .8 + .2, random.nextDouble() * 1 - .5));
                    explosive.offer(Keys.FUSE_DURATION, 20 * 4);
                    getRegion().getExtent().spawnEntity(explosive, Cause.source(SpawnCause.builder().type(SpawnTypes.PLUGIN).build()).build());
                }
            }
            attackDur = System.currentTimeMillis() + 5000;
            sendAttackBroadcast("Your performance is really going to \"bomb\"!", AttackSeverity.NORMAL);
            break;
        case WITHER_AWAY:
            PotionEffect witherEffect = PotionEffect.of(PotionEffectTypes.WITHER, 1, 20 * 15);
            for (Player player : contained) {
                List<PotionEffect> potionEffects = player.getOrElse(Keys.POTION_EFFECTS, new ArrayList<>(1));
                potionEffects.add(witherEffect);
                player.offer(Keys.POTION_EFFECTS, potionEffects);
            }
            attackDur = System.currentTimeMillis() + 15750;
            sendAttackBroadcast("Like a candle I hope you don't \"whither\" and die!", AttackSeverity.NORMAL);
            break;
        case SPLASH_TO_IT:
            for (Player player : contained) {
                for (int i = Probability.getRandom(6) + 2; i > 0; --i) {
                    throwSlashPotion(player.getLocation());
                }
            }
            attackDur = System.currentTimeMillis() + 2000;
            sendAttackBroadcast("Splash to it!", AttackSeverity.NORMAL);
            break;
        case COLD_FEET:
            PotionEffect slowEffect = PotionEffect.of(PotionEffectTypes.SLOWNESS, 2, 20 * 60);
            for (Player player : contained) {
                List<PotionEffect> potionEffects = player.getOrElse(Keys.POTION_EFFECTS, new ArrayList<>(1));
                potionEffects.add(slowEffect);
                player.offer(Keys.POTION_EFFECTS, potionEffects);
            }
            attackDur = System.currentTimeMillis() + 20000;
            sendAttackBroadcast("What's the matter, got cold feet?", AttackSeverity.NORMAL);
            break;
        case IM_JUST_BATTY:
            for (Player player : contained) {
                Cause cause = Cause.source(SpawnCause.builder().type(SpawnTypes.PLUGIN).build()).build();
                player.simulateChat(Text.of("I love Patient X!"), cause);
                Entity bat = getRegion().getExtent().createEntity(EntityTypes.BAT, player.getLocation().getPosition());
                getRegion().getExtent().spawnEntity(bat, cause);
                bat.getPassengers().add(player);
            }
            attackDur = System.currentTimeMillis() + 20000;
            sendAttackBroadcast("Awe, I love you too!", AttackSeverity.NORMAL);
            sendAttackBroadcast("But only cause I'm a little batty...", AttackSeverity.NORMAL);
            break;
        case RADIATION:
            ParticleEffect radiationEffect = ParticleEffect.builder().type(ParticleTypes.FLAME).quantity(1).build();
            Task.builder().execute(() -> {
                for (int i = config.radiationTimes; i > 0; i--) {
                    Task.builder().execute(() -> {
                        if (isBossSpawned()) {
                            for (Player player : getPlayers(PlayerClassifier.PARTICIPANT)) {
                                for (int e = 0; e < 30; ++e) {
                                    getRegion().getExtent().spawnParticles(radiationEffect, player.getLocation().getPosition().add(5 - Probability.getRandom(10) + Probability.getRangedRandom(0, 1.0), 5 - Probability.getRandom(10) + Probability.getRangedRandom(0, 1.0), 5 - Probability.getRandom(10) + Probability.getRangedRandom(0, 1.0)));
                                }
                                if (LightLevelUtil.getMaxLightLevel(player.getLocation()).get() >= config.radiationLightLevel) {
                                    player.damage(difficulty * config.radiationMultiplier, EntityDamageSource.builder().entity(boss).type(DamageTypes.MAGIC).build());
                                }
                            }
                        }
                    }).delay(i * 500, TimeUnit.MILLISECONDS).submit(SkreePlugin.inst());
                }
            }).delay(3, TimeUnit.SECONDS).submit(SkreePlugin.inst());
            attackDur = System.currentTimeMillis() + (config.radiationTimes * 500);
            sendAttackBroadcast("Ahhh not the radiation treatment!", AttackSeverity.NORMAL);
            break;
        case SNOWBALL_FIGHT:
            final int burst = Probability.getRangedRandom(10, 20);
            Task.builder().execute(() -> {
                for (int i = burst; i > 0; i--) {
                    Task.builder().execute(() -> {
                        if (boss != null) {
                            freezeBlocks(true);
                        }
                    }).delay(i * 500, TimeUnit.MILLISECONDS).submit(SkreePlugin.inst());
                }
            }).delay(7, TimeUnit.SECONDS).submit(SkreePlugin.inst());
            attackDur = System.currentTimeMillis() + 7000 + (500 * burst);
            sendAttackBroadcast("Let's have a snow ball fight!", AttackSeverity.NORMAL);
            break;
    }
    lastAttack = attackCase;
}
Also used : PrimedTNT(org.spongepowered.api.entity.explosive.PrimedTNT) Entity(org.spongepowered.api.entity.Entity) Player(org.spongepowered.api.entity.living.player.Player) EntityZombie(net.minecraft.entity.monster.EntityZombie) Zombie(org.spongepowered.api.entity.living.monster.Zombie) PotionEffect(org.spongepowered.api.effect.potion.PotionEffect) ParticleEffect(org.spongepowered.api.effect.particle.ParticleEffect) EntityZombie(net.minecraft.entity.monster.EntityZombie) Vector3d(com.flowpowered.math.vector.Vector3d) SpawnCause(org.spongepowered.api.event.cause.entity.spawn.SpawnCause) Cause(org.spongepowered.api.event.cause.Cause)

Aggregations

EntityZombie (net.minecraft.entity.monster.EntityZombie)23 EntityLivingBase (net.minecraft.entity.EntityLivingBase)8 EntitySkeleton (net.minecraft.entity.monster.EntitySkeleton)7 BlockPos (net.minecraft.util.math.BlockPos)6 ItemStack (net.minecraft.item.ItemStack)5 EntityVillager (net.minecraft.entity.passive.EntityVillager)4 EntityPlayer (net.minecraft.entity.player.EntityPlayer)4 World (net.minecraft.world.World)4 Zombie (org.spongepowered.api.entity.living.monster.Zombie)4 EntityLiving (net.minecraft.entity.EntityLiving)3 EntityPigZombie (net.minecraft.entity.monster.EntityPigZombie)3 EntityPig (net.minecraft.entity.passive.EntityPig)3 Entity (org.spongepowered.api.entity.Entity)3 Player (org.spongepowered.api.entity.living.player.Player)3 Vector3d (com.flowpowered.math.vector.Vector3d)2 SubscribeEvent (cpw.mods.fml.common.eventhandler.SubscribeEvent)2 Entity (net.minecraft.entity.Entity)2 PotionEffect (net.minecraft.potion.PotionEffect)2 PotionEffect (org.spongepowered.api.effect.potion.PotionEffect)2 Living (org.spongepowered.api.entity.living.Living)2