Page 1 of 1

Adding optional top, bottom, & side tiles to basic blocks

PostPosted: Sat Aug 23, 2014 03:40
by Neuromancer
One of the things I noticed is that Minecraft has a lot of basic blocks that also have tops and side textures/tiles. This may seem like a subtle difference, but it allows for much more variety in things that are getting built, and buildings just look better. I would like to create a mod that could replace the default mod in minetest_game, and would allow _top, _bottom, and _side textures to be used if they are found in a texture pack, otherwise just use the one texture file that is in the texture pack on all sides so that this mod would be compatible with all texture packs, even if they don't have the _side, _top, and _bottom texture files. Is there an easy way to do this?
Here's the typical line you would see in a register node:
tiles = {"default_furnace_top.png", "default_furnace_bottom.png", "default_furnace_side.png",
"default_furnace_side.png", "default_furnace_side.png", "default_furnace_front.png"},
How do I make these optional?

Re: Adding optional top, bottom, & side tiles to basic block

PostPosted: Sat Aug 23, 2014 05:43
by rubenwardy
Easy to do this server side, but for client side you would just need to have each side a different texture. You would have redundant textures.

A better way is a new feature. Add a file in the texture pack called overrides.txt which is in the format:

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
modname:itemname:top = modname_itemname_top.png


On server side, it is quite easy, but it only supports server side texture packs. Make a function like auto_texture(mod, item)

Use io in that file to find the texture pack directory, and to see if the files exist. Or use the mod's textures as fallback.

Re: Adding optional top, bottom, & side tiles to basic block

PostPosted: Sat Aug 23, 2014 21:38
by Neuromancer
rubenwardy wrote:
A better way is a new feature. Add a file in the texture pack called overrides.txt which is in the format:
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
modname:itemname:top = modname_itemname_top.PNG


Thanks for the idea. How new is this feature? I followed these instructions exactly using minetest-0.4.10-dev-win64-e69d660784 and putting an overrides.txt file in my texture folder with the content
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
default:sandstone:top = default_sandstone_top.PNG

But it just ignores it, and leaves the top the same as the sides. I don't have any sub-folders in my textures folder. It's just 1 folder for my texture pack in the textures folder with the file and texture.png files in there.

Re: Adding optional top, bottom, & side tiles to basic block

PostPosted: Sun Aug 24, 2014 14:48
by rubenwardy
A new feature as in it doesn't exist. Adding a new feature.

Re: Adding optional top, bottom, & side tiles to basic block

PostPosted: Tue Aug 26, 2014 00:17
by Neuromancer
rubenwardy wrote:A new feature as in it doesn't exist. Adding a new feature.

An overrides.txt file in the texturepack folder would be the perfect way to implement it. How close is this feature to being implemented? Is it a great idea of yours that needs to be championed, or has it already been implemented but will be put into a future release sometime soon?

Re: Adding optional top, bottom, & side tiles to basic block

PostPosted: Tue Aug 26, 2014 16:44
by rubenwardy
It is an idea of mine.

See IRC chat about it

Re: Adding optional top, bottom, & side tiles to basic block

PostPosted: Wed Aug 27, 2014 02:35
by Neuromancer
Is there a way to do this now from a texture pack, with extra textures? For example if I wanted a top and a bottom on default_sandstone, do I need to create a default_sandstone_top, default_sandstone_bottom, default_sandstone_side, default_sandstone_front, default_sandstone_back? Or do I need a left and right instead of side? Or is this impossible client side in a texture pack? Do I need to create a mod instead?