mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-24 03:25:15 +01:00
Correctly mirror vanilla non-exact ingredients (#11651)
This commit is contained in:
parent
860d948731
commit
aee6f7abe1
@ -13,7 +13,7 @@ public net.minecraft.world.item.ItemStackLinkedSet TYPE_AND_TAG
|
|||||||
|
|
||||||
diff --git a/src/main/java/io/papermc/paper/inventory/recipe/ItemOrExact.java b/src/main/java/io/papermc/paper/inventory/recipe/ItemOrExact.java
|
diff --git a/src/main/java/io/papermc/paper/inventory/recipe/ItemOrExact.java b/src/main/java/io/papermc/paper/inventory/recipe/ItemOrExact.java
|
||||||
new file mode 100644
|
new file mode 100644
|
||||||
index 0000000000000000000000000000000000000000..5bcc814d5a1b88991e9c1324b88a919ca199fcda
|
index 0000000000000000000000000000000000000000..caaad8f54fb892dfd6c7d4e02ab9c32997f89a6a
|
||||||
--- /dev/null
|
--- /dev/null
|
||||||
+++ b/src/main/java/io/papermc/paper/inventory/recipe/ItemOrExact.java
|
+++ b/src/main/java/io/papermc/paper/inventory/recipe/ItemOrExact.java
|
||||||
@@ -0,0 +1,63 @@
|
@@ -0,0 +1,63 @@
|
||||||
@ -26,7 +26,7 @@ index 0000000000000000000000000000000000000000..5bcc814d5a1b88991e9c1324b88a919c
|
|||||||
+
|
+
|
||||||
+ int getMaxStackSize();
|
+ int getMaxStackSize();
|
||||||
+
|
+
|
||||||
+ boolean is(ItemStack stack);
|
+ boolean matches(ItemStack stack);
|
||||||
+
|
+
|
||||||
+ record Item(Holder<net.minecraft.world.item.Item> item) implements ItemOrExact {
|
+ record Item(Holder<net.minecraft.world.item.Item> item) implements ItemOrExact {
|
||||||
+
|
+
|
||||||
@ -40,8 +40,8 @@ index 0000000000000000000000000000000000000000..5bcc814d5a1b88991e9c1324b88a919c
|
|||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ @Override
|
+ @Override
|
||||||
+ public boolean is(final ItemStack stack) {
|
+ public boolean matches(final ItemStack stack) {
|
||||||
+ return stack.is(this.item);
|
+ return stack.is(this.item) && stack.getComponentsPatch().isEmpty();
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ @Override
|
+ @Override
|
||||||
@ -64,7 +64,7 @@ index 0000000000000000000000000000000000000000..5bcc814d5a1b88991e9c1324b88a919c
|
|||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ @Override
|
+ @Override
|
||||||
+ public boolean is(final ItemStack stack) {
|
+ public boolean matches(final ItemStack stack) {
|
||||||
+ return ItemStack.isSameItemSameComponents(this.stack, stack);
|
+ return ItemStack.isSameItemSameComponents(this.stack, stack);
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
@ -196,7 +196,7 @@ index 462a970ffa610bc1eb3c813dafb768c014d077d1..1afb544fb028b645821063ba1eaa9e3c
|
|||||||
if (i == -1) {
|
if (i == -1) {
|
||||||
return -1;
|
return -1;
|
||||||
diff --git a/src/main/java/net/minecraft/world/entity/player/Inventory.java b/src/main/java/net/minecraft/world/entity/player/Inventory.java
|
diff --git a/src/main/java/net/minecraft/world/entity/player/Inventory.java b/src/main/java/net/minecraft/world/entity/player/Inventory.java
|
||||||
index ad82e5aeb565b23c3ec565fa60e1f31d1710bd4e..0e214d502998e9eb959952b257844529992df0df 100644
|
index ad82e5aeb565b23c3ec565fa60e1f31d1710bd4e..0990bcf65f484b9a019c91fcdae1783bac6388da 100644
|
||||||
--- a/src/main/java/net/minecraft/world/entity/player/Inventory.java
|
--- a/src/main/java/net/minecraft/world/entity/player/Inventory.java
|
||||||
+++ b/src/main/java/net/minecraft/world/entity/player/Inventory.java
|
+++ b/src/main/java/net/minecraft/world/entity/player/Inventory.java
|
||||||
@@ -201,11 +201,11 @@ public class Inventory implements Container, Nameable {
|
@@ -201,11 +201,11 @@ public class Inventory implements Container, Nameable {
|
||||||
@ -209,7 +209,7 @@ index ad82e5aeb565b23c3ec565fa60e1f31d1710bd4e..0e214d502998e9eb959952b257844529
|
|||||||
ItemStack itemstack = (ItemStack) this.items.get(i);
|
ItemStack itemstack = (ItemStack) this.items.get(i);
|
||||||
|
|
||||||
- if (!itemstack.isEmpty() && itemstack.is(item) && Inventory.isUsableForCrafting(itemstack)) {
|
- if (!itemstack.isEmpty() && itemstack.is(item) && Inventory.isUsableForCrafting(itemstack)) {
|
||||||
+ if (!itemstack.isEmpty() && item.is(itemstack) && (!(item instanceof io.papermc.paper.inventory.recipe.ItemOrExact.Item) || isUsableForCrafting(itemstack))) { // Paper - Improve exact choice recipe ingredients
|
+ if (!itemstack.isEmpty() && item.matches(itemstack) && (!(item instanceof io.papermc.paper.inventory.recipe.ItemOrExact.Item) || isUsableForCrafting(itemstack))) { // Paper - Improve exact choice recipe ingredients
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user