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; }