[Mod] ResourcePacker - Resource Pack User

User avatar
Neuromancer
Member
 
Posts: 793
Joined: Tue Jun 12, 2012 22:28
GitHub: Neuromancer56

[Mod] ResourcePacker - Resource Pack User

by Neuromancer » Fri Sep 19, 2014 09:09

[Edit]
This Mod allows you to use any MC resource packs in Minetest. It will evolve in the following phases:
1) Lua: rename as many of the textures to work with Minetest_game as possible using the resource pack textures.
2) Lua: create all the missing blocks/nodes that exist in typical resource packs but haven't been implemented in Minetest_game
3) Lua: rename standard textures in resource pack to override nodes in minetest mods (e.g. Quartz, Netherrack, etc.) if they are loaded, else register new nodes.
4) Lua: If the Resource pack is missing a texture we expect, do not create the node.

We are currently in the process of implementing phase one. Obviously there is a long way to go, and we can use all the help we can get. If you would like to help out, please check out our Github below and ask for pull requests or to be added to the project.

Github:https://github.com/Neuromancer56/ResourcePacker/
Usage:
*Install the resourcepacker mod like any other Minetest mod.
*Copy the contents of the assets\minecraft\textures\blocks folder into the resourcePacker's textures folder.
*Configure a world with the resourcePacker modpack.
*Click Play and Type "/rpren" in game
*exit game and go back in.
*You should now see whatever textures we have programmed to rename



Original concept message:
I'm kicking around an idea for a mod, and I'd like some thoughts on it. The idea would be you copy the folders from a MC resource pack into it. It then searches through those folders for resources (textures primarily) and if it finds them, it would override existing Minetest game and other active mod nodes/blocks with new blocks that use the resource packs textures, or if the node doesn't exist in Minetest game, it creates that node/block type. That way you'd basically have access to all the textures and nodes available in the resource pack.

I have a couple concerns, for nodes that are generated as part of the other mods or the game itself, I would want them to be generated as usual, just using the new textures, and I'm thinking that by overriding the mod's node (but not the logic for generating it ) that the new node would not be generated anymore.

What do you all think?
Last edited by Neuromancer on Thu Sep 25, 2014 01:42, edited 8 times in total.
 

User avatar
rubenwardy
Member
 
Posts: 4500
Joined: Tue Jun 12, 2012 18:11
GitHub: rubenwardy
IRC: rubenwardy
In-game: rubenwardy

Re: [Mod Concept] Resource Pack User

by rubenwardy » Fri Sep 19, 2014 09:57

For the benefit of others, here is a website with resource packs: http://www.resource-packs.com
Last edited by rubenwardy on Fri Sep 19, 2014 10:03, edited 1 time in total.
 

User avatar
rubenwardy
Member
 
Posts: 4500
Joined: Tue Jun 12, 2012 18:11
GitHub: rubenwardy
IRC: rubenwardy
In-game: rubenwardy

Re: [Mod Concept] Resource Pack User

by rubenwardy » Fri Sep 19, 2014 10:02

It would be rather slow to convert at load time of minetest. I suggest a python script that converts it to a Lua mod.
 

User avatar
Neuromancer
Member
 
Posts: 793
Joined: Tue Jun 12, 2012 22:28
GitHub: Neuromancer56

Re: [Mod Concept] Resource Pack User

by Neuromancer » Sat Sep 20, 2014 01:16

This is totally doable thanks to a little code I found from cornernote.

https://gist.github.com/cornernote/3815683

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
-- function
clone_registered = function(case,name)
   local params = {}
   local list
   if case == "item" then list = minetest.registered_items end
   if case == "node" then list = minetest.registered_nodes end
   if case == "craftitem" then list = minetest.registered_craftitems end
   if case == "tool" then list = minetest.registered_tools end
   if case == "entity" then list = minetest.registered_entities end
   if list then
      for k,v in pairs(list[name]) do
         params[k] = v
      end
   end
   return params
end
 
-- usage
local node = clone_registered("node","default:stone")
node.tiles = {"default_stoneTEST.png"}
minetest.register_node(":default:stone",  node)

This will allow the overriding of tiles/textures.

I like the idea of processing everything in advance to speed the load times, but unfortunately I don't know python. If I write something like that unfortunately it will be in C#. Hey with Mono at least it's cross platform.
 

User avatar
rubenwardy
Member
 
Posts: 4500
Joined: Tue Jun 12, 2012 18:11
GitHub: rubenwardy
IRC: rubenwardy
In-game: rubenwardy

Re: [Mod Concept] Resource Pack User

by rubenwardy » Sat Sep 20, 2014 08:53

Or you could use Minetest.override_item
 

User avatar
Neuromancer
Member
 
Posts: 793
Joined: Tue Jun 12, 2012 22:28
GitHub: Neuromancer56

Re: [Mod Concept] Resource Pack User

by Neuromancer » Sun Sep 21, 2014 14:36

rubenwardy wrote:Or you could use Minetest.override_item
Much better. Thanks for suggesting it.

I have put the project so far on GitHub. See the edited original post for ideas for phases of implementation. I think by starting out simply with Lua overrides we will get the most bang for the buck early on in the project. Looking for contributers to this project. There are a lot of textures to override, and some nodeboxes to be created.
 

User avatar
Evergreen
Member
 
Posts: 2131
Joined: Sun Jan 06, 2013 01:22
GitHub: 4Evergreen4
IRC: EvergreenTree
In-game: Evergreen

Re: [Mod] ResourcePacker - Resource Pack User

by Evergreen » Sun Sep 21, 2014 16:50

This will be absolutely amazing once it's finished! I would love to contribute to this.
"Help! I searched for a mod but I couldn't find it!"
http://krock-works.16mb.com/MTstuff/modSearch.php
 

User avatar
Neuromancer
Member
 
Posts: 793
Joined: Tue Jun 12, 2012 22:28
GitHub: Neuromancer56

Re: [Mod] ResourcePacker - Resource Pack User

by Neuromancer » Sun Sep 21, 2014 18:36

Evergreen wrote:This will be absolutely amazing once it's finished! I would love to contribute to this.

Awesome! I added you as a contributor to the GitHub.
 

User avatar
Evergreen
Member
 
Posts: 2131
Joined: Sun Jan 06, 2013 01:22
GitHub: 4Evergreen4
IRC: EvergreenTree
In-game: Evergreen

Re: [Mod] ResourcePacker - Resource Pack User

by Evergreen » Sun Sep 21, 2014 20:00

Neuromancer wrote:
Evergreen wrote:This will be absolutely amazing once it's finished! I would love to contribute to this.

Awesome! I added you as a contributor to the GitHub.

You should make a roadmap as to what needs to be worked on. I can't contribute unless I know what needs to be contributed.
"Help! I searched for a mod but I couldn't find it!"
http://krock-works.16mb.com/MTstuff/modSearch.php
 

User avatar
Neuromancer
Member
 
Posts: 793
Joined: Tue Jun 12, 2012 22:28
GitHub: Neuromancer56

Re: [Mod] ResourcePacker - Resource Pack User

by Neuromancer » Sun Sep 21, 2014 20:49

Evergreen wrote: You should make a roadmap as to what needs to be worked on. I can't contribute unless I know what needs to be contributed.

I'm working through adding support for the *.png files for existing blocks in minetest_game in a resource pack working from A-Z. You could start at the Z's and work your way back until we meet.
Or you could work on registering standard cube blocks that don't exist in minetest game, or even working on nodeboxes for things like cake or cauldron's that don't exist in minetest game and aren't simple blocks, and register them. Whatever you find most interesting. Just let me know. Again it might be best if you work your way backwards from Z. Then just check in to github like me after you have finished each batch of nodes.
 

User avatar
rubenwardy
Member
 
Posts: 4500
Joined: Tue Jun 12, 2012 18:11
GitHub: rubenwardy
IRC: rubenwardy
In-game: rubenwardy

Re: [Mod] ResourcePacker - Resource Pack User

by rubenwardy » Sun Sep 21, 2014 21:34

I thought this was going to be an automatic process. Reading the models and textures and names from the resource pack.
 

User avatar
Neuromancer
Member
 
Posts: 793
Joined: Tue Jun 12, 2012 22:28
GitHub: Neuromancer56

Re: [Mod] ResourcePacker - Resource Pack User

by Neuromancer » Mon Sep 22, 2014 01:21

rubenwardy wrote:I thought this was going to be an automatic process. Reading the models and textures and names from the resource pack.

But something would need to map the resource pack .png files to the minetest_game nodes. I don't have a problem with it being lua doing that. At some point, Python or C# could loop through the files and look for which files exist, but for now, I don't have a problem with hardcoding the mappings in lua.
 

User avatar
Neuromancer
Member
 
Posts: 793
Joined: Tue Jun 12, 2012 22:28
GitHub: Neuromancer56

Re: [Mod] ResourcePacker - Resource Pack User

by Neuromancer » Mon Sep 22, 2014 02:13

@rubenwardy:
An automated check for the file's existence works fast in lua and the code is much cleaner. Thanks for calling me out on that.

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
function file_exists(name)
   local f=io.open(name,"r")
   if f~=nil then io.close(f) return true else return false end
end
function mod_path()
   local dir = minetest.get_modpath(minetest.get_current_modname())
   return dir
end

function map_resource(node, file)
   if file_exists(mod_path().."\\textures\\"..file) then
      minetest.override_item(node, {
   tiles = {file},
   })
   end
end

map_resource( "default:brick", "brick.png")
map_resource( "stairs:stair_brick", "brick.png")
 

User avatar
Evergreen
Member
 
Posts: 2131
Joined: Sun Jan 06, 2013 01:22
GitHub: 4Evergreen4
IRC: EvergreenTree
In-game: Evergreen

Re: [Mod] ResourcePacker - Resource Pack User

by Evergreen » Mon Sep 22, 2014 11:56

Neuromancer wrote:
Evergreen wrote: You should make a roadmap as to what needs to be worked on. I can't contribute unless I know what needs to be contributed.

I'm working through adding support for the *.png files for existing blocks in minetest_game in a resource pack working from A-Z. You could start at the Z's and work your way back until we meet.
Or you could work on registering standard cube blocks that don't exist in minetest game, or even working on nodeboxes for things like cake or cauldron's that don't exist in minetest game and aren't simple blocks, and register them. Whatever you find most interesting. Just let me know. Again it might be best if you work your way backwards from Z. Then just check in to github like me after you have finished each batch of nodes.

I'm not really familiar with the structure of a minetest resource pack directory, so I don't have a clear idea of what the minecraft texture names are. EDIT: I really could just download one to see what the structure looks like. :P
"Help! I searched for a mod but I couldn't find it!"
http://krock-works.16mb.com/MTstuff/modSearch.php
 

User avatar
Neuromancer
Member
 
Posts: 793
Joined: Tue Jun 12, 2012 22:28
GitHub: Neuromancer56

Re: [Mod] ResourcePacker - Resource Pack User

by Neuromancer » Mon Sep 22, 2014 12:10

Evergreen wrote:I'm not really familiar with the structure of a minetest resource pack directory, so I don't have a clear idea of what the minecraft texture names are. EDIT: I really could just download one to see what the structure looks like. :P

I've been thinking about this a bit, and I think we are going to have to go a different route. In order to make sure all the other Mods are loaded already, I think the only way to deal with that is to register and use new commands. Thus in game the user would type "/rpren resourcepackname". This would rename all the resource pack .png files to standard Minetest filenames. That command would only have to be run once per pack. Then I think the user would have to exit to menu and then type "/rpget resourcepackname" to take all the .png files in the now texture pack directory and compare them with nodes from loaded mods and create the nodes that exist in the resource pack .png files, but haven't been created by loaded mods.
 

User avatar
Neuromancer
Member
 
Posts: 793
Joined: Tue Jun 12, 2012 22:28
GitHub: Neuromancer56

Re: [Mod] ResourcePacker - Resource Pack User

by Neuromancer » Mon Sep 22, 2014 12:12

The reason I say we should rename the .png files is that other mods use the standard Minetest filenames for textures. For example, Columnia mod looks for the "brick.png" and a bunch of other .png files. A lot of other mods do this as well.
 

User avatar
Neuromancer
Member
 
Posts: 793
Joined: Tue Jun 12, 2012 22:28
GitHub: Neuromancer56

Re: [Mod] ResourcePacker - Resource Pack User

by Neuromancer » Thu Sep 25, 2014 01:18

@Evergreen: Thanks for adding the commands file. I got the rename command working. Now we just need to pound through all the files. I'll be working from a-z. You can work on whatever you want.
 

User avatar
Evergreen
Member
 
Posts: 2131
Joined: Sun Jan 06, 2013 01:22
GitHub: 4Evergreen4
IRC: EvergreenTree
In-game: Evergreen

Re: [Mod] ResourcePacker - Resource Pack User

by Evergreen » Thu Sep 25, 2014 12:01

I can see a potential issue with some tesxtures though, like the cactus texture. To make it fit properly, you would need to use some sort of automatic growing/shrinking tool to make it fit the current cactus model.
"Help! I searched for a mod but I couldn't find it!"
http://krock-works.16mb.com/MTstuff/modSearch.php
 

User avatar
Neuromancer
Member
 
Posts: 793
Joined: Tue Jun 12, 2012 22:28
GitHub: Neuromancer56

Re: [Mod] ResourcePacker - Resource Pack User

by Neuromancer » Fri Sep 26, 2014 00:54

Evergreen wrote:I can see a potential issue with some tesxtures though, like the cactus texture. To make it fit properly, you would need to use some sort of automatic growing/shrinking tool to make it fit the current cactus model.

It might be easier to come up with a nodebox for cactus and override the existing cacti. But yes there will be some nodes that will be tricky and cactus was one I was concerned about because a MC cactus texture has spike pixels that stick out past the edge and it is a 14x14x 16 pixel nodebox.
 


Return to WIP Mods

Who is online

Users browsing this forum: No registered users and 6 guests

cron