13
0
geforkt von Mirrors/Paper

Fix PrepareItemCraftEvent#isRepair

By: md_5 <git@md-5.net>
Dieser Commit ist enthalten in:
CraftBukkit/Spigot 2021-06-20 09:03:27 +10:00
Ursprung 453d93caa5
Commit 41524cf726

Datei anzeigen

@ -1,10 +1,11 @@
--- a/net/minecraft/world/inventory/ContainerWorkbench.java
+++ b/net/minecraft/world/inventory/ContainerWorkbench.java
@@ -14,6 +14,11 @@
@@ -14,6 +14,12 @@
import net.minecraft.world.level.World;
import net.minecraft.world.level.block.Blocks;
+// CraftBukkit start
+import net.minecraft.world.item.crafting.RecipeRepair;
+import org.bukkit.craftbukkit.inventory.CraftInventoryCrafting;
+import org.bukkit.craftbukkit.inventory.CraftInventoryView;
+// CraftBukkit end
@ -12,7 +13,7 @@
public class ContainerWorkbench extends ContainerRecipeBook<InventoryCrafting> {
public static final int RESULT_SLOT = 0;
@@ -27,6 +32,9 @@
@@ -27,6 +33,9 @@
private final InventoryCraftResult resultSlots;
public final ContainerAccess access;
private final EntityHuman player;
@ -22,7 +23,7 @@
public ContainerWorkbench(int i, PlayerInventory playerinventory) {
this(i, playerinventory, ContainerAccess.NULL);
@@ -34,8 +42,11 @@
@@ -34,8 +43,11 @@
public ContainerWorkbench(int i, PlayerInventory playerinventory, ContainerAccess containeraccess) {
super(Containers.CRAFTING, i);
@ -35,7 +36,7 @@
this.access = containeraccess;
this.player = playerinventory.player;
this.a((Slot) (new SlotResult(playerinventory.player, this.craftSlots, this.resultSlots, 0, 124, 35)));
@@ -71,9 +82,10 @@
@@ -71,9 +83,10 @@
RecipeCrafting recipecrafting = (RecipeCrafting) optional.get();
if (inventorycraftresult.setRecipeUsed(world, entityplayer, recipecrafting)) {
@ -43,11 +44,11 @@
+ itemstack = recipecrafting.a(inventorycrafting); // CraftBukkit - decompile error
}
}
+ itemstack = org.bukkit.craftbukkit.event.CraftEventFactory.callPreCraftEvent(inventorycrafting, inventorycraftresult, itemstack, container.getBukkitView(), false); // CraftBukkit
+ itemstack = org.bukkit.craftbukkit.event.CraftEventFactory.callPreCraftEvent(inventorycrafting, inventorycraftresult, itemstack, container.getBukkitView(), optional.orElse(null) instanceof RecipeRepair); // CraftBukkit
inventorycraftresult.setItem(0, itemstack);
container.a(0, itemstack);
@@ -114,6 +126,7 @@
@@ -114,6 +127,7 @@
@Override
public boolean canUse(EntityHuman entityhuman) {
@ -55,7 +56,7 @@
return a(this.access, entityhuman, Blocks.CRAFTING_TABLE);
}
@@ -202,4 +215,17 @@
@@ -202,4 +216,17 @@
public boolean d(int i) {
return i != this.j();
}