Uploaded image for project: 'Spigot'
  1. Spigot
  2. SPIGOT-5320

FurnceRecipe item duplication

XMLWordPrintable

    • CraftBukkit version git-Bukkit-03b145b (MC: 1.14.4)
    • just the test plugin
    • Yes

      Hopefully I can explain this as best as possible.

      When creating a furnace recipe using ExactChoice, items are able to be duped as they are not being account for their ItemStack properties.

      Here is what I observed:

      I created an ItemStack (a bowl) with custom model data 1, I then created a furnace recipe using this item as an ingredient. The item smelts as it should. If I throw a vanilla bowl into the furnace it will not smelt. The issue lies in clicking in the furnace's recipe book. When I have my custom bowl in the smelting slot (my bowl is named "Water Bowl"), and then I proceed to click the recipe in the book, it will pass regular vanilla bowls into the smelt slot's stack, increasing the stack size, joining in with said custom item, allowing the player to duplicate this item. 

      See video for a better representation of this issue:

      https://youtu.be/66GB0R6orLo

       

      As you can see in the video, I place my "Water Bowl" into the furnace, and as soon as I click the recipe in the recipe book, regular vanilla bowls are added to the custom "Water Bowl" stack. 

       

      Now, I did another video of another issue, I wanted to present it as part of this issue, because I think these two are related.

      Using the same recipe as mention in part 1 of this issue, the recipe book does not recognize that I have said "Water Bowl" in my inventory (when I clearly do), if I click the recipe, it shows me what I should have, even though I have it in my inventory. I can still throw the "Water Bowl" in manually, and it will smelt, but the book doesnt recognize it. 

      If I grab a regular vanilla bowl and put that in my inventory, the recipe is now active, as well as when I click the recipe, it throws the vanilla bowl into the smelting slot of the furnace (even though it won't smelt)

      see video:

      https://youtu.be/hUB-pafE56o

       

      I think the issue here is in NMS code, when clicking the recipe book recipe, it is not checking for this ExactChoice match. 

      Im looking in CB code, in the class PlayerConnection, and I see this method which is what happens when a player clicks the recipe book recipe:

      @Override
      public void a(PacketPlayInAutoRecipe packetplayinautorecipe) {
          PlayerConnectionUtils.ensureMainThread(packetplayinautorecipe, this, this.player.getWorldServer());
          this.player.resetIdleTimer();
          if (!this.player.isSpectator() && this.player.activeContainer.windowId == packetplayinautorecipe.b() && this.player.activeContainer.c(this.player) && this.player.activeContainer instanceof ContainerRecipeBook) {
              this.minecraftServer.getCraftingManager().a(packetplayinautorecipe.c()).ifPresent((irecipe) -> {
                  ((ContainerRecipeBook) this.player.activeContainer).a(packetplayinautorecipe.d(), irecipe, this.player);
              });
          }
      }
      

      my assumption is here is where the ExactChoice recipe ingredient needs to be checked?!?!

       

      I'm including a test plugin so you can test this out and get a better understanding of this issue.

      When the plugin loads, the custom recipe will be registered to the server. (You may need to run the vanilla recipe command to give yourself this recipe)

      /recipe give <yourNameHere> recipetest:hatchet

      A simple run of the command `/test waterbowl` will give you the custom "Water Bowl" item, which you can use to smelt in a furnace.

       

      My test server is currently running CB: 

      CraftBukkit version git-Bukkit-03b145b (MC: 1.14.4) 

      I tested this on Spigot as well, same outcome.

      Im not able to test this in vanilla.

       

      I hope I provided all the information you need to help solve this issue.

      Thank you for reading!

            Unassigned Unassigned
            ShaneBee Shane Bee
            Votes:
            1 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated: