Examples of DamageSource


Examples of net.minecraft.server.DamageSource

   * @param entity to be damaged
   * @param damager that damages
   * @param damage to deal
   */
  public static void damageBy(org.bukkit.entity.Entity entity, org.bukkit.entity.Entity damager, double damage) {
    DamageSource source;
    if (damager instanceof Player) {
      source = DamageSource.playerAttack(CommonNMS.getNative((Player) damager));
    } else if (damager instanceof LivingEntity) {
      source = DamageSource.mobAttack(CommonNMS.getNative((LivingEntity) damager));
    } else {
View Full Code Here

Examples of net.minecraft.server.DamageSource

   * @param entity to be damagedd
   * @param cause of the damage
   * @param damage to deal
   */
  public static void damage(org.bukkit.entity.Entity entity, DamageCause cause, double damage) {
    DamageSource source;
    if (cause == DamageCause.BLOCK_EXPLOSION) {
      Location loc = entity.getLocation();
      World worldhandle = CommonNMS.getNative(loc.getWorld());
      Explosion ex = new Explosion(worldhandle, null, loc.getX(), loc.getY(), loc.getZ(), (float) 4.0);
      source = DamageSource.explosion(ex);
View Full Code Here

Examples of net.minecraft.src.DamageSource

            * motionZ);
        int j1 = (int) Math.ceil((double) f1 * 2D);
        if (arrowCritical) {
          j1 += rand.nextInt(j1 / 2 + 2);
        }
        DamageSource damagesource = null;
        if (shootingEntity == null)
          damagesource = DamageSource.causeArrowDamage(new EntityArrow(worldObj), this);
        else
          damagesource = DamageSource.causeArrowDamage(new EntityArrow(worldObj),
              shootingEntity);
View Full Code Here

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

Examples of net.minecraft.util.DamageSource

                        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

Examples of net.minecraft.util.DamageSource

            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

Examples of net.minecraft.util.DamageSource

    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

Examples of net.minecraft.util.DamageSource

      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

Examples of net.minecraft.util.DamageSource

        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
Copyright © 2018 www.massapi.com. 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.