ItemStack istack = item.getEntityItem();
if(player.isSneaking() || istack.isItemEqual(pstack) && ItemStack.areItemStackTagsEqual(istack, pstack))
positionsBuilder.append(item.getEntityId()).append(";");
} else if(e instanceof IInventory) {
IInventory inv = (IInventory) e;
if(scanInventory(inv, pstack))
positionsBuilder.append(e.getEntityId()).append(";");
} else if(e instanceof EntityHorse) {
EntityHorse horse = (EntityHorse) e;
AnimalChest chest = ReflectionHelper.getPrivateValue(EntityHorse.class, horse, LibObfuscation.HORSE_CHEST);
if(scanInventory(chest, pstack))
positionsBuilder.append(horse.getEntityId()).append(";");
} else if(e instanceof EntityPlayer) {
EntityPlayer player_ = (EntityPlayer) e;
InventoryPlayer inv = player_.inventory;
InventoryBaubles binv = PlayerHandler.getPlayerBaubles(player_);
if(scanInventory(inv, pstack) || scanInventory(binv, pstack))
positionsBuilder.append(player_.getEntityId()).append(";");
} else if(e instanceof EntityVillager) {
EntityVillager villager = (EntityVillager) e;
ArrayList<MerchantRecipe> recipes = villager.getRecipes(player);
if(pstack != null)
for(MerchantRecipe recipe : recipes)
if(!recipe.isRecipeDisabled() && (equalStacks(pstack, recipe.getItemToBuy()) || equalStacks(pstack, recipe.getItemToSell())))
positionsBuilder.append(villager.getEntityId()).append(";");
} else if(e instanceof EntityLivingBase) {
EntityLivingBase living = (EntityLivingBase) e;
ItemStack estack = living.getEquipmentInSlot(0);
if(pstack != null && estack != null && equalStacks(estack, pstack))
positionsBuilder.append(living.getEntityId()).append(";");
}
}
if(pstack != null) {
range = 12;
int x = MathHelper.floor_double(player.posX);
int y = MathHelper.floor_double(player.posY);
int z = MathHelper.floor_double(player.posZ);
for(int i = -range; i < range + 1; i++)
for(int j = -range; j < range + 1; j++)
for(int k = -range; k < range + 1; k++) {
int xp = x + i;
int yp = y + j;
int zp = z + k;
TileEntity tile = player.worldObj.getTileEntity(xp, yp, zp);
if(tile != null && tile instanceof IInventory) {
IInventory inv = (IInventory) tile;
if(scanInventory(inv, pstack))
positionsBuilder.append(xp).append(",").append(yp).append(",").append(zp).append(";");
}
}
}