Search in sources :

Example 41 with EntityLivingBase

use of net.minecraft.entity.EntityLivingBase in project MorePlanets by SteveKunG.

the class EntityZeliusCreeper method explode.

@Override
protected void explode() {
    if (!this.world.isRemote) {
        boolean flag = this.world.getGameRules().getBoolean("mobGriefing");
        if (this.getPowered()) {
            this.world.createExplosion(this, this.posX, this.posY, this.posZ, this.explosionRadius * 2, flag);
            List<EntityLivingBase> list = this.world.getEntitiesWithinAABB(EntityLivingBase.class, new AxisAlignedBB(this.posX - this.explosionRadius * 2, this.posY - this.explosionRadius * 2, this.posZ - this.explosionRadius * 2, this.posX + this.explosionRadius * 2, this.posY + this.explosionRadius * 2, this.posZ + this.explosionRadius * 2));
            for (EntityLivingBase living : list) {
                living.addPotionEffect(new PotionEffect(MPPotions.INFECTED_CRYSTALLIZE, 240, 1));
            }
        } else {
            List<EntityLivingBase> list = this.world.getEntitiesWithinAABB(EntityLivingBase.class, new AxisAlignedBB(this.posX - this.explosionRadius, this.posY - this.explosionRadius, this.posZ - this.explosionRadius, this.posX + this.explosionRadius, this.posY + this.explosionRadius, this.posZ + this.explosionRadius));
            for (EntityLivingBase living : list) {
                living.addPotionEffect(new PotionEffect(MPPotions.INFECTED_CRYSTALLIZE, 120, 1));
            }
            this.world.createExplosion(this, this.posX, this.posY, this.posZ, this.explosionRadius, flag);
        }
        this.setDead();
        this.spawnLingeringCloud();
    }
}
Also used : AxisAlignedBB(net.minecraft.util.math.AxisAlignedBB) PotionEffect(net.minecraft.potion.PotionEffect) EntityLivingBase(net.minecraft.entity.EntityLivingBase)

Example 42 with EntityLivingBase

use of net.minecraft.entity.EntityLivingBase in project MorePlanets by SteveKunG.

the class EntityZeliusSkeleton method attackEntityAsMob.

@Override
public boolean attackEntityAsMob(Entity entity) {
    if (super.attackEntityAsMob(entity)) {
        if (entity instanceof EntityLivingBase) {
            ((EntityLivingBase) entity).addPotionEffect(new PotionEffect(MPPotions.INFECTED_CRYSTALLIZE, 120, 1));
            this.world.playSound((EntityPlayer) entity, this.posX, this.posY, this.posZ, MPSounds.ALIEN_MINER_ATTACK, SoundCategory.PLAYERS, 1.0F, 1.0F);
        }
        return true;
    } else {
        return false;
    }
}
Also used : PotionEffect(net.minecraft.potion.PotionEffect) EntityLivingBase(net.minecraft.entity.EntityLivingBase)

Example 43 with EntityLivingBase

use of net.minecraft.entity.EntityLivingBase in project MorePlanets by SteveKunG.

the class EntityZeliusZombie method attackEntityAsMob.

@Override
public boolean attackEntityAsMob(Entity entity) {
    if (entity instanceof EntityLivingBase) {
        ((EntityLivingBase) entity).addPotionEffect(new PotionEffect(MPPotions.INFECTED_CRYSTALLIZE, 120, 1));
        this.world.playSound(null, this.posX, this.posY, this.posZ, MPSounds.INFECTED_MOB_ATTACK, SoundCategory.PLAYERS, 1.0F, 1.0F);
    }
    return super.attackEntityAsMob(entity);
}
Also used : PotionEffect(net.minecraft.potion.PotionEffect) EntityLivingBase(net.minecraft.entity.EntityLivingBase)

Example 44 with EntityLivingBase

use of net.minecraft.entity.EntityLivingBase in project MorePlanets by SteveKunG.

the class RenderAlienMiner method doRender.

@Override
public void doRender(EntityAlienMiner entity, double x, double y, double z, float entityYaw, float partialTicks) {
    super.doRender(entity, x, y, z, entityYaw, partialTicks);
    EntityLivingBase entitylivingbase = entity.getTargetedEntity();
    if (entitylivingbase != null && entity.getChargedTime(partialTicks) > 0.925F) {
        Tessellator tessellator = Tessellator.getInstance();
        BufferBuilder worldrenderer = tessellator.getBuffer();
        this.bindTexture(new ResourceLocation("moreplanets:textures/entity/alien_miner_beam.png"));
        GlStateManager.glTexParameterf(3553, 10242, 10497.0F);
        GlStateManager.glTexParameterf(3553, 10243, 10497.0F);
        GlStateManager.disableLighting();
        GlStateManager.disableCull();
        GlStateManager.disableBlend();
        GlStateManager.depthMask(true);
        GlStateManager.enableAlpha();
        float f1 = 240.0F;
        OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, f1, f1);
        GlStateManager.blendFunc(770, 771);
        float f2 = entity.world.getTotalWorldTime() + partialTicks;
        float f3 = f2 * 0.5F % 1.0F;
        float f4 = entity.getEyeHeight() + 0.25F - 0.5F + entity.getHoverTick(partialTicks);
        GlStateManager.pushMatrix();
        GlStateManager.translate((float) x, (float) y + f4, (float) z);
        Vec3d vec3 = this.getPosition(entitylivingbase, entitylivingbase.height * 0.5D, partialTicks);
        Vec3d vec31 = this.getPosition(entity, f4, partialTicks);
        Vec3d vec32 = vec3.subtract(vec31);
        double d0 = vec32.lengthVector();
        vec32 = vec32.normalize();
        float f5 = (float) Math.acos(vec32.y);
        float f6 = (float) Math.atan2(vec32.z, vec32.x);
        GlStateManager.rotate(((float) Math.PI / 2F + -f6) * (180F / (float) Math.PI), 0.0F, 1.0F, 0.0F);
        GlStateManager.rotate(f5 * (180F / (float) Math.PI), 1.0F, 0.0F, 0.0F);
        int i = 1;
        double d1 = f2 * 0.05D * (1.0D - (i & 1) * 2.5D);
        worldrenderer.begin(7, DefaultVertexFormats.POSITION_TEX_COLOR);
        int j = 255;
        int k = 255;
        int l = 255;
        double d2 = i * 0.2D;
        double d3 = d2 * 1.41D;
        double d4 = 0.0D + Math.cos(d1 + 2.356194490192345D) * d3;
        double d5 = 0.0D + Math.sin(d1 + 2.356194490192345D) * d3;
        double d6 = 0.0D + Math.cos(d1 + Math.PI / 4D) * d3;
        double d7 = 0.0D + Math.sin(d1 + Math.PI / 4D) * d3;
        double d8 = 0.0D + Math.cos(d1 + 3.9269908169872414D) * d3;
        double d9 = 0.0D + Math.sin(d1 + 3.9269908169872414D) * d3;
        double d10 = 0.0D + Math.cos(d1 + 5.497787143782138D) * d3;
        double d11 = 0.0D + Math.sin(d1 + 5.497787143782138D) * d3;
        double d12 = 0.0D + Math.cos(d1 + Math.PI) * d2;
        double d13 = 0.0D + Math.sin(d1 + Math.PI) * d2;
        double d14 = 0.0D + Math.cos(d1 + 0.0D) * d2;
        double d15 = 0.0D + Math.sin(d1 + 0.0D) * d2;
        double d16 = 0.0D + Math.cos(d1 + Math.PI / 2D) * d2;
        double d17 = 0.0D + Math.sin(d1 + Math.PI / 2D) * d2;
        double d18 = 0.0D + Math.cos(d1 + Math.PI * 3D / 2D) * d2;
        double d19 = 0.0D + Math.sin(d1 + Math.PI * 3D / 2D) * d2;
        double d22 = -1.0F + f3;
        double d23 = d0 * (0.5D / d2) + d22;
        worldrenderer.pos(d12, d0, d13).tex(0.4999D, d23).color(j, k, l, 100).endVertex();
        worldrenderer.pos(d12, 0.0D, d13).tex(0.4999D, d22).color(j, k, l, 100).endVertex();
        worldrenderer.pos(d14, 0.0D, d15).tex(0.0D, d22).color(j, k, l, 100).endVertex();
        worldrenderer.pos(d14, d0, d15).tex(0.0D, d23).color(j, k, l, 100).endVertex();
        worldrenderer.pos(d16, d0, d17).tex(0.4999D, d23).color(j, k, l, 100).endVertex();
        worldrenderer.pos(d16, 0.0D, d17).tex(0.4999D, d22).color(j, k, l, 100).endVertex();
        worldrenderer.pos(d18, 0.0D, d19).tex(0.0D, d22).color(j, k, l, 100).endVertex();
        worldrenderer.pos(d18, d0, d19).tex(0.0D, d23).color(j, k, l, 100).endVertex();
        double d24 = 0.0D;
        if (entity.ticksExisted % 2 == 0) {
            d24 = 0.5D;
        }
        worldrenderer.pos(d4, d0, d5).tex(0.5D, d24 + 0.5D).color(j, k, l, 100).endVertex();
        worldrenderer.pos(d6, d0, d7).tex(1.0D, d24 + 0.5D).color(j, k, l, 100).endVertex();
        worldrenderer.pos(d10, d0, d11).tex(1.0D, d24).color(j, k, l, 100).endVertex();
        worldrenderer.pos(d8, d0, d9).tex(0.5D, d24).color(j, k, l, 100).endVertex();
        tessellator.draw();
        GlStateManager.enableLighting();
        GlStateManager.enableCull();
        GlStateManager.enableBlend();
        GlStateManager.popMatrix();
    }
}
Also used : Tessellator(net.minecraft.client.renderer.Tessellator) BufferBuilder(net.minecraft.client.renderer.BufferBuilder) ResourceLocation(net.minecraft.util.ResourceLocation) EntityLivingBase(net.minecraft.entity.EntityLivingBase) Vec3d(net.minecraft.util.math.Vec3d)

Example 45 with EntityLivingBase

use of net.minecraft.entity.EntityLivingBase in project MorePlanets by SteveKunG.

the class EntityAlienMiner method onLivingUpdate.

@Override
public void onLivingUpdate() {
    if (!this.onGround && this.motionY < 0.0D) {
        this.motionY *= 0.6D;
    }
    if (this.world.isRemote) {
        if (this.hasTargetedEntity()) {
            if (this.chargedTime < 80) {
                ++this.chargedTime;
            }
            MorePlanetsCore.PROXY.spawnParticle(EnumParticleTypesMP.ALIEN_MINER_SPARK, this.posX, this.posY + 0.85D + this.getHoverTick(FMLClientHandler.instance().getClient().getRenderPartialTicks()), this.posZ, new Object[] { -this.getChargedTime(0.0F) });
            EntityLivingBase entitylivingbase = this.getTargetedEntity();
            if (entitylivingbase != null) {
                this.getLookHelper().setLookPositionWithEntity(entitylivingbase, 90.0F, 90.0F);
                this.getLookHelper().onUpdateLook();
            }
        }
    }
    super.onLivingUpdate();
}
Also used : EntityLivingBase(net.minecraft.entity.EntityLivingBase)

Aggregations

EntityLivingBase (net.minecraft.entity.EntityLivingBase)594 EntityPlayer (net.minecraft.entity.player.EntityPlayer)201 Entity (net.minecraft.entity.Entity)177 PotionEffect (net.minecraft.potion.PotionEffect)106 ItemStack (net.minecraft.item.ItemStack)88 AxisAlignedBB (net.minecraft.util.math.AxisAlignedBB)86 BlockPos (net.minecraft.util.math.BlockPos)77 SubscribeEvent (net.minecraftforge.fml.common.eventhandler.SubscribeEvent)77 Vec3d (net.minecraft.util.math.Vec3d)65 World (net.minecraft.world.World)57 IBlockState (net.minecraft.block.state.IBlockState)45 List (java.util.List)38 ArrayList (java.util.ArrayList)37 EntityPlayerMP (net.minecraft.entity.player.EntityPlayerMP)37 TileEntity (net.minecraft.tileentity.TileEntity)37 EntityItem (net.minecraft.entity.item.EntityItem)32 DamageSource (net.minecraft.util.DamageSource)25 Block (net.minecraft.block.Block)24 NBTTagCompound (net.minecraft.nbt.NBTTagCompound)23 WorldServer (net.minecraft.world.WorldServer)23