Help with Creating Basic Crafting Table Mod

Post Reply
LIBRELOSTSOUL
New member
Posts: 2
Joined: Sun Apr 09, 2017 05:12

Help with Creating Basic Crafting Table Mod

by LIBRELOSTSOUL » Post

What I want to Do:
I am trying to create a basic Crafting Table; as I miss it from migrating to Minetest from minecraft.

Why Crafting Mod is Not a Good Option for Me:
I tried to simply install the crafting mod from the main page of mods. But, that was horrible. I think that mod must have worked at one point. But, the textures no longer line up correctly at all with modern Minetest. I am running the newest stable Minetest 64 bit from the main download page on Windows 10 64 bit. I want to create a basic table that doesn't do all the extra stuff that this mod does by trying to look like minecraft. I don't want it to look like minecraft. It doesn't need to. I like the black, sleek, cool look of Minetest better.

Why I Care:
Crafting should have locality to it. I'm sure some players prefer to have full crafting capabilities directly in the inventory for reasons of efficiency and constant access. However, I feel that this removes some of the charm that minecraft had. I love the idea that crafting is done at a specific place, just like smelting in the furnace is. It also creates the feeling of advancement granting players new options after creating the table. It also adds a little extra difficulty, in that players can only craft basic things on their own without the table. It makes being away from home feel more like a survival situation when you can't craft swords and stuff at a whim. It just doesn't feel proper without one, to me at least.

What I Want it to Be:
Something simple really. All it has to do is show the current inventory menu we have now with full crafting when the crafting table is right clicked on. Then, regular inventory must be edited to show only a 2 by 2 crafting range instead of the crafting table's 3 by 3 range.

There, that simple, done. No graphic changes, no color changes, no showing the player avatar, nothing fancy like that at all. Doing all of this fancy stuff is what the other crafting mod tried to do. I think that making it too fancy is what made that mod incompatible with future releases of Minetest. I am hoping that by keeping this mod bare bones simple, that it should do the job and stay compatible with future releases of Minetest.

What I've Tried So Far:
I tried editing the Lua Script for the already existing Crafting Mod; to see if I could erase all of the fancy stuff and just pare it down to the basics. This has proved very difficult to do, as I don't know how to code in Lua; or any other programing language for that matter. I succeeded in deleting all the fancy coloring and textures. Yet, the field continues to try to force players to use a 9 space wide area instead of Minetest's traditional 8 space wide area. This was done by the original mod's creator to try to mimic minecraft and I don't know how to get rid of it. The 8 space wide area is fine and I don't want 9 space. Also, the mod is so busted on modern versions of Minetest that it doesn't even mod the standard inventory anymore. So, I have no idea how to do that.

Why This Should Be Simple:
The script in the old mod's init.lua file already shows me how to register the crafting recipe for the table and for how to register the table as a node. It also already shows me how to texture the table with the provided texture files and how to set some other basic stuff about the table. I will show it as fallows.

minetest.register_node("crafting:workbench", {
description = "Workbench",
tiles = {"crafting_workbench_top.png", "default_wood.png", "crafting_workbench_side.png",
"crafting_workbench_side.png", "crafting_workbench_front.png", "crafting_workbench_front.png"},
paramtype2 = "facedir",
paramtype = "light",
groups = {choppy=2,oddly_breakable_by_hand=2,flammable=2},
on_rightclick = function(pos, node, clicker, itemstack)
set_workbench(clicker)
end
})

minetest.register_craft({
output = "crafting:workbench",
recipe = {
{"group:wood", "group:wood"},
{"group:wood", "group:wood"}
}
})

What Am I Missing?:
So, how do I do this? Step One. The Crafting Table. I think that this is the easy step.

I'm assuming that in the field called "on_rightclick = function" I can somehow set it to just simply bring up the current inventory menu as it already is. The menu that comes up with I hit the "I Key" for inventory is already the exact menu that I want to come up when I right click on the crafting table.

I have no idea what any of "(pos, node, clicker, itemstack) set_workbench(clicker)" means. What is pos? Why would I say "node" here? Doesn't Minetest already know it's a node? What is "clicker"? What is "itemstack"? Is "itemstack" the menu I'm looking for? Do I even need it? I know that what I want to happen has to go in between "()" Otherwise, I'm lost entirely.

What line of code does Minetest already use to pull up the Inventory menu when I hit the "I Key"? Can I just copy whatever that line of code is into the "()"? I'm hoping it's that simple. I'm not sure why it wouldn't be.

Step Two: Modified Regular Inventory. I think this will be more tricky.

How do I make the mod make it so that the regular inventory that comes up when I hit the "I Key" have only a 2 by 2 crafting area instead of a 3 by 3 crafting area? My best idea for this is to somehow copy and paste the current code that creates the current inventory 'whatever that code is' and name it something different.

Another option, probably the better option, is to do this backwards from what I just said. That might make more sense. 1: Copy current inventory menu. 2: Change it's name. 3: Leave everything else the same about it. 4: Make the on right click function of the crafting table pull up this new menu I just copy-pasted into existence. 5: Make mod somehow make main current inventory menu to just have a 2 by 2 crafting area, instead of a 3 by 3 crafting area. 6: Leave everything else about the main inventory as it is.

Does anyone have any tips on how I can do this? I think it sounds a lot more difficult than it is. Or, maybe I'm underestimating this. I think getting the table itself to work and pulling up the inventory from the table should be very simple once someone can tell me what the line of code is that the "I Key" uses to pull up an inventory menu. That said, I'm not sure where the inventory menu is stored. Is it its own Lua file, or is it created somehow by a Lua file? Is it in a list in a Lua file? Once I realize how the current inventory is created; making and modifying a duplicate shouldn't be too hard to figure out. How to make the mod modify the current menu might be hard. Maybe I was correct in my original way of thinking of doing this. Where I make the right click function simply pull up the current menu, instead of pulling up the newly created menu. But, still, how do I assign the "I Key" to pull up a different menu from the mod itself? Once somehow tells me how the "I-Key" pulls up the menu and where the menu is stored; modding it on my end alone should be easy. But, that wouldn't help other people who might want to install the mod. They would have to manually open up that file and assign that key press to the different menu themselves, no matter which menu I make the crafting table node pull up; the I key will have to pull up the other menu. So, is there some way to make the mod itself re-assign the menu that the "I Key" opens?

Thank you to everyone that helps. I will be checking back on this to look for replies.

Apology:
Hello, I am new to trying to Mod Minetest and I am unsure if this was where I was supposed to place this. If it is wrong, I am sorry and please move. There seemed to be a pinned place to ask questions. Yet, I was unsure if this question was best placed there or as a new topic. I was afraid it would get buried under other questions and might be difficult for people to find and for me to discern answers. If it is wrong, and I'm supposed to post there, I am sorry.

Nyarg
Member
Posts: 276
Joined: Sun May 15, 2016 04:32

Re: Help with Creating Basic Crafting Table Mod

by Nyarg » Post

LIBRELOSTSOUL wrote:I have no idea what any of "(pos, node, clicker, itemstack) set_workbench(clicker)" means. What is pos? .
http://dev.minetest.net/Category:Methods

for quick search example navigation you may use something
Spoiler
Image
I am a noob. still yet. Not so noob ) [vml] WIP and a little proof for fun PlantedTorch )))
MT Strike 78a36b468554d101e0be3b0d1f587a555f396452 Great! Somebody have found it )
"My english isn't well" I know. I'm sorry )

Byakuren
Member
Posts: 818
Joined: Tue Apr 14, 2015 01:59
GitHub: raymoo
IRC: Hijiri
In-game: Raymoo + Clownpiece

Re: Help with Creating Basic Crafting Table Mod

by Byakuren » Post

The crafting table mechanic in Minecraft never forced locality on me since I always carried around logs anyway, and crafting tables are very cheap to make. If I needed the crafting table while out then I just crafted a crafting table.

More expensive crafting nodes might work better though.
Every time a mod API is left undocumented, a koala dies.

FaceDeer
Member
Posts: 506
Joined: Sat Aug 29, 2015 19:01
GitHub: FaceDeer

Re: Help with Creating Basic Crafting Table Mod

by FaceDeer » Post

Byakuren wrote:The crafting table mechanic in Minecraft never forced locality on me since I always carried around logs anyway, and crafting tables are very cheap to make. If I needed the crafting table while out then I just crafted a crafting table.

More expensive crafting nodes might work better though.
I've been kicking around an idea for a while to revamp Minetest's crafting system using "workshops." Not only would you need a crafting table, you'd also need to have a bunch of other related nodes built nearby. So if you wanted to do metalworking you'd build a forge, and then also build an anvil and a rack of tools and a quenching trough near to it. When you went to use the forge it would check if there were sufficient accessories built nearby.

This goes a bit beyond a *basic* crafting table, mind you. :) But it would certainly help with the locality thing.

Byakuren
Member
Posts: 818
Joined: Tue Apr 14, 2015 01:59
GitHub: raymoo
IRC: Hijiri
In-game: Raymoo + Clownpiece

Re: Help with Creating Basic Crafting Table Mod

by Byakuren » Post

FaceDeer wrote:
Byakuren wrote:The crafting table mechanic in Minecraft never forced locality on me since I always carried around logs anyway, and crafting tables are very cheap to make. If I needed the crafting table while out then I just crafted a crafting table.

More expensive crafting nodes might work better though.
I've been kicking around an idea for a while to revamp Minetest's crafting system using "workshops." Not only would you need a crafting table, you'd also need to have a bunch of other related nodes built nearby. So if you wanted to do metalworking you'd build a forge, and then also build an anvil and a rack of tools and a quenching trough near to it. When you went to use the forge it would check if there were sufficient accessories built nearby.

This goes a bit beyond a *basic* crafting table, mind you. :) But it would certainly help with the locality thing.
It sounds sort of like how CDDA does it, and could be a neat system. But I think it would go better with a more CDDA-like general crafting system, listing what you can make rather than making you memorize or look up grid patterns.
Every time a mod API is left undocumented, a koala dies.

FaceDeer
Member
Posts: 506
Joined: Sat Aug 29, 2015 19:01
GitHub: FaceDeer

Re: Help with Creating Basic Crafting Table Mod

by FaceDeer » Post

Byakuren wrote: It sounds sort of like how CDDA does it, and could be a neat system. But I think it would go better with a more CDDA-like general crafting system, listing what you can make rather than making you memorize or look up grid patterns.
Indeed, I've long thought that the crafting grid approach is suboptimal for a game like Minetest where one is expected to have lots of diverse mods installed, it's too easy to get recipe conflicts. And it limits the recipes, too - you can't have more than 9 components unless you do pre-crafting steps to combine them.

This is drifting a bit far off of the basic crafting table mod being discussed, though. And I'm not sure I'll be getting to the workshop mod next either, I've got other things on my own to-do list first. :)

User avatar
texmex
Member
Posts: 1753
Joined: Mon Jul 11, 2016 21:08
GitHub: tacotexmex
In-game: tacotexmex

Re: Help with Creating Basic Crafting Table Mod

by texmex » Post

Very interesting topic this turned out to be!

For the original poster: There's several crafting table mods available already. Take a look at
workbench or crafting_bench. For overriding the default 3x3 crafting grid I'd suggest you create a mod that takes over the "Crafting" tab as hinted here.

For the on-going discussion I just want to point out that there's a "this is what you can craft"-type of crafting mod available made by qwertymine. Though it is not that polished yet it might serve well as a starting point for that type of crafting system. I'd really like a well developed crafting system like that.

LIBRELOSTSOUL
New member
Posts: 2
Joined: Sun Apr 09, 2017 05:12

Re: Help with Creating Basic Crafting Table Mod

by LIBRELOSTSOUL » Post

texmex wrote:
For the original poster: There's several crafting table mods available already. Take a look at
workbench or crafting_bench. For overriding the default 3x3 crafting grid I'd suggest you create a mod that takes over the "Crafting" tab as hinted here.
I tried to understand the link. But it looked like a lot of people saying that it could be done, but no one really saying how to do it...

The closest to how was. "Sfinv allows mods to override the crafting tab without breaking support for creative" What is Sfinv? I'm assuming that the inv is inventory. What is sf? Set formspec? When looking at the code for other crafting tables, I see a lot about form spec. What is a form spec? I don't really know much about code. Assuming it means form specification. But, that doesn't really tell me how to set/configure one. Only that such a thing exists for those who have such awesome arcane knowledge...

I've tried modding the form spec areas in the init.lua code for other crafting tables and it breaks everything into a horrific mess. So, maybe, there needs to be some way to know how to space things out and just adding or subtracting the height and width of crafting boxes isn't the best hack and slash way to do this.

Also, all the tables I've seen so far seem to be either non-functional or too feature-filled. All I'm really looking to do is copy the functionality from minecraft for rote. Not make it look like minecraft like Blockman's tries. I think that's what causes his to not work anymore, because it's too much 'form spec' modding that doesn't carry over well to the new ui in more updated versions of Minetest. It seems to make such a table would require constant baby sitting of the code which is something he's not seemed to have kept up with.

The one you linked me to even had someone comment on the thread that it's basically a circular saw for people who want to not install more blocks. I already have more blocks.

Here's all I need it to do.

1: Be able to be crated with a 2 x 2 of wood plank group.
2: Bring up the current and functional crafting inventory menu that the "I" key brings up now when I right click on it.
3: Change the inventory menu that exists now to have 2 x 2 crafting spaces.

That's all I want it to do. No more, no less. That's why I want to call it "Simple Work Bench." Because it just does the bare bone basics to bring that feel of minecraft's crafting table to Minetest. I miss it, and want it back. Not with a lot of feature bells and whistles, or graphical overhaul of the entire inventory menu. All I want is the proper crafting spaces in standard inventory, and a proper work bench.

It's really kind of surprising to me that with how many crafting table mods I've seen, I guess 3 or 4 now, none of them just strip the concept down to its most basic 3 step design that it should be.

If I knew anything about code, I would make it. I can already see how to make the block from the crafting and node creation, like I said in my original post.

I just don't know how to make right click pull up a specific menu. And, honestly, there is going to need to be a duplicate menu created, I think. Because, I can't have one part of the mod reference bringing up the crafting menu for the Work Bench and another part of the mod change that same menu into having less spaces. Whenever I figure out, or someone can help me, see how a inventory form spec is created / works; I should be able to copy, paste, and rename one into 'workbench inventory' and link the node to that, while having the mode modify the standard inventory to its new spacing. I think. Again, I don't know. I'm just taking stabs in the dark based upon my past experiences with game maker.

Block creations, texture creation, and recipe creation, are all things I can glean from what I've seen so far. They seem pretty simple and everyone mod I see "crafting or otherwise" uses these to add textured nodes and recipes to the game. The current crafting mod from the main page even has "on right click" as a field to work with. I just need to know how to make and modify form specs so that I can make what I need and link "on right click" to it.

dawgdoc
Member
Posts: 260
Joined: Mon Feb 27, 2017 01:10
GitHub: dawgdoc

Re: Help with Creating Basic Crafting Table Mod

by dawgdoc » Post

Check the rpgtest subgame. It uses a workbench / crafting table that may well meet your requirements.
Give a man a fish, feed him for a day. Give a kid a fish, it's going to die.

Post Reply

Who is online

Users browsing this forum: No registered users and 6 guests