use of net.minecraft.entity.monster.EntityZombieVillager in project ICBM-Classic by BuiltBrokenModding.
the class PoisonContagion method performEffect.
@Override
public void performEffect(EntityLivingBase entityLiving, int amplifier) {
World world = entityLiving.world;
if (!(entityLiving instanceof EntityZombie) && !(entityLiving instanceof EntityPigZombie)) {
entityLiving.attackEntityFrom(DamageSource.MAGIC, 1);
}
if (entityLiving.world.rand.nextFloat() > 0.8) {
int r = 13;
AxisAlignedBB entitySurroundings = new AxisAlignedBB(entityLiving.posX - r, entityLiving.posY - r, entityLiving.posZ - r, entityLiving.posX + r, entityLiving.posY + r, entityLiving.posZ + r);
List<EntityLivingBase> entities = entityLiving.world.getEntitiesWithinAABB(EntityLivingBase.class, entitySurroundings);
for (EntityLivingBase entity : entities) {
if (entity != null && entity != entityLiving) {
if (entity instanceof EntityPig) {
EntityPigZombie newEntity = new EntityPigZombie(entity.world);
newEntity.setLocationAndAngles(entity.posX, entity.posY, entity.posZ, entity.rotationYaw, entity.rotationPitch);
if (!entity.world.isRemote) {
entity.world.spawnEntity(newEntity);
}
entity.setDead();
} else if (entity instanceof EntityVillager) {
if ((world.getDifficulty() == EnumDifficulty.NORMAL || world.getDifficulty() == EnumDifficulty.HARD)) {
EntityVillager entityvillager = (EntityVillager) entity;
EntityZombieVillager entityzombievillager = new EntityZombieVillager(world);
entityzombievillager.copyLocationAndAnglesFrom(entityvillager);
world.removeEntity(entityvillager);
entityzombievillager.onInitialSpawn(world.getDifficultyForLocation(new BlockPos(entityzombievillager)), null);
entityzombievillager.setProfession(entityvillager.getProfession());
entityzombievillager.setChild(entityvillager.isChild());
entityzombievillager.setNoAI(entityvillager.isAIDisabled());
if (entityvillager.hasCustomName()) {
entityzombievillager.setCustomNameTag(entityvillager.getCustomNameTag());
entityzombievillager.setAlwaysRenderNameTag(entityvillager.getAlwaysRenderNameTag());
}
world.spawnEntity(entityzombievillager);
world.playEvent((EntityPlayer) null, 1026, new BlockPos(entity), 0);
}
entity.setDead();
}
ICBMClassic.contagios_potion.poisonEntity(new Pos(entity), entity);
}
}
}
}
use of net.minecraft.entity.monster.EntityZombieVillager in project ICBM-Classic by BuiltBrokenModding.
the class BlastMutation method doExplode.
@Override
public boolean doExplode(int callCount) {
if (!this.world().isRemote) {
AxisAlignedBB bounds = new AxisAlignedBB(location.x() - this.getBlastRadius(), location.y() - this.getBlastRadius(), location.z() - this.getBlastRadius(), location.x() + this.getBlastRadius(), location.y() + this.getBlastRadius(), location.z() + this.getBlastRadius());
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();
world().spawnEntity(newEntity);
} else if (entity instanceof EntityVillager) {
EntityZombieVillager newEntity = new EntityZombieVillager(world());
newEntity.preventEntitySpawning = true;
newEntity.setPosition(entity.posX, entity.posY, entity.posZ);
newEntity.setForgeProfession(((EntityVillager) entity).getProfessionForge());
entity.setDead();
world().spawnEntity(newEntity);
}
}
}
return false;
}
use of net.minecraft.entity.monster.EntityZombieVillager in project Wizardry by TeamWizardry.
the class RenderHaloEntity method doRenderLayer.
@Override
public void doRenderLayer(@Nonnull EntityLivingBase entitylivingbaseIn, float limbSwing, float limbSwingAmount, float partialTicks, float ageInTicks, float netHeadYaw, float headPitch, float scale) {
if (BaublesSupport.getItem(entitylivingbaseIn, ModItems.FAKE_HALO, ModItems.CREATIVE_HALO, ModItems.REAL_HALO).isEmpty())
return;
ItemStack halo = BaublesSupport.getItem(entitylivingbaseIn, ModItems.FAKE_HALO, ModItems.CREATIVE_HALO, ModItems.REAL_HALO);
// TODO: Remove these once we have a cosmetics system
if (halo.getItem() == ModItems.FAKE_HALO && !ConfigValues.renderCrudeHalo)
return;
if (halo.getItem() == ModItems.REAL_HALO && !ConfigValues.renderRealHalo)
return;
if (halo.getItem() == ModItems.CREATIVE_HALO && !ConfigValues.renderCreativeHalo)
return;
if (halo.getItem() == ModItems.FAKE_HALO) {
GlStateManager.pushMatrix();
if (entitylivingbaseIn.isSneaking())
GlStateManager.translate(0.0f, 0.2f, 0.0f);
boolean flag = entitylivingbaseIn instanceof EntityVillager || entitylivingbaseIn instanceof EntityZombieVillager;
if (entitylivingbaseIn.isChild() && !(entitylivingbaseIn instanceof EntityVillager)) {
GlStateManager.translate(0.0f, 0.5f * scale, 0.0f);
GlStateManager.scale(0.7f, 0.7f, 0.7f);
GlStateManager.translate(0.0f, 16.0f * scale, 0.0f);
}
if (flag)
GlStateManager.translate(0.0f, 0.1875f, 0.0f);
this.modelRenderer.postRender(0.0625f);
GlStateManager.color(1.0f, 1.0f, 1.0f, 1.0f);
GlStateManager.translate(0.0f, -0.25f, 0.0f);
GlStateManager.rotate(180.0f, 0.0f, 1.0f, 0.0f);
GlStateManager.scale(0.625f, -0.625f, -0.625f);
Minecraft.getMinecraft().getItemRenderer().renderItem(entitylivingbaseIn, halo, ItemCameraTransforms.TransformType.HEAD);
GlStateManager.popMatrix();
} else {
ParticleBuilder glitter = new ParticleBuilder(3);
glitter.setRender(new ResourceLocation(Wizardry.MODID, Constants.MISC.SPARKLE_BLURRED));
glitter.setAlphaFunction(new InterpFadeInOut(1f, 1f));
glitter.disableMotionCalculation();
glitter.disableRandom();
ParticleSpawner.spawn(glitter, entitylivingbaseIn.world, new InterpCircle(entitylivingbaseIn.getPositionVector().addVector(0, entitylivingbaseIn.height + (entitylivingbaseIn.isSneaking() ? 0.2 : 0.4), 0), new Vec3d(0, 1, 0), 0.3f, RandUtil.nextFloat(), RandUtil.nextFloat()), 10, 0, (aFloat, particleBuilder) -> {
if (RandUtil.nextInt(10) != 0)
if (halo.getItem() == ModItems.CREATIVE_HALO)
glitter.setColor(ColorUtils.changeColorAlpha(new Color(0xd600d2), RandUtil.nextInt(60, 100)));
else
glitter.setColor(ColorUtils.changeColorAlpha(Color.YELLOW, RandUtil.nextInt(60, 100)));
else
glitter.setColor(ColorUtils.changeColorAlpha(Color.WHITE, RandUtil.nextInt(60, 100)));
glitter.setAlphaFunction(new InterpFadeInOut(1f, 1f));
glitter.setLifetime(10);
glitter.setScaleFunction(new InterpFadeInOut(0.5f, 0.5f));
glitter.setMotion(new Vec3d(entitylivingbaseIn.motionX / 2.0, (entitylivingbaseIn.motionY + 0.0784) / 2.0, entitylivingbaseIn.motionZ / 2.0));
});
}
}
Aggregations