SPIGOT-6836: Add more API methods in MerchantRecipe
By: Doc <nachito94@msn.com>
This commit is contained in:
@@ -9,8 +9,14 @@
|
||||
public class MerchantRecipe {
|
||||
|
||||
public ItemStack baseCostA;
|
||||
@@ -17,6 +19,18 @@
|
||||
private int demand;
|
||||
@@ -13,10 +15,26 @@
|
||||
public int uses;
|
||||
public int maxUses;
|
||||
public boolean rewardExp;
|
||||
- private int specialPriceDiff;
|
||||
- private int demand;
|
||||
+ public int specialPriceDiff; // PAIL private -> public
|
||||
+ public int demand; // PAIL private -> public
|
||||
public float priceMultiplier;
|
||||
public int xp;
|
||||
+ // CraftBukkit start
|
||||
@@ -21,14 +27,18 @@
|
||||
+ }
|
||||
+
|
||||
+ public MerchantRecipe(ItemStack itemstack, ItemStack itemstack1, ItemStack itemstack2, int uses, int maxUses, int experience, float priceMultiplier, CraftMerchantRecipe bukkit) {
|
||||
+ this(itemstack, itemstack1, itemstack2, uses, maxUses, experience, priceMultiplier);
|
||||
+ this(itemstack, itemstack1, itemstack2, uses, maxUses, experience, priceMultiplier, 0, bukkit);
|
||||
+ }
|
||||
+
|
||||
+ public MerchantRecipe(ItemStack itemstack, ItemStack itemstack1, ItemStack itemstack2, int uses, int maxUses, int experience, float priceMultiplier, int demand, CraftMerchantRecipe bukkit) {
|
||||
+ this(itemstack, itemstack1, itemstack2, uses, maxUses, experience, priceMultiplier, demand);
|
||||
+ this.bukkitHandle = bukkit;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
|
||||
public MerchantRecipe(NBTTagCompound nbttagcompound) {
|
||||
this.rewardExp = true;
|
||||
@@ -78,6 +92,7 @@
|
||||
@@ -78,6 +96,7 @@
|
||||
|
||||
public ItemStack getCostA() {
|
||||
int i = this.baseCostA.getCount();
|
||||
@@ -36,3 +46,16 @@
|
||||
ItemStack itemstack = this.baseCostA.copy();
|
||||
int j = Math.max(0, MathHelper.floor((float) (i * this.demand) * this.priceMultiplier));
|
||||
|
||||
@@ -199,7 +218,11 @@
|
||||
if (!this.satisfiedBy(itemstack, itemstack1)) {
|
||||
return false;
|
||||
} else {
|
||||
- itemstack.shrink(this.getCostA().getCount());
|
||||
+ // CraftBukkit start
|
||||
+ if (!this.getCostA().isEmpty()) {
|
||||
+ itemstack.shrink(this.getCostA().getCount());
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
if (!this.getCostB().isEmpty()) {
|
||||
itemstack1.shrink(this.getCostB().getCount());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user