package joshie.harvest.shops.requirement;
import joshie.harvest.core.helpers.InventoryHelper;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import static joshie.harvest.core.helpers.InventoryHelper.ORE_DICTIONARY;
public class String extends AbstractRequirement {
private static final ItemStack item = new ItemStack(Items.STRING);
private String(ItemStack icon, int cost) {
super(icon, cost);
}
public static String of(int amount) {
return new String(item, amount);
}
@Override
public boolean isFulfilled(World world, EntityPlayer player, int amount) {
return InventoryHelper.hasInInventory(player, ORE_DICTIONARY, "string", (cost * amount));
}
@Override
public void onPurchased(EntityPlayer player) {
InventoryHelper.takeItemsInInventory(player, ORE_DICTIONARY, "string", cost);
}
}