Giter Site home page Giter Site logo

Comments (4)

FaceDeer avatar FaceDeer commented on June 3, 2024

It appears in the unified_inventory's crafting guide, but I can confirm it's not appearing in my version of the crafting table mod for me either.

I don't see anything unusual just looking at the code for the crafting recipe or node definition, I'll need to do some more in-depth debugging when I get home. May be a few hours.

Which craft guide is it also not appearing in, this one? Given that it appears in the unified_inventory craft guide but not the crafting table I bet there's some weird trick to reading craft recipes that I've overlooked, if nothing else I should be able to compare how they're doing it and find out what's different.

from hopper.

FaceDeer avatar FaceDeer commented on June 3, 2024

Okay, got home and I figured it out. The problem is due to a quirk of Lua, and the bug lies in the crafting table (and the crafting guide) rather than in hopper.

The default minetest crafting recipe format records the three-by-three crafting grid as a linear array of nine entries, laid out like so:

1 2 3
4 5 6
7 8 9

which in Lua terms is {[1] = "item1", [2] = "item2", [3] = "item3"} and so forth.

The problem is that Lua assumes an array has members in every slot. So if there's a Lua array that goes:

{[1] = "item1", [2] = "item2", [3] = nil, [4] = "item3"}

and you ask Lua how long that array is, it will say it is only two entries long. It reads index 1, then index 2, then sees that index 3 is empty and assumes that's the end.

The recipe for the hopper sorter is:

"" "mese crystal" ""
"steel" "chest" "steel"
"" "steel" ""

As you can see, this would translate into an array with entry [1] having nil in it. So ask Lua how long that array is and it'll think it's an empty array. There was a check in the crafting system code that was seeing a recipe with no inputs and was throwing that away as invalid. This means that any recipe out there that has nothing in the upper left corner was being missed by the crafting table.

So, I can fix this in the crafting system easily enough, I'll have that checked in shortly (I'm going to take a few minutes hunting for further instances where this might come up). The crafting guide that you've found with this problem is a separate issue, it's probably got a similar bug in its code.

from hopper.

FaceDeer avatar FaceDeer commented on June 3, 2024

Fix is in for the crafting table with this commit.

from hopper.

tacotexmex avatar tacotexmex commented on June 3, 2024

Huh, interesting bug! Just assumed the problem lied in how the specific crafting recipe of the sorter hopper was constructed, because that's what have been the issue with disappearing craft guide recipes in the past in my experience. I'm glad it could be traced back to the other mods. Thank you for also explaining why the bug occured as I learnt something new.

from hopper.

Related Issues (16)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.