Search in sources :

Example 16 with EntityZombie

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

the class ShnugglesPrimeInstance method spawnMinions.

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);
                }
            }
        }
    }
}
Also used : EntityZombie(net.minecraft.entity.monster.EntityZombie) Zombie(org.spongepowered.api.entity.living.monster.Zombie) EntityGiantZombie(net.minecraft.entity.monster.EntityGiantZombie) EntityZombie(net.minecraft.entity.monster.EntityZombie) World(org.spongepowered.api.world.World)

Example 17 with EntityZombie

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

the class HexZombify method activeUse.

@Override
public ItemStack activeUse(ItemStack stackIn, World world, EntityPlayer player, EnumHand hand, int strength, @Nullable EntityLivingBase target) {
    if (!world.isRemote) {
        if (target instanceof EntityZombie) {
            EntityVillager villager = new EntityVillager(world);
            villager.copyLocationAndAnglesFrom(target);
            villager.onInitialSpawn(world.getDifficultyForLocation(new BlockPos(villager)), null);
            world.removeEntity(target);
            world.spawnEntity(villager);
        } else if (target instanceof EntityVillager) {
            EntityZombie zombie = new EntityZombie(world);
            zombie.copyLocationAndAnglesFrom(target);
            zombie.onInitialSpawn(world.getDifficultyForLocation(new BlockPos(zombie)), null);
            world.removeEntity(target);
            world.spawnEntity(zombie);
        }
    }
    if (target != null)
        VoodooCraft.proxy.spawnParticle(world, EnumParticleTypes.EXPLOSION_NORMAL, target.posX, target.posY, target.posZ);
    player.playSound(VCSoundHandler.transformation, 1.0F, 1.0F);
    return super.activeUse(stackIn, world, player, hand, strength, target);
}
Also used : EntityZombie(net.minecraft.entity.monster.EntityZombie) EntityVillager(net.minecraft.entity.passive.EntityVillager) BlockPos(net.minecraft.util.math.BlockPos)

Example 18 with EntityZombie

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

the class HexFertility method activeUse.

@Override
public ItemStack activeUse(ItemStack stackIn, World world, EntityPlayer player, EnumHand hand, int strength, @Nullable EntityLivingBase target) {
    if (world.isRemote || target == null)
        return super.activeUse(stackIn, world, player, hand, strength, target);
    if (target instanceof EntityZombie && !target.isChild()) {
        EntityZombie entity = new EntityZombie(world);
        entity.setChild(true);
        entity.copyLocationAndAnglesFrom(target);
        entity.onInitialSpawn(world.getDifficultyForLocation(new BlockPos(entity)), null);
        world.spawnEntity(entity);
    } else if (target instanceof EntityAgeable && !target.isChild()) {
        EntityAgeable entity = (EntityAgeable) target;
        EntityAgeable child = entity.createChild(entity);
        child.copyLocationAndAnglesFrom(entity);
        child.setGrowingAge(-24000);
        child.onInitialSpawn(world.getDifficultyForLocation(new BlockPos(entity)), null);
        world.spawnEntity(child);
    }
    return super.activeUse(stackIn, world, player, hand, strength, target);
}
Also used : EntityZombie(net.minecraft.entity.monster.EntityZombie) BlockPos(net.minecraft.util.math.BlockPos) EntityAgeable(net.minecraft.entity.EntityAgeable)

Example 19 with EntityZombie

use of net.minecraft.entity.monster.EntityZombie in project Galacticraft by micdoodle8.

the class TileEntityTelemetry method update.

@Override
public void update() {
    if (!this.worldObj.isRemote && ++this.ticks % 2 == 0) {
        if (this.toUpdate != null) {
            this.addTrackedEntity(this.toUpdate);
            this.toUpdate = null;
        }
        String name;
        int[] data = { -1, -1, -1, -1, -1 };
        String strUUID = "";
        if (linkedEntity != null) {
            // Help the Garbage Collector
            if (linkedEntity.isDead) {
                linkedEntity = null;
                name = "";
            // TODO: track players after death and respawn? or not?
            } else {
                if (linkedEntity instanceof EntityPlayerMP) {
                    name = "$" + ((EntityPlayerMP) linkedEntity).getName();
                } else {
                    name = (String) EntityList.classToStringMapping.get(linkedEntity.getClass());
                }
                if (name == null) {
                    GCLog.info("Telemetry Unit: Error finding name for " + linkedEntity.getClass().getSimpleName());
                    name = "";
                }
                double xmotion = linkedEntity.motionX;
                double ymotion = linkedEntity instanceof EntityLivingBase ? linkedEntity.motionY + 0.078D : linkedEntity.motionY;
                double zmotion = linkedEntity.motionZ;
                data[2] = (int) (MathHelper.sqrt_double(xmotion * xmotion + ymotion * ymotion + zmotion * zmotion) * 2000D);
                if (linkedEntity instanceof ITelemetry) {
                    ((ITelemetry) linkedEntity).transmitData(data);
                } else if (linkedEntity instanceof EntityLivingBase) {
                    EntityLivingBase eLiving = (EntityLivingBase) linkedEntity;
                    data[0] = eLiving.hurtTime;
                    // Calculate a "pulse rate" based on motion and taking damage
                    this.pulseRate--;
                    if (eLiving.hurtTime > this.lastHurttime) {
                        this.pulseRate += 100;
                    }
                    this.lastHurttime = eLiving.hurtTime;
                    if (eLiving.ridingEntity != null) {
                        // reduced pulse effect if riding a vehicle
                        data[2] /= 4;
                    } else if (data[2] > 1) {
                        this.pulseRate += 2;
                    }
                    this.pulseRate += Math.max(data[2] - pulseRate, 0) / 4;
                    if (this.pulseRate > 2000) {
                        this.pulseRate = 2000;
                    }
                    if (this.pulseRate < 400) {
                        this.pulseRate = 400;
                    }
                    data[2] = this.pulseRate / 10;
                    data[1] = (int) (eLiving.getHealth() * 100 / eLiving.getMaxHealth());
                    if (eLiving instanceof EntityPlayerMP) {
                        data[3] = ((EntityPlayerMP) eLiving).getFoodStats().getFoodLevel() * 5;
                        GCPlayerStats stats = GCPlayerStats.get(eLiving);
                        data[4] = stats.getAirRemaining() * 4096 + stats.getAirRemaining2();
                        UUID uuid = ((EntityPlayerMP) eLiving).getUniqueID();
                        if (uuid != null) {
                            strUUID = uuid.toString();
                        }
                    } else if (eLiving instanceof EntityHorse) {
                        data[3] = ((EntityHorse) eLiving).getHorseType();
                        data[4] = ((EntityHorse) eLiving).getHorseVariant();
                    } else if (eLiving instanceof EntityVillager) {
                        data[3] = ((EntityVillager) eLiving).getProfession();
                        data[4] = ((EntityVillager) eLiving).getGrowingAge();
                    } else if (eLiving instanceof EntityWolf) {
                        data[3] = ((EntityWolf) eLiving).getCollarColor().getDyeDamage();
                        data[4] = ((EntityWolf) eLiving).isBegging() ? 1 : 0;
                    } else if (eLiving instanceof EntitySheep) {
                        data[3] = ((EntitySheep) eLiving).getFleeceColor().getDyeDamage();
                        data[4] = ((EntitySheep) eLiving).getSheared() ? 1 : 0;
                    } else if (eLiving instanceof EntityOcelot) {
                        data[3] = ((EntityOcelot) eLiving).getTameSkin();
                    } else if (eLiving instanceof EntitySkeleton) {
                        data[3] = ((EntitySkeleton) eLiving).getSkeletonType();
                    } else if (eLiving instanceof EntityZombie) {
                        data[3] = ((EntityZombie) eLiving).isVillager() ? 1 : 0;
                        data[4] = ((EntityZombie) eLiving).isChild() ? 1 : 0;
                    }
                }
            }
        } else {
            name = "";
        }
        GalacticraftCore.packetPipeline.sendToAllAround(new PacketSimple(EnumSimplePacket.C_UPDATE_TELEMETRY, GCCoreUtil.getDimensionID(this.worldObj), new Object[] { this.getPos(), name, data[0], data[1], data[2], data[3], data[4], strUUID }), new TargetPoint(GCCoreUtil.getDimensionID(this.worldObj), this.getPos().getX(), this.getPos().getY(), this.getPos().getZ(), 320D));
    }
}
Also used : EntitySkeleton(net.minecraft.entity.monster.EntitySkeleton) GCPlayerStats(micdoodle8.mods.galacticraft.core.entities.player.GCPlayerStats) PacketSimple(micdoodle8.mods.galacticraft.core.network.PacketSimple) TargetPoint(net.minecraftforge.fml.common.network.NetworkRegistry.TargetPoint) EntityZombie(net.minecraft.entity.monster.EntityZombie) ITelemetry(micdoodle8.mods.galacticraft.api.entity.ITelemetry) EntityLivingBase(net.minecraft.entity.EntityLivingBase) EntityPlayerMP(net.minecraft.entity.player.EntityPlayerMP) UUID(java.util.UUID)

Example 20 with EntityZombie

use of net.minecraft.entity.monster.EntityZombie in project Bewitchment by Um-Mitternacht.

the class FortuneMeetZombie method apply.

@Override
public boolean apply(EntityPlayer player) {
    for (int i = 0; i < 10; i++) {
        BlockPos pos = new BlockPos(player.posX + player.getRNG().nextGaussian() * 4, player.posY, player.posZ + player.getRNG().nextGaussian() * 4);
        EntityZombie zombie = new EntityZombie(player.world);
        if (player.world.isAirBlock(pos) && player.world.isAirBlock(pos.up()) && player.world.getBlockState(pos.down()).canEntitySpawn(zombie)) {
            zombie.setPosition(pos.getX() + 0.5, pos.getY(), pos.getZ() + 0.5);
            zombie.onInitialSpawn(player.world.getDifficultyForLocation(pos), null);
            player.world.spawnEntity(zombie);
            if (player.getRNG().nextInt(10) < player.world.getDifficulty().ordinal())
                zombie.addPotionEffect(new PotionEffect(MobEffects.RESISTANCE, 900, 1));
            if (player.getRNG().nextInt(10) < player.world.getDifficulty().ordinal())
                zombie.addPotionEffect(new PotionEffect(MobEffects.STRENGTH, 900, 1));
            if (player.getRNG().nextInt(10) < player.world.getDifficulty().ordinal())
                zombie.addPotionEffect(new PotionEffect(MobEffects.SPEED, 900, 1));
            if (player.getRNG().nextInt(10) < player.world.getDifficulty().ordinal())
                zombie.addPotionEffect(new PotionEffect(MobEffects.FIRE_RESISTANCE, 900, 1));
            return true;
        }
    }
    return false;
}
Also used : EntityZombie(net.minecraft.entity.monster.EntityZombie) PotionEffect(net.minecraft.potion.PotionEffect) BlockPos(net.minecraft.util.math.BlockPos)

Aggregations

EntityZombie (net.minecraft.entity.monster.EntityZombie)22 EntityLivingBase (net.minecraft.entity.EntityLivingBase)7 EntitySkeleton (net.minecraft.entity.monster.EntitySkeleton)7 BlockPos (net.minecraft.util.math.BlockPos)6 EntityVillager (net.minecraft.entity.passive.EntityVillager)4 EntityPlayer (net.minecraft.entity.player.EntityPlayer)4 ItemStack (net.minecraft.item.ItemStack)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