Remap CraftBukkit to Mojang+Yarn Mappings
By: Initial Source <noreply+automated@papermc.io>
This commit is contained in:
@@ -1,9 +0,0 @@
|
||||
--- a/net/minecraft/world/item/trading/IMerchant.java
|
||||
+++ b/net/minecraft/world/item/trading/IMerchant.java
|
||||
@@ -54,4 +54,6 @@
|
||||
boolean isClientSide();
|
||||
|
||||
boolean stillValid(EntityHuman entityhuman);
|
||||
+
|
||||
+ org.bukkit.craftbukkit.inventory.CraftMerchant getCraftMerchant(); // CraftBukkit
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
--- a/net/minecraft/world/item/trading/Merchant.java
|
||||
+++ b/net/minecraft/world/item/trading/Merchant.java
|
||||
@@ -54,4 +54,6 @@
|
||||
boolean isClientSide();
|
||||
|
||||
boolean stillValid(Player player);
|
||||
+
|
||||
+ org.bukkit.craftbukkit.inventory.CraftMerchant getCraftMerchant(); // CraftBukkit
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
--- a/net/minecraft/world/item/trading/MerchantOffer.java
|
||||
+++ b/net/minecraft/world/item/trading/MerchantOffer.java
|
||||
@@ -8,6 +8,8 @@
|
||||
import net.minecraft.util.Mth;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
|
||||
+import org.bukkit.craftbukkit.inventory.CraftMerchantRecipe; // CraftBukkit
|
||||
+
|
||||
public class MerchantOffer {
|
||||
|
||||
public static final Codec<MerchantOffer> CODEC = RecordCodecBuilder.create((instance) -> {
|
||||
@@ -44,7 +46,19 @@
|
||||
public int demand;
|
||||
public float priceMultiplier;
|
||||
public int xp;
|
||||
+ // CraftBukkit start
|
||||
+ private CraftMerchantRecipe bukkitHandle;
|
||||
|
||||
+ public CraftMerchantRecipe asBukkit() {
|
||||
+ return (this.bukkitHandle == null) ? this.bukkitHandle = new CraftMerchantRecipe(this) : this.bukkitHandle;
|
||||
+ }
|
||||
+
|
||||
+ public MerchantOffer(ItemCost baseCostA, Optional<ItemCost> costB, ItemStack result, int uses, int maxUses, int experience, float priceMultiplier, int demand, CraftMerchantRecipe bukkit) {
|
||||
+ this(baseCostA, costB, result, uses, maxUses, experience, priceMultiplier, demand);
|
||||
+ this.bukkitHandle = bukkit;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
private MerchantOffer(ItemCost firstBuyItem, Optional<ItemCost> secondBuyItem, ItemStack sellItem, int uses, int maxUses, boolean rewardingPlayerExperience, int specialPrice, int demandBonus, float priceMultiplier, int merchantExperience) {
|
||||
this.baseCostA = firstBuyItem;
|
||||
this.costB = secondBuyItem;
|
||||
@@ -185,7 +199,11 @@
|
||||
if (!this.satisfiedBy(firstBuyStack, secondBuyStack)) {
|
||||
return false;
|
||||
} else {
|
||||
- firstBuyStack.shrink(this.getCostA().getCount());
|
||||
+ // CraftBukkit start
|
||||
+ if (!this.getCostA().isEmpty()) {
|
||||
+ firstBuyStack.shrink(this.getCostA().getCount());
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
if (!this.getCostB().isEmpty()) {
|
||||
secondBuyStack.shrink(this.getCostB().getCount());
|
||||
}
|
||||
@@ -1,43 +0,0 @@
|
||||
--- a/net/minecraft/world/item/trading/MerchantRecipe.java
|
||||
+++ b/net/minecraft/world/item/trading/MerchantRecipe.java
|
||||
@@ -8,6 +8,8 @@
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
|
||||
+import org.bukkit.craftbukkit.inventory.CraftMerchantRecipe; // CraftBukkit
|
||||
+
|
||||
public class MerchantRecipe {
|
||||
|
||||
public static final Codec<MerchantRecipe> CODEC = RecordCodecBuilder.create((instance) -> {
|
||||
@@ -44,6 +46,18 @@
|
||||
public 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(ItemCost baseCostA, Optional<ItemCost> costB, ItemStack result, int uses, int maxUses, int experience, float priceMultiplier, int demand, CraftMerchantRecipe bukkit) {
|
||||
+ this(baseCostA, costB, result, uses, maxUses, experience, priceMultiplier, demand);
|
||||
+ this.bukkitHandle = bukkit;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
|
||||
private MerchantRecipe(ItemCost itemcost, Optional<ItemCost> optional, ItemStack itemstack, int i, int j, boolean flag, int k, int l, float f, int i1) {
|
||||
this.baseCostA = itemcost;
|
||||
@@ -185,7 +199,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