mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-10 12:02:36 +01:00
b3a8254758
By: md_5 <git@md-5.net>
38 lines
1.4 KiB
Diff
38 lines
1.4 KiB
Diff
--- a/net/minecraft/world/item/trading/MerchantRecipe.java
|
|
+++ b/net/minecraft/world/item/trading/MerchantRecipe.java
|
|
@@ -5,6 +5,8 @@
|
|
import net.minecraft.util.MathHelper;
|
|
import net.minecraft.world.item.ItemStack;
|
|
|
|
+import org.bukkit.craftbukkit.inventory.CraftMerchantRecipe; // CraftBukkit
|
|
+
|
|
public class MerchantRecipe {
|
|
|
|
public ItemStack baseCostA;
|
|
@@ -17,6 +19,18 @@
|
|
private int demand;
|
|
public float priceMultiplier;
|
|
public int xp;
|
|
+ // CraftBukkit start
|
|
+ private CraftMerchantRecipe bukkitHandle;
|
|
+
|
|
+ public CraftMerchantRecipe asBukkit() {
|
|
+ return (bukkitHandle == null) ? bukkitHandle = new CraftMerchantRecipe(this) : bukkitHandle;
|
|
+ }
|
|
+
|
|
+ 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.bukkitHandle = bukkit;
|
|
+ }
|
|
+ // CraftBukkit end
|
|
|
|
public MerchantRecipe(NBTTagCompound nbttagcompound) {
|
|
this.rewardExp = true;
|
|
@@ -78,6 +92,7 @@
|
|
|
|
public ItemStack getBuyItem1() {
|
|
int i = this.baseCostA.getCount();
|
|
+ if (i <= 0) return ItemStack.EMPTY; // CraftBukkit - SPIGOT-5476
|
|
ItemStack itemstack = this.baseCostA.cloneItemStack();
|
|
int j = Math.max(0, MathHelper.d((float) (i * this.demand) * this.priceMultiplier));
|
|
|