Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Server rejects Transaction while Crafting #1112

Closed
MrKinauJr opened this issue Jul 5, 2020 · 13 comments
Closed

Server rejects Transaction while Crafting #1112

MrKinauJr opened this issue Jul 5, 2020 · 13 comments

Comments

@MrKinauJr
Copy link

MrKinauJr commented Jul 5, 2020

[X] The FAQ doesn't contain a resolution to my issue

Versions

  • mineflayer: 2.22.0
  • server: spigot 1.15.2
  • node: 14.3.0

Detailed description of a problem

The Server rejects the Transaction while crafting a Iron Axe.

Current code

crafting_bench = bot.blockAt(v(-12,60,-151)) // Crafting Bench
iron_axe_recipe = bot.recipesFor(522,null,1,crafting_bench)[0] // First Recipe for a iron_axe
bot.craft(iron_axe_recipe,1,crafting_bench,(err)=>{
    console.log(err)
})

Expected behavior

It should not reject the Transaction and craft the iron axe.

Additional context

I don't know if it's relevant but i get the items from a chest first. That should not interfere with crafting though. I've read through some of the fixed Issues and they all seemed that they got fixed by adding a delay. This sadly did not fix my Problem.

I have provided the Recipe incase it helps debugging.

Recipe {
  result: RecipeItem { id: 522, metadata: undefined, count: 1 },
  inShape: [
    [ [RecipeItem], [RecipeItem] ],
    [ [RecipeItem], [RecipeItem] ],
    [ [RecipeItem], [RecipeItem] ]
  ],
  outShape: null,
  ingredients: null,
  delta: [
    RecipeItem { id: 545, metadata: null, count: -2 },
    RecipeItem { id: 530, metadata: null, count: -3 },
    RecipeItem { id: 522, metadata: undefined, count: 1 }
  ],
  requiresTable: true
}
@rom1504 rom1504 added this to Needs triage in PR Triage Jul 6, 2020
@MrKinauJr
Copy link
Author

MrKinauJr commented Jul 7, 2020

I added some more Craft Functions in my Code.
It does not happen with a Chest but it does happen with a hopper.

Does the craft.js plugin has a delay between putting the items in the slots?
since that fixed some of the problems with a rejected Server transaction in the past.

@Slord6
Copy link

Slord6 commented Jul 7, 2020

I am also experiencing the same problem.

mineflayer: 2.22.1
server: vanilla 1.15.2
node: 12.14.1

It's reproducable with the inventory.js example. I've tried the simplest recipes I can think of; torch, stone pick and oak planks, none of which work. Happens with and without crafting table.

Stack trace:

Error: Server rejected transaction.
    at Bot.<anonymous> (D:\samlo\Documents\mineflayer\node_modules\mineflayer\lib\plugins\inventory.js:550:12)
    at Object.onceWrapper (events.js:300:26)
    at Bot.emit (events.js:210:5)
    at onRejected (D:\samlo\Documents\mineflayer\node_modules\mineflayer\lib\plugins\inventory.js:506:11)
    at confirmTransaction (D:\samlo\Documents\mineflayer\node_modules\mineflayer\lib\plugins\inventory.js:489:7)
    at Client.<anonymous> (D:\samlo\Documents\mineflayer\node_modules\mineflayer\lib\plugins\inventory.js:593:5)
    at Client.emit (events.js:210:5)
    at FullPacketParser.<anonymous> (D:\samlo\Documents\mineflayer\node_modules\minecraft-protocol\src\client.js:88:12)
    at FullPacketParser.emit (events.js:210:5)
    at addChunk (D:\samlo\Documents\mineflayer\node_modules\readable-stream\lib\_stream_readable.js:298:12)

@Slord6
Copy link

Slord6 commented Jul 7, 2020

Just checked in minecraft 1.16.1 with mineflayer version 2.23.0 with the same result

@rom1504
Copy link
Member

rom1504 commented Jul 7, 2020

Can you reproduce with older minecraft versions ?

@Slord6
Copy link

Slord6 commented Jul 7, 2020

Doesn't look like it. 1.12 seems to work as expected, as does 1.14.2

@rom1504
Copy link
Member

rom1504 commented Jul 8, 2020 via email

@Slord6
Copy link

Slord6 commented Jul 9, 2020

I've just re-checked with minecraft version 1.14 specifically checking torches, giving the bot sticks, coal and charcoal and get the same error. So could well be that the issue is older.

@Slord6
Copy link

Slord6 commented Jul 19, 2020

@rom1504 were you able to track down the cause for this?

@rom1504
Copy link
Member

rom1504 commented Jul 19, 2020

No, feel free to work on it

@Slord6
Copy link

Slord6 commented Jul 19, 2020

Bit out of my depth, but had a look. The problem could be that recipes are being put in upside-down, possibly?

If I give the bot iron ingots and ask it to create an iron helmet the server rejects the transaction, but if I then break the crafting table, a minecart pops out. This could also explain why, for example, crafting iron ingots into iron blocks and visa-versa works, but crafting a torch doesn't. Similarly, unshaped crafting like a book works, as does bookshelf, which is the same upside-down as the right way up.

Edit: Testing in 1.16.1
Edit 2: This also explains @MrKinauJr 's earlier comment about hoppers not crafting, but chests crafting fine

Slord6 added a commit to Slord6/MC-Fren that referenced this issue Jul 19, 2020
@Slord6
Copy link

Slord6 commented Jul 19, 2020

I can confirm that's definitely the issue. I don't know where that fix needs to happen though, otherwise I'd put in a PR.

@rom1504
Copy link
Member

rom1504 commented Jul 19, 2020

https://github.com/PrismarineJS/prismarine-recipe and/or https://github.com/PrismarineJS/mineflayer/blob/master/lib/plugins/craft.js

@rom1504
Copy link
Member

rom1504 commented Aug 30, 2020

duplicate of PrismarineJS/minecraft-data#231

@rom1504 rom1504 closed this as completed Aug 30, 2020
PR Triage automation moved this from Needs triage to Closed Aug 30, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
PR Triage
  
Closed
Development

Successfully merging a pull request may close this issue.

3 participants