mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-18 08:36:13 +01:00
38 lines
1.4 KiB
Diff
38 lines
1.4 KiB
Diff
--- a/net/minecraft/server/MerchantRecipe.java
|
|
+++ b/net/minecraft/server/MerchantRecipe.java
|
|
@@ -1,5 +1,7 @@
|
|
package net.minecraft.server;
|
|
|
|
+import org.bukkit.craftbukkit.inventory.CraftMerchantRecipe; // CraftBukkit
|
|
+
|
|
public class MerchantRecipe {
|
|
|
|
public ItemStack buyingItem1;
|
|
@@ -12,6 +14,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;
|
|
@@ -73,6 +87,7 @@
|
|
|
|
public ItemStack getBuyItem1() {
|
|
int i = this.buyingItem1.getCount();
|
|
+ if (i <= 0) return ItemStack.a; // CraftBukkit - SPIGOT-5476
|
|
ItemStack itemstack = this.buyingItem1.cloneItemStack();
|
|
int j = Math.max(0, MathHelper.d((float) (i * this.demand) * this.priceMultiplier));
|
|
|