コード例 #1
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);
        }
      }
    }
  }
コード例 #2
0
  @Override
  public void doSpellCasterEffect(EntityPlayer caster) {
    caster.worldObj.playSoundAtEntity(caster, "mob.wither.idle", 1.0F, 1.0F);

    final EntitySkeleton witherSkeleton = new EntitySkeleton(caster.worldObj);
    witherSkeleton.setSkeletonType(1);
    witherSkeleton.setPosition(caster.posX, caster.posY, caster.posZ);

    caster.worldObj.spawnEntityInWorld(witherSkeleton);
    PacketDispatcher.sendPacketToAllPlayers(
        PacketHandler.createSummonGFXPacket(
            witherSkeleton.posX, witherSkeleton.posY, witherSkeleton.posZ));
  }