@Override
 protected void onImpact(MovingObjectPosition mop) {
   if (!this.worldObj.isRemote && getThrower() != null) {
     if (mop.entityHit != null) {
       Entity ent = mop.entityHit;
       if (ent instanceof EntityLivingBase) {
         ((EntityLivingBase) ent)
             .attackEntityFrom(DamageSource.causeIndirectMagicDamage(getThrower(), ent), this.dmg);
         if (this.corrosive) {
           try {
             ((EntityLivingBase) ent).addPotionEffect(new PotionEffect(Potion.wither.id, 160, 1));
           } catch (Exception e) {
             e.printStackTrace();
           }
         } else {
           try {
             ((EntityLivingBase) ent)
                 .addPotionEffect(new PotionEffect(Potion.weakness.id, 160, 1));
           } catch (Exception e) {
             e.printStackTrace();
           }
         }
       }
     }
     this.worldObj.playSoundAtEntity(
         this, "random.fizz", 0.5F, 2.6F + (this.rand.nextFloat() - this.rand.nextFloat()) * 0.8F);
     this.ticksExisted = 100;
     this.worldObj.setEntityState(this, (byte) 16);
   }
   setDead();
 }
Exemplo n.º 2
0
  @Override
  public boolean attackEntityAsMob(Entity par1Entity) {
    if (this.worldObj.isRemote) return false;

    boolean result = super.attackEntityAsMob(par1Entity);

    EnumDifficulty dif = this.worldObj.getDifficulty();
    int x = 2;

    if (dif == EnumDifficulty.NORMAL) {
      x = 3;
    } else if (dif == EnumDifficulty.HARD) {
      x = 4;
    }

    if (result) {
      if (this.isSpinning()) this.setSpinTicks(0);
      if (this.getFlutterTicks() > 0) this.setFlutterTicks(0);

      if (par1Entity instanceof EntityLivingBase) {
        if (rand.nextInt(16 / x) == 0)
          ((EntityLivingBase) par1Entity)
              .addPotionEffect(
                  new PotionEffect(
                      Potion.moveSlowdown.id, 100 + rand.nextInt(140), 1 + rand.nextInt(2)));
        if (rand.nextInt(32 / x) == 0)
          ((EntityLivingBase) par1Entity)
              .addPotionEffect(
                  new PotionEffect(
                      Potion.digSlowdown.id, 100 + rand.nextInt(140), 1 + rand.nextInt(2)));
      }
    }

    return result;
  }
 @SuppressWarnings("unchecked")
 protected Entity areaOfEffect() {
   List<EntityLivingBase> list =
       worldObj.getEntitiesWithinAABB(
           EntityLivingBase.class,
           AxisAlignedBB.getBoundingBox(
                   attacker.boundingBox.minX,
                   attacker.boundingBox.minY,
                   attacker.boundingBox.minZ,
                   attacker.boundingBox.maxX,
                   attacker.boundingBox.maxY,
                   attacker.boundingBox.maxZ)
               .expand(8D, 1D, 8D));
   for (int i = 0; i < list.size(); i++) {
     Entity entity = list.get(i);
     if (entity != null)
       if (entity instanceof EntityLivingBase
           && !(entity instanceof EntityTarantulaMiniboss)
           && !(entity instanceof EntityTarantula)
           && !(entity instanceof EntityTarantulaBaby)) {
         float Knockback = 2;
         entity.attackEntityFrom(DamageSource.causeMobDamage(attacker), 8.0F);
         entity.addVelocity(
             -MathHelper.sin(attacker.rotationYaw * 3.141593F / 180.0F) * Knockback * 0.5F,
             0.4D,
             MathHelper.cos(attacker.rotationYaw * 3.141593F / 180.0F) * Knockback * 0.5F);
         attacker.playSound("erebus:blamsound", 1.5F, 1.0F);
         ((EntityLivingBase) entity)
             .addPotionEffect(new PotionEffect(Potion.moveSlowdown.id, 8 * 20, 0));
         ((EntityLivingBase) entity)
             .addPotionEffect(new PotionEffect(Potion.blindness.id, 5 * 20, 0));
       }
   }
   return null;
 }
 @Override
 public boolean hitEntity(ItemStack stack, EntityLivingBase entity, EntityLivingBase entity2) {
   entity.addPotionEffect(new PotionEffect(MPPotions.chemical.id, 20));
   entity.addPotionEffect(new PotionEffect(Potion.moveSlowdown.id, 60));
   entity.addPotionEffect(new PotionEffect(MPPotions.icy_poison.id, 80));
   stack.damageItem(1, entity2);
   return true;
 }
Exemplo n.º 5
0
 @SuppressWarnings("ConstantConditions")
 private void effect(EntityLivingBase e) {
   if (isFluid)
     e.getCapability(ArbitraryCaps.CAPABILITY_ARBITRARY_STATS, null)
         .addFluidDebuff(fluid, fluid.getViscosity() / 200);
   else {
     potion.getEffects().forEach(eff -> e.addPotionEffect(new PotionEffect(eff)));
     custom.forEach(eff -> e.addPotionEffect(new PotionEffect(eff)));
   }
 }
Exemplo n.º 6
0
  @Override
  public void onWornTick(ItemStack stack, EntityLivingBase player) {
    if (!player.isInvisible()) {
      player.setInvisible(true);
    }
    NBTTagCompound tag = new NBTTagCompound();
    ((EntityPlayer) player).writeToNBT(tag);
    NBTTagCompound forgeTag = tag.getCompoundTag("ForgeData");

    int corruption = 0;

    if (forgeTag.hasKey("MindCorruption")) corruption = forgeTag.getInteger("MindCorruption");
    else forgeTag.setInteger("MindCorruption", 0);

    ((EntityPlayer) player).capabilities.disableDamage = true;

    if (!player.worldObj.isRemote) {
      if (corruption <= 0) {
        ((EntityPlayer) player)
            .addChatMessage(
                new ChatComponentText(
                    EMTTextHelper.PURPLE
                        + "You have worn the Ring. Your soul has now been forever "
                        + EMTTextHelper.PURPLE
                        + "tainted. "
                        + EMTTextHelper.RED
                        + EMTTextHelper.ITALIC
                        + "Beware of wearing the ring. The tainting will only "
                        + EMTTextHelper.RED
                        + EMTTextHelper.ITALIC
                        + "increase, and strange things will start happening."));
      } else if (corruption > 6000 && corruption < 24000 && random.nextInt(2000) == 0) {
        player.addPotionEffect(new PotionEffect(Potion.blindness.id, 500, 2, false));
      } else if (corruption >= 6000 && corruption < 24000 && random.nextInt(2000) == 0) {
        player.addPotionEffect(new PotionEffect(Potion.confusion.id, 500, 2, false));
      } else if (corruption >= 24000 && corruption < 72000 && random.nextInt(2000) == 0) {
        ((EntityPlayer) player).capabilities.disableDamage = false;

        player.attackEntityFrom(DamageSource.magic, 5);
      } else if (corruption >= 72000 && corruption < 120000 && random.nextInt(4000) == 0) {
        ((EntityPlayer) player).capabilities.disableDamage = false;

        player.motionY += 2d;
      } else if (corruption >= 120000 && random.nextInt(10000) == 0) {
        ((EntityPlayer) player).capabilities.disableDamage = false;

        player.addPotionEffect(new PotionEffect(Potion.wither.id, 5000, 4, false));
      } else if (corruption + 100 >= Integer.MAX_VALUE) { // =3333333
        player.isDead = true;
      }
    }
    forgeTag.setInteger("MindCorruption", ++corruption);
    tag.setTag("ForgeData", forgeTag);
    ((EntityPlayer) player).readFromNBT(tag);
  }
 public static void addOrMergePotionEffect(EntityLivingBase player, PotionEffect newp) {
   if (player.isPotionActive(newp.getPotion())) {
     // do not use built in 'combine' function, just add up duration myself
     PotionEffect p = player.getActivePotionEffect(newp.getPotion());
     int ampMax = Math.max(p.getAmplifier(), newp.getAmplifier());
     player.addPotionEffect(
         new PotionEffect(newp.getPotion(), newp.getDuration() + p.getDuration(), ampMax));
   } else {
     player.addPotionEffect(newp);
   }
 }
Exemplo n.º 8
0
  public boolean tryFill(
      ItemStack stackBase, World world, EntityLivingBase entity, InventoryPlayer inven) {
    // Stack to use

    if (world.isRemote) {
      return false;
    }

    ItemStack stack = stackBase;

    if (stackBase.stackSize > 1) {
      stack = stackBase.copy();
      stack.stackSize = 1;
    }

    ItemData data = new ItemData(stack);

    if (!data.isDirty() && stack.getItemDamage() == 0) {
      data.fill(entity);

      if (data.getId() != -1) {
        world.playSoundAtEntity(
            entity,
            "clonecraft:needle.extract",
            1.0F,
            1.0F / (itemRand.nextFloat() * 0.4F + 1.2F) + 0.5F);

        if (!(entity instanceof EntityPlayer)
            || !((EntityPlayer) entity).capabilities.isCreativeMode) {
          entity.attackEntityFrom(DamageSource.generic, 2.0f);
          entity.addPotionEffect(new PotionEffect(Potion.confusion.getId(), 400));
          entity.addPotionEffect(new PotionEffect(Potion.weakness.getId(), 400));
        }

        data.save(stack);
        stack.setItemDamage(1);

        if (stack != stackBase) {
          stackBase.stackSize--;

          CloneCraftHelper.addToInventory(inven, 0, 36, stack);

          if (stack.stackSize > 0) {
            CloneCraftHelper.dropAtEntity(entity, stack);
          }
        }
        return true;
      }
    }
    return false;
  }
  /** Performs a ranged attack according to the AI's rangedAttackID. */
  private void doRangedAttack() {
    // 43% chance to "miss"
    int chanceToMiss = entityHost.isPotionActive(Potion.moveSpeed) ? 10 : 43;
    if (worldObj.rand.nextInt(100) < chanceToMiss) {
      AMCore.instance.proxy.particleManager.BoltFromPointToPoint(
          worldObj,
          entityHost.posX,
          entityHost.posY + entityHost.getEyeHeight(),
          entityHost.posZ,
          attackTarget.posX + worldObj.rand.nextFloat() - 0.5f,
          attackTarget.posY + attackTarget.getEyeHeight() + worldObj.rand.nextFloat() - 0.5f,
          attackTarget.posZ + worldObj.rand.nextFloat() - 0.5f,
          2,
          -1);
    } else {
      AMCore.instance.proxy.particleManager.BoltFromEntityToEntity(
          worldObj, entityHost, entityHost, attackTarget, this.damage, 2, -1);
      float manaDrained =
          this.manaDrainedPerCasterLevel * ExtendedProperties.For(attackTarget).getMagicLevel();
      ExtendedProperties.For(attackTarget)
          .setCurrentMana(ExtendedProperties.For(attackTarget).getCurrentMana() - (manaDrained));
      ExtendedProperties.For(attackTarget).forceSync();

      attackTarget.attackEntityFrom(
          DamageSource.causeIndirectMagicDamage(entityHost, entityHost), this.damage);

      if (manaDrained > 100) {
        entityHost.heal(1);
        if (entityHost.worldObj.difficultySetting == EnumDifficulty.HARD) {
          attackTarget.addPotionEffect(new PotionEffect(Potion.moveSlowdown.id, 40, 1, true));
          entityHost.addPotionEffect(new PotionEffect(Potion.moveSpeed.id, 40, 3, true));
        }
      }
    }
  }
  protected void onImpact(MovingObjectPosition par1MovingObjectPosition) {
    if (par1MovingObjectPosition.entityHit != null) {
      int i0 = StuffWorthThrowingConfig.rockMinDamage;
      int i1 = StuffWorthThrowingConfig.rockMaxDamage - i0 + 1;
      int i2 = this.rand.nextInt(i1) + i0 + StuffWorthThrowingConfig.brokenBrickStronger;
      int i3 = StuffWorthThrowingConfig.dizzyMultiplier;
      int i4 = StuffWorthThrowingConfig.debuffMultiplier;

      if (!this.worldObj.isRemote && StuffWorthThrowingConfig.itemStatusEffects) {
        EntityLivingBase entityLiving = (EntityLivingBase) par1MovingObjectPosition.entityHit;

        entityLiving.setFire(i2 * i4 / 20);
        if (StuffWorthThrowingConfig.dizzyBricks) {
          entityLiving.addPotionEffect(new PotionEffect(Potion.confusion.getId(), i2 * i3, 0));
        }
      }

      par1MovingObjectPosition.entityHit.attackEntityFrom(
          DamageSource.causeThrownDamage(this, this.getThrower()), (byte) i2);
    }

    for (int i = 0; i < 8; ++i) {
      this.worldObj.spawnParticle("smoke", this.posX, this.posY, this.posZ, 0.0D, 0.0D, 0.0D);
    }

    if (!this.worldObj.isRemote) {
      this.setDead();
    }
  }
 @Override
 public boolean onLeftClickEntity(ItemStack stack, EntityPlayer player, Entity entity) {
   if (entity instanceof EntityLivingBase) {
     ((EntityLivingBase) entity).addPotionEffect(new BuffEffectFrostSlowed(60, 3));
     if (player.worldObj.isRemote) {
       for (int i = 0; i < 5; ++i) {
         AMParticle particle =
             (AMParticle)
                 AMCore.proxy.particleManager.spawn(
                     player.worldObj,
                     "snowflakes",
                     entity.posX + 0.5,
                     entity.posY + 0.5,
                     entity.posZ + 0.5);
         if (particle != null) {
           particle.addRandomOffset(1, 0.5, 1);
           particle.addVelocity(
               player.worldObj.rand.nextDouble() * 0.2 - 0.1,
               0.3,
               player.worldObj.rand.nextDouble() * 0.2 - 0.1);
           particle.setAffectedByGravity();
           particle.setDontRequireControllers();
           particle.setMaxAge(10);
           particle.setParticleScale(0.1f);
         }
       }
     }
   }
   return super.onLeftClickEntity(stack, player, entity);
 }
Exemplo n.º 12
0
 public boolean tryFireMinigun(EntityLivingBase target) {
   boolean lastShotOfAmmo = false;
   if (ammo != null && (pressurizable == null || pressurizable.getPressure(stack) > 0)) {
     setMinigunTriggerTimeOut(Math.max(10, getMinigunSoundCounter()));
     if (getMinigunSpeed() == MAX_GUN_SPEED && (!requiresTarget || gunAimedAtTarget)) {
       if (!requiresTarget) target = raytraceTarget();
       lastShotOfAmmo = ammo.attemptDamageItem(1, rand);
       if (pressurizable != null) pressurizable.addAir(stack, -airUsage);
       if (target != null) {
         ItemStack potion = ItemGunAmmo.getPotion(ammo);
         if (potion != null) {
           if (rand.nextInt(20) == 0) {
             List<PotionEffect> effects = Items.potionitem.getEffects(potion);
             if (effects != null) {
               for (PotionEffect effect : effects) {
                 target.addPotionEffect(new PotionEffect(effect));
               }
             }
           }
         } else {
           target.attackEntityFrom(DamageSource.causePlayerDamage(player), 4);
         }
       }
     }
   }
   return lastShotOfAmmo;
 }
  @SuppressWarnings("unchecked")
  private void potion() {
    List<EntityLivingBase> ents =
        worldObj.getEntitiesWithinAABB(
            EntityLivingBase.class,
            AxisAlignedBB.getBoundingBox(
                xCoord + 1.0,
                yCoord + 1.0,
                zCoord + 1.0,
                xCoord + xLength - 1,
                yCoord + 3.0,
                zCoord + zLength - 1));
    if (ents != null && ents.size() > 0) {
      Potion potion = null;
      // Try and find a potion, 15 times max
      for (int i = 0; i < 15; i++) {
        potion = Potion.potionTypes[worldObj.rand.nextInt(Potion.potionTypes.length)];
        if (potion != null) break;
      }

      if (potion == null) return;

      EntityLivingBase ent = ents.get(worldObj.rand.nextInt(ents.size()));
      ent.addPotionEffect(
          new PotionEffect(potion.id, MathHelper.randomIntInRange(3, 10), 1, false));
    }
  }
Exemplo n.º 14
0
  @Override
  public boolean applyEffectEntity(
      ItemStack stack, World world, EntityLivingBase caster, Entity target) {
    if (target instanceof EntityLivingBase) {
      int duration =
          SpellUtils.instance.getModifiedInt_Mul(
              BuffList.default_buff_duration,
              stack,
              caster,
              target,
              world,
              0,
              SpellModifiers.DURATION);
      duration = SpellUtils.instance.modifyDurationBasedOnArmor(caster, duration);

      int x = (int) Math.floor(target.posX);
      int y = (int) Math.floor(target.posY);
      int z = (int) Math.floor(target.posZ);
      if (RitualShapeHelper.instance.checkForRitual(this, world, x, y, z) != null) {
        duration +=
            (3600 * (SpellUtils.instance.countModifiers(SpellModifiers.BUFF_POWER, stack, 0) + 1));
        RitualShapeHelper.instance.consumeRitualReagents(this, world, x, y, z);
      }

      if (!world.isRemote)
        ((EntityLivingBase) target)
            .addPotionEffect(
                new BuffEffectTrueSight(
                    duration,
                    SpellUtils.instance.countModifiers(SpellModifiers.BUFF_POWER, stack, 0)));
      return true;
    }
    return false;
  }
Exemplo n.º 15
0
  @Override
  protected void onImpact(MovingObjectPosition par1MovingObjectPosition) {
    if (!this.worldObj.isRemote
        && potionStack.getItem() != null
        && potionStack.getItem() instanceof ItemPotion) {
      @SuppressWarnings("unchecked")
      List<PotionEffect> effectList = ((ItemPotion) potionStack.getItem()).getEffects(potionStack);

      if (effectList != null && !effectList.isEmpty()) {
        AxisAlignedBB axisalignedbb = this.boundingBox.expand(4.0D, 2.0D, 4.0D);
        @SuppressWarnings("unchecked")
        List<EntityLivingBase> entityList =
            this.worldObj.getEntitiesWithinAABB(EntityLivingBase.class, axisalignedbb);

        if (entityList != null && !entityList.isEmpty()) {
          Iterator<EntityLivingBase> iterator = entityList.iterator();

          while (iterator.hasNext()) {
            EntityLivingBase entityliving = iterator.next();
            double squareDistance = this.getDistanceSqToEntity(entityliving);

            if (squareDistance < 16.0D) {
              double distanceFactor = 1.0D - Math.sqrt(squareDistance) / 4.0D;

              if (entityliving == par1MovingObjectPosition.entityHit) {
                distanceFactor = 1.0D;
              }

              Iterator<PotionEffect> iterator1 = effectList.iterator();

              while (iterator1.hasNext()) {
                PotionEffect potioneffect = iterator1.next();
                int potionID = potioneffect.getPotionID();

                if (Potion.potionTypes[potionID].isInstant()) {
                  Potion.potionTypes[potionID].affectEntity(
                      this.getThrower(), entityliving, potioneffect.getAmplifier(), distanceFactor);
                } else {
                  int potionDuration = (int) (distanceFactor * potioneffect.getDuration() + 0.5D);

                  if (potionDuration > 20) {
                    entityliving.addPotionEffect(
                        new PotionEffect(potionID, potionDuration, potioneffect.getAmplifier()));
                  }
                }
              }
            }
          }
        }
      }

      this.worldObj.playAuxSFX(
          2002,
          (int) Math.round(this.posX),
          (int) Math.round(this.posY),
          (int) Math.round(this.posZ),
          potionStack.getItemDamage());
      this.setDead();
    }
  }
 @Override
 public void onEntityCollidedWithBlock(World world, int x, int y, int z, Entity entity) {
   if (entity instanceof EntityLivingBase) {
     entity.setVelocity(0, 0, 0);
     ((EntityLivingBase) entity)
         .addPotionEffect(new PotionEffect(Potion.digSlowdown.getId(), 30, 3, true));
   }
 }
 public boolean hitEntity(
     ItemStack par1ItemStack,
     EntityLivingBase par2EntityLiving,
     EntityLivingBase par3EntityLiving) {
   par1ItemStack.damageItem(1, par3EntityLiving);
   par2EntityLiving.addPotionEffect(new PotionEffect(Potion.wither.id, 80, 0));
   return true;
 }
Exemplo n.º 18
0
 @Override
 public void onEntityCollidedWithBlock(World world, int x, int y, int z, Entity entity) {
   if (this == ModBlocks.fluxInfestedSoil) {
     if (entity instanceof EntityLivingBase) {
       ((EntityLivingBase) entity).addPotionEffect(new PotionEffect(Potion.wither.getId(), 20, 5));
     }
   }
 }
Exemplo n.º 19
0
 public boolean hitEntity(
     ItemStack par1ItemStack,
     EntityLivingBase par2EntityLivingBase,
     EntityLivingBase par3EntityLivingBase) {
   par3EntityLivingBase.addPotionEffect(new PotionEffect(5, 20 * 5, 1));
   par3EntityLivingBase.addPotionEffect(new PotionEffect(3, 20 * 5, 1));
   return true;
 }
Exemplo n.º 20
0
  @Override
  public void useDoomsday(
      DoomsdayEffect effect, PropertyDoom doom, EntityPlayer player, boolean crucMoment) {
    List<Entity> list =
        player.worldObj.getEntitiesWithinAABBExcludingEntity(
            player, player.boundingBox.expand(32.0, 32.0, 32.0));

    for (Entity e : list) {
      if (e instanceof EntityPlayer) {
        ((EntityLivingBase) e)
            .addPotionEffect(new PotionEffect(Potion.regeneration.id, 600, crucMoment ? 5 : 1));
        if (TragicConfig.allowConvergence && e != player)
          ((EntityLivingBase) e)
              .addPotionEffect(
                  new PotionEffect(TragicPotion.Convergence.id, 600, crucMoment ? 5 : 1));
      }
    }
  }
Exemplo n.º 21
0
  /**
   * Current implementations of this method in child classes do not use the entry argument beside
   * ev. They just raise the damage on the stack.
   */
  public boolean hitEntity(
      ItemStack par1ItemStack,
      EntityLivingBase par2EntityLiving,
      EntityLivingBase par3EntityLiving) {

    par2EntityLiving.addPotionEffect(new PotionEffect(Potion.weakness.id, 10 * 20, 6));
    par1ItemStack.damageItem(1, par3EntityLiving);
    return true;
  }
Exemplo n.º 22
0
  public boolean hitEntity(ItemStack stack, EntityLivingBase target, EntityLivingBase attacker) {
    PotionEffect potion = new PotionEffect(EldritchPotions.getPotion(0).id, 100);
    potion.setCurativeItems(null);
    target.addPotionEffect(potion);

    stack.damageItem(1, attacker);

    return false;
  }
Exemplo n.º 23
0
 @Override
 public void onEntityCollidedWithBlock(World world, int x, int y, int z, Entity entity) {
   if (entity instanceof EntityLivingBase) {
     int damage = world.getBlockMetadata(x, y, z) / 2 + 1;
     if (entity.fallDistance > 0) damage += ((entity.fallDistance) * 1.5 + 2);
     entity.attackEntityFrom(DamageSource.cactus, damage);
     ((EntityLivingBase) entity).addPotionEffect(new PotionEffect(Potion.moveSlowdown.id, 20, 1));
   }
 }
Exemplo n.º 24
0
 public boolean hitEntity(ItemStack item, EntityLivingBase target, EntityLivingBase player) {
   target.addVelocity(0, 1, 0);
   player.addPotionEffect(new PotionEffect(1, 10, 150));
   // EntityLightningBolt lightning = new EntityLightningBolt(target.worldObj, target.posX,
   // target.posY, target.posZ);
   // player.worldObj.addWeatherEffect(lightning);
   // target.worldObj.createExplosion(null, target.posX, target.posY, target.posZ, 4.0f, true);
   target.setFire(4);
   return true;
 }
  void attackEntity(EntityLivingBase e) {
    ChromaSounds.DISCHARGE.playSoundAtBlock(this);

    ChromaAux.doPylonAttack(e, 5, true);

    PotionEffect eff = CrystalPotionController.getEffectFromColor(color, 200, 2);
    if (eff != null) {
      e.addPotionEffect(eff);
    }
  }
Exemplo n.º 26
0
 public boolean attackEntityAsMob(Entity par1Entity) {
   if (super.attackEntityAsMob(par1Entity)) {
     if (ConfigGaia.BaseDamage) {
       ((EntityLivingBase) par1Entity).addPotionEffect(new PotionEffect(Potion.harm.id, 2, 0));
     }
     return true;
   } else {
     return false;
   }
 }
Exemplo n.º 27
0
  public void upgradeMob(EntityLivingBase mob) {
    int diff = mob.worldObj.difficultySetting.getDifficultyId();

    if (ConfigHardcore.upgradeZombieWep) {
      if (mob instanceof EntitySkeleton) {
        if (((EntitySkeleton) mob).getSkeletonType() == 1) {
          giveEntityWeapon(mob, 5, rand.nextInt(7));
        }
      }
      if (mob instanceof EntityZombie) {
        int tier = 2;
        if (mob instanceof EntityPigZombie) {
          tier = 7;
          giveEntityWeapon(mob, tier, rand.nextInt(4));
        } else {
          if (mob.getHeldItem() != null && mob.getHeldItem().getItem() == Items.iron_sword) {
            giveEntityWeapon(mob, tier, 0);
          } else {
            if (rand.nextFloat() * (zombieWepChance * ConfigHardcore.zombieWepChance) < diff) {
              giveEntityWeapon(mob, tier, rand.nextInt(4));
            }
          }
        }
        if (rand.nextFloat() * (zombieKnightChance * ConfigHardcore.zombieWepChance) < diff) {
          createZombieKnight((EntityZombie) mob);
        } else if (rand.nextFloat() * (zombieBruteChance * ConfigHardcore.zombieWepChance) < diff) {
          createZombieBrute((EntityZombie) mob);
        }
      }
    }
    if (mob instanceof EntitySpider) {
      if (mob.riddenByEntity == null) {
        if (rand.nextFloat() * (skeletalRiderChance * ConfigHardcore.zombieWepChance) < diff) {
          EntitySkeleton rider = new EntitySkeleton(mob.worldObj);
          rider.setPosition(mob.posX, mob.posY, mob.posZ);
          mob.worldObj.spawnEntityInWorld(rider);
          rider.setCurrentItemOrArmor(0, new ItemStack(ToolListMF.lances[2]));
          rider.mountEntity(mob);
          mob.getEntityAttribute(SharedMonsterAttributes.followRange).setBaseValue(64.0D);
          mob.addPotionEffect(new PotionEffect(Potion.moveSpeed.id, Integer.MAX_VALUE, 10));
        } else if (rand.nextFloat() * (witchRiderChance * ConfigHardcore.zombieWepChance) < diff) {
          EntityWitch rider = new EntityWitch(mob.worldObj);
          rider.setPosition(mob.posX, mob.posY, mob.posZ);
          mob.worldObj.spawnEntityInWorld(rider);
          rider.mountEntity(mob);
        } else if (rand.nextFloat() * (creeperJockeyChance * ConfigHardcore.zombieWepChance)
            < diff) {
          EntityCreeper rider = new EntityCreeper(mob.worldObj);
          rider.setPosition(mob.posX, mob.posY, mob.posZ);
          mob.worldObj.spawnEntityInWorld(rider);
          rider.mountEntity(mob);
        }
      }
    }
  }
Exemplo n.º 28
0
  public boolean attackEntityAsMob(Entity p_70652_1_) {
    if (super.attackEntityAsMob(p_70652_1_)) {
      if (this.getSkeletonType() == 1 && p_70652_1_ instanceof EntityLivingBase) {
        ((EntityLivingBase) p_70652_1_).addPotionEffect(new PotionEffect(Potion.wither.id, 200));
      }

      return true;
    } else {
      return false;
    }
  }
Exemplo n.º 29
0
 @Override
 public void doTheMagick(
     World world, double x, double y, double z, Entity caster, NBTTagCompound additionalData) {
   if (caster instanceof EntityLivingBase) {
     double[] props = getStaffMainProperties(additionalData);
     ((EntityLivingBase) caster)
         .addPotionEffect(
             new PotionEffect(
                 Potion.moveSpeed.getId(), (int) (100 * props[0]), (int) Math.ceil(props[1] - 1)));
   }
 }
Exemplo n.º 30
0
 @Override
 public void onUnequipped(ItemStack stack, EntityLivingBase player) {
   player.setInvisible(false);
   if (!((EntityPlayer) player).capabilities.isCreativeMode)
     ((EntityPlayer) player).capabilities.disableDamage = false;
   NBTTagCompound tag = new NBTTagCompound();
   ((EntityPlayer) player).writeToNBT(tag);
   tag.removeTag("ForgeData");
   ((EntityPlayer) player).readFromNBT(tag);
   player.addPotionEffect(new PotionEffect(Potion.confusion.id, 500, 2, false));
 }