Custom Crafting

User avatar
Don
Member
 
Posts: 1641
Joined: Sat May 17, 2014 18:40
GitHub: DonBatman
IRC: Batman
In-game: Batman

Custom Crafting

by Don » Wed Nov 19, 2014 17:07

I am wanting to make a machine that has a custom crafting definition. I am not sure how to do this. I found the mod Crafter but it has not been updated in over 2 years.
Can someone point me to information and/or a mod that I could go by to do this?

I want a simple 2x2 crafting table with type=splice
Image
Many of my mods are now a part of Minetest-mods. A place where you know they are maintained!

A list of my mods can be found here
 

4aiman
Member
 
Posts: 1208
Joined: Mon Jul 30, 2012 05:47

Re: Custom Crafting

by 4aiman » Sat Nov 22, 2014 11:52

Would this do: viewtopic.php?id=3546 ?
 

User avatar
Don
Member
 
Posts: 1641
Joined: Sat May 17, 2014 18:40
GitHub: DonBatman
IRC: Batman
In-game: Batman

Re: Custom Crafting

by Don » Sat Nov 22, 2014 13:29

4aiman wrote:Would this do: viewtopic.php?id=3546 ?

That uses the crafter mod. Both crafter and smelting are made by MasterGollum. The mods are both "work in progress" and have not been updated in a couple years. I was hoping to find something that is newer.
But thanks for trying. I was really hoping that there might be documentation that I missed.
Many of my mods are now a part of Minetest-mods. A place where you know they are maintained!

A list of my mods can be found here
 

User avatar
LionsDen
Member
 
Posts: 525
Joined: Thu Jun 06, 2013 03:19

Re: Custom Crafting

by LionsDen » Sat Nov 22, 2014 22:00

Technic has the alloy furnace. That might be what you are looking for and the mod is still being worked on.

viewtopic.php?id=2538
 

User avatar
Napiophelios
Member
 
Posts: 752
Joined: Mon Jul 07, 2014 01:14
GitHub: Napiophelios
IRC: Nappi
In-game: Nappi

Re: Custom Crafting

by Napiophelios » Sat Nov 22, 2014 22:46

Ran across this on github,
I dont know if it works or not
I havent tried it.

https://github.com/SmallJoker/custom_crafts

Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
-- Incompatible with MasterGollum's crafter mod

crafter = {}
local all_recipe_types = {}
local all_recipes = {}

function crafter.register_craft_type(name)
   table.insert(all_recipe_types, name)
end

function crafter.register_craft(def)
   if not def then
      return
   end
   local typ = def.type
   if not (def.output and def.recipe and typ) then
      return
   end
   
   if type(def.recipe) == "string" then
      def.recipe = { def.recipe }
   end
   
   local recipe = {}
   for i, v in ipairs(def.recipe) do
      local stack = ItemStack(v)
      local name = stack:get_name()
      local count = stack:get_count()
      
      if not recipe[name] then
         recipe[name] = count
      else
         recipe[name] = recipe[name] + count
      end
   end
   
   if not all_recipes[typ] then
      all_recipes[typ] = {}
   end
   
   table.insert(all_recipes[typ], { def.output, def.recipe })
end

function crafter.get_craft_result(typ, list)
   if not (typ and list) then
      return
   end
   
   --todo
end

minetest.after(5, function()
   local test = minetest.get_inventory({type="player", name="singleplayer"})
   if test then
      test:set_stack("main", 10, "default:torch")
   else
      print("error")
   end
end)

crafter.register_craft_type("12test")
crafter.register_craft({
   type = "12test",
   output = "default:stick",
   recipe = { "default:stick" }
})
 

User avatar
Don
Member
 
Posts: 1641
Joined: Sat May 17, 2014 18:40
GitHub: DonBatman
IRC: Batman
In-game: Batman

Re: Custom Crafting

by Don » Sat Nov 22, 2014 23:34

Napiophelios wrote:Ran across this on github,
I dont know if it works or not
I havent tried it.

https://github.com/SmallJoker/custom_crafts

Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
-- Incompatible with MasterGollum's crafter mod

crafter = {}
local all_recipe_types = {}
local all_recipes = {}

function crafter.register_craft_type(name)
   table.insert(all_recipe_types, name)
end

function crafter.register_craft(def)
   if not def then
      return
   end
   local typ = def.type
   if not (def.output and def.recipe and typ) then
      return
   end
   
   if type(def.recipe) == "string" then
      def.recipe = { def.recipe }
   end
   
   local recipe = {}
   for i, v in ipairs(def.recipe) do
      local stack = ItemStack(v)
      local name = stack:get_name()
      local count = stack:get_count()
      
      if not recipe[name] then
         recipe[name] = count
      else
         recipe[name] = recipe[name] + count
      end
   end
   
   if not all_recipes[typ] then
      all_recipes[typ] = {}
   end
   
   table.insert(all_recipes[typ], { def.output, def.recipe })
end

function crafter.get_craft_result(typ, list)
   if not (typ and list) then
      return
   end
   
   --todo
end

minetest.after(5, function()
   local test = minetest.get_inventory({type="player", name="singleplayer"})
   if test then
      test:set_stack("main", 10, "default:torch")
   else
      print("error")
   end
end)

crafter.register_craft_type("12test")
crafter.register_craft({
   type = "12test",
   output = "default:stick",
   recipe = { "default:stick" }
})

That's what I needed. Thank you!
Many of my mods are now a part of Minetest-mods. A place where you know they are maintained!

A list of my mods can be found here
 

User avatar
Don
Member
 
Posts: 1641
Joined: Sat May 17, 2014 18:40
GitHub: DonBatman
IRC: Batman
In-game: Batman

Re: Custom Crafting

by Don » Sat Nov 22, 2014 23:36

LionsDen wrote:Technic has the alloy furnace. That might be what you are looking for and the mod is still being worked on.

viewtopic.php?id=2538

As a newb I get lost really easy in technics code.
Many of my mods are now a part of Minetest-mods. A place where you know they are maintained!

A list of my mods can be found here
 


Return to Modding Discussion

Who is online

Users browsing this forum: No registered users and 2 guests

cron