예제 #1
0
  @SubscribeEvent
  public void updateLiving(LivingUpdateEvent event) {
    EntityLivingBase living = event.entityLiving;

    if (isEnabled()
        && !living.worldObj.isRemote
        && !living.getEntityData().hasKey("giveMFWeapon")) {
      living.getEntityData().setBoolean("giveMFWeapon", true);
      upgradeMob(event.entityLiving);
    }
  }
예제 #2
0
  private boolean lootTarget(EntityPlayer player, EntityLivingBase target) {
    if (target.getEntityData().getBoolean("LootableEntityFlag")) {
      return false;
    }
    IEntityLootable lootable =
        (target instanceof IEntityLootable ? (IEntityLootable) target : null);
    float lootChance =
        (lootable != null
            ? lootable.getLootableChance(player, getType())
            : LootableEntityRegistry.getEntityLootChance(target.getClass()));
    lootChance *= Config.getWhipLootMultiplier();
    boolean wasItemStolen = false;
    if (rand.nextFloat() < lootChance) {
      ItemStack loot =
          (lootable != null
              ? lootable.getEntityLoot(player, getType())
              : LootableEntityRegistry.getEntityLoot(target.getClass()));
      // TODO remove the following if Skulltulas are added:
      if (target instanceof EntitySpider && rand.nextInt(25) == 0) {
        loot = new ItemStack(ZSSItems.skulltulaToken);
      }
      if (loot != null) {
        EntityItem item = new EntityItem(worldObj, posX, posY + 1, posZ, loot);
        double dx = player.posX - posX;
        double dy = player.posY - posY;
        double dz = player.posZ - posZ;
        TargetUtils.setEntityHeading(item, dx, dy, dz, 1.0F, 1.0F, true);
        if (!worldObj.isRemote) {
          worldObj.spawnEntityInWorld(item);
        }
        player.triggerAchievement(ZSSAchievements.orcaThief);
        wasItemStolen = true;
      }
    }

    if (lootable == null || lootable.onLootStolen(player, wasItemStolen)) {
      if (!worldObj.isRemote) {
        target.getEntityData().setBoolean("LootableEntityFlag", true);
      }
    }
    return wasItemStolen;
  }
예제 #3
0
  private void giveEntityArmour(EntityLivingBase mob, int tier, int suit) {
    mob.getEntityData().setBoolean(zombieArmourNBT, true);

    ItemArmourMF[] pool = ArmourListMF.scalemail;
    if (suit == 1) {
      pool = ArmourListMF.chainmail;
    }
    if (suit == 2) {
      pool = ArmourListMF.splintmail;
    }
    if (suit == 3) {
      pool = ArmourListMF.fieldplate;
    }
    ArmourMaterialMF material = (ArmourMaterialMF) ArmourListMF.mats[tier][0];

    for (int a = 0; a < 4; a++) {
      mob.setCurrentItemOrArmor(4 - a, ArmourListMF.armour(pool, tier, a));
    }
  }