Package net.minecraft.util

Examples of net.minecraft.util.DamageSource


    public void onEntityCollidedWithBlock (World par1World, int x, int y, int z, Entity entity)
    {
        //entity.motionY *= 1.5D;
        if (!(entity instanceof EntityItem) && !(entity instanceof EntityGhast) && Natura.random.nextInt(30) == 0)
        {
            DamageSource source = Natura.random.nextBoolean() ? DamageSource.cactus : DamageSource.lava;
            entity.attackEntityFrom(source, 1);
        }
    }
View Full Code Here


                        if (this.getIsCritical())
                        {
                            i1 += this.rand.nextInt(i1 / 2 + 2);
                        }

                        DamageSource damagesource = null;

                        if (this.isBurning() && !(movingobjectposition.entityHit instanceof EntityEnderman))
                        {
                            movingobjectposition.entityHit.setFire(5);
                        }
View Full Code Here

            Vec3 lookVec = player.getLookVec();
            if (hitMOP != null) {
                switch (hitMOP.typeOfHit) {
                    case ENTITY:
                        drawParticleStreamTo(player, world, hitMOP.hitVec.xCoord, hitMOP.hitVec.yCoord, hitMOP.hitVec.zCoord);
                        DamageSource damageSource = DamageSource.causePlayerDamage(player);
                        if (hitMOP.entityHit.attackEntityFrom(damageSource, (int) damage)) {
                            hitMOP.entityHit.addVelocity(lookVec.xCoord * knockback, Math.abs(lookVec.yCoord + 0.2f) * knockback, lookVec.zCoord
                                    * knockback);
                        }
                        break;
View Full Code Here

    case BODY :  case HEAD :  case LEFTARM :  case RIGHTARM :
    {
      //Calculate the hit damage
      float hitDamage = bullet.damage * bullet.type.damageVsLiving * damageModifier;
      //Create a damage source object
      DamageSource damagesource = bullet.owner == null ? DamageSource.generic : bullet.getBulletDamage(type == EnumHitboxType.HEAD);

      //When the damage is 0 (such as with Nerf guns) the entityHurt Forge hook is not called, so this hacky thing is here
      if(!player.worldObj.isRemote && hitDamage == 0 && TeamsManager.getInstance().currentRound != null)
        TeamsManager.getInstance().currentRound.gametype.playerAttacked((EntityPlayerMP)player, damagesource);
     
View Full Code Here

      return;
    if(event.entity instanceof EntityPlayerMP)
    {
      EntityPlayerMP player = (EntityPlayerMP)event.entity;
      PlayerData data = PlayerHandler.getPlayerData(player);
      DamageSource source = event.source;
     
      if(data.team == Team.spectators && source != DamageSource.generic)
      {
        event.setCanceled(true);
        return;
      }
     
      if(source instanceof EntityDamageSource && source.getEntity() instanceof EntityPlayerMP)
      {
        EntityPlayerMP attacker = ((EntityPlayerMP) source.getEntity());
        PlayerData attackerData = PlayerHandler.getPlayerData(attacker);
       
        if(attackerData == null)
          return;
       
View Full Code Here

        AELog.error( err );
      }

      if ( pos != null )
      {
        DamageSource dmgSrc = DamageSource.causePlayerDamage( p );
        dmgSrc.damageType = "masscannon";

        if ( pos.typeOfHit == MovingObjectType.ENTITY )
        {
          int dmg = (int) Math.ceil( penetration / 20.0f );
View Full Code Here

TOP

Related Classes of net.minecraft.util.DamageSource

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.