Search in sources :

Example 1 with EntityZombieVillager

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);
            }
        }
    }
}
Also used : AxisAlignedBB(net.minecraft.util.math.AxisAlignedBB) EntityPig(net.minecraft.entity.passive.EntityPig) World(net.minecraft.world.World) EntityZombieVillager(net.minecraft.entity.monster.EntityZombieVillager) EntityZombie(net.minecraft.entity.monster.EntityZombie) Pos(icbm.classic.lib.transform.vector.Pos) BlockPos(net.minecraft.util.math.BlockPos) EntityPigZombie(net.minecraft.entity.monster.EntityPigZombie) EntityVillager(net.minecraft.entity.passive.EntityVillager) EntityLivingBase(net.minecraft.entity.EntityLivingBase) EntityPlayer(net.minecraft.entity.player.EntityPlayer) BlockPos(net.minecraft.util.math.BlockPos)

Example 2 with EntityZombieVillager

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;
}
Also used : AxisAlignedBB(net.minecraft.util.math.AxisAlignedBB) EntityZombieVillager(net.minecraft.entity.monster.EntityZombieVillager) EntityLiving(net.minecraft.entity.EntityLiving) EntityPig(net.minecraft.entity.passive.EntityPig) EntityPigZombie(net.minecraft.entity.monster.EntityPigZombie) EntityVillager(net.minecraft.entity.passive.EntityVillager)

Example 3 with EntityZombieVillager

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));
        });
    }
}
Also used : EntityZombieVillager(net.minecraft.entity.monster.EntityZombieVillager) InterpCircle(com.teamwizardry.librarianlib.features.math.interpolate.position.InterpCircle) EntityVillager(net.minecraft.entity.passive.EntityVillager) ResourceLocation(net.minecraft.util.ResourceLocation) ItemStack(net.minecraft.item.ItemStack) InterpFadeInOut(com.teamwizardry.librarianlib.features.particle.functions.InterpFadeInOut) ParticleBuilder(com.teamwizardry.librarianlib.features.particle.ParticleBuilder) Vec3d(net.minecraft.util.math.Vec3d)

Aggregations

EntityZombieVillager (net.minecraft.entity.monster.EntityZombieVillager)3 EntityVillager (net.minecraft.entity.passive.EntityVillager)3 EntityPigZombie (net.minecraft.entity.monster.EntityPigZombie)2 EntityPig (net.minecraft.entity.passive.EntityPig)2 AxisAlignedBB (net.minecraft.util.math.AxisAlignedBB)2 InterpCircle (com.teamwizardry.librarianlib.features.math.interpolate.position.InterpCircle)1 ParticleBuilder (com.teamwizardry.librarianlib.features.particle.ParticleBuilder)1 InterpFadeInOut (com.teamwizardry.librarianlib.features.particle.functions.InterpFadeInOut)1 Pos (icbm.classic.lib.transform.vector.Pos)1 EntityLiving (net.minecraft.entity.EntityLiving)1 EntityLivingBase (net.minecraft.entity.EntityLivingBase)1 EntityZombie (net.minecraft.entity.monster.EntityZombie)1 EntityPlayer (net.minecraft.entity.player.EntityPlayer)1 ItemStack (net.minecraft.item.ItemStack)1 ResourceLocation (net.minecraft.util.ResourceLocation)1 BlockPos (net.minecraft.util.math.BlockPos)1 Vec3d (net.minecraft.util.math.Vec3d)1 World (net.minecraft.world.World)1