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);
}
}
}
}
}
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);
}
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);
}
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));
}
}
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;
}
Aggregations