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