[ModPack] Cool Trees [cool_trees] (z3)

ThorfinnS
Member
Posts: 311
Joined: Mon Feb 25, 2019 22:05
GitHub: ThorfinnS

Re: [ModPack] Cool Trees [cool_trees] (v3.2)

by ThorfinnS » Post

Don't know how we missed this for so long, but did you mean for slabs to be made from logs rather than planks as is the case with the default trees?

Oh, and birch may have no slab at all defined.

trainwrecktony
Member
Posts: 67
Joined: Sun Jun 08, 2014 05:24
In-game: trainwrecktony
Location: NJ USA

Re: [ModPack] Cool Trees [cool_trees] (v3.2)

by trainwrecktony » Post

not a programer but good at debuging so alot of the code on my server is hacky. i believe the registered node namespace conflicts with default:wood

what i did on my server to enable this with both moreblocks and stairs(redo)
add alias to end of whatever trees\init.lua
example cherrytrees\init.lua add
minetest.register_alias("cherrytree:cherrywood", "cherrytree:wood")
comment out the stairs code
--[[Stairs

if minetest.get_modpath("stairs") ~= nil then
stairs.register_stair_and_slab(
"cherrytree_wood",
"cherrytree:wood",
{choppy = 2, oddly_breakable_by_hand = 2, flammable = 2},
{"cherrytree_wood.png"},
S("Cherry Tree Stair"),
S("Cherry Tree Slab"),
default.node_sound_wood_defaults()
)
end--]]

EXTRA if using pkarcs mod also add
if minetest.get_modpath("pkarcs") then pkarcs.register_node("cherrytree:cherrywood") end

for moreblocks edit the stairsplus\registrations.lua add example
stairsplus:register_all("moreblocks", "cherrywood", "cherrytree:wood", {
description = "Cherry Tree Wood",
tiles = {"cherrytree_wood.png"},
groups = {oddly_breakabe_by_hand=1},
sounds = default.node_sound_wood_defaults(),
})

for stairs(redo) edit init.lua
if minetest.get_modpath("cherrytree") then

stairs.register_all("cherrytree_wood", "cherrytree:wood",
{choppy=2,oddly_breakable_by_hand=2,flammable=3},
{"cherrytree_wood.png"},
"Cherry Wood",
stairs.wood)

end

i've added fences too heres my sample from cherrytrees

Code: Select all

local cherrytree = {}

function cherrytree.register_fence(name, def)
	minetest.register_craft({
		output = name .. " 4",
		recipe = {
			{ def.material, 'group:stick', def.material },
			{ def.material, 'group:stick', def.material },
		}
	})

	local fence_texture = "default_fence_overlay.png^" .. def.texture ..
			"^default_fence_overlay.png^[makealpha:255,126,126"
	-- Allow almost everything to be overridden
	local cherrytree_fields = {
		paramtype = "light",
		drawtype = "nodebox",
		node_box = {
			type = "connected",
			fixed = {{-1/8, -1/2, -1/8, 1/8, 1/2, 1/8}},
			-- connect_top =
			-- connect_bottom =
			connect_front = {{-1/16,3/16,-1/2,1/16,5/16,-1/8},
				{-1/16,-5/16,-1/2,1/16,-3/16,-1/8}},
			connect_left = {{-1/2,3/16,-1/16,-1/8,5/16,1/16},
				{-1/2,-5/16,-1/16,-1/8,-3/16,1/16}},
			connect_back = {{-1/16,3/16,1/8,1/16,5/16,1/2},
				{-1/16,-5/16,1/8,1/16,-3/16,1/2}},
			connect_right = {{1/8,3/16,-1/16,1/2,5/16,1/16},
				{1/8,-5/16,-1/16,1/2,-3/16,1/16}},
		},
		connects_to = {"group:fence", "group:wood", "group:tree", "group:wall"},
		inventory_image = fence_texture,
		wield_image = fence_texture,
		tiles = {def.texture},
		sunlight_propagates = true,
		stack_max = 1000,
		is_ground_content = false,
		groups = {},
	}
	for k, v in pairs(cherrytree_fields) do
		if not def[k] then
			def[k] = v
		end
	end

	-- Always add to the fence group, even if no group provided
	def.groups.fence = 1

	def.texture = nil
	def.material = nil

	minetest.register_node(name, def)
end

--
-- Fence rail registration helper
--

function cherrytree.register_fence_rail(name, def)
	minetest.register_craft({
		output = name .. " 16",
		recipe = {
			{ def.material, def.material },
			{ "", ""},
			{ def.material, def.material },
		}
	})

	local fence_rail_texture = "default_fence_rail_overlay.png^" .. def.texture ..
	     	"^default_fence_rail_overlay.png^[makealpha:255,126,126"
	-- Allow almost everything to be overridden
	local cherrytree_fields = {
		paramtype = "light",
		drawtype = "nodebox",
		node_box = {
			type = "connected",
			fixed = {
				{-1/16,  3/16, -1/16, 1/16,  5/16, 1/16},
				{-1/16, -3/16, -1/16, 1/16, -5/16, 1/16}
			},
			-- connect_top =
			-- connect_bottom =
			connect_front = {
				{-1/16,  3/16, -1/2, 1/16,  5/16, -1/16},
				{-1/16, -5/16, -1/2, 1/16, -3/16, -1/16}},
			connect_left = {
				{-1/2,  3/16, -1/16, -1/16,  5/16, 1/16},
				{-1/2, -5/16, -1/16, -1/16, -3/16, 1/16}},
			connect_back = {
				{-1/16,  3/16, 1/16, 1/16,  5/16, 1/2},
				{-1/16, -5/16, 1/16, 1/16, -3/16, 1/2}},
			connect_right = {
				{1/16,  3/16, -1/16, 1/2,  5/16, 1/16},
				{1/16, -5/16, -1/16, 1/2, -3/16, 1/16}},
		},
		connects_to = {"group:fence", "group:wood", "group:tree", "group:wall"},
		inventory_image = fence_rail_texture,
		wield_image = fence_rail_texture,
		tiles = {def.texture},
		sunlight_propagates = true,
		is_ground_content = false,
		stack_max = 1000,
		groups = {},
	}
	for k, v in pairs(cherrytree_fields) do
		if def[k] == nil then
			def[k] = v
		end
	end

	-- Always add to the fence group, even if no group provided
	def.groups.fence = 1

	def.texture = nil
	def.material = nil

	minetest.register_node(name, def)
end

cherrytree.register_fence("cherrytree:fence_cherry_wood", {
	description = "Cherry Wood Fence",
	texture = "cherrytree_wood.png",
	inventory_image = "default_fence_overlay.png^cherrytree_wood.png^" ..
				"default_fence_overlay.png^[makealpha:255,126,126",
	wield_image = "default_fence_overlay.png^cherrytree_wood.png^" ..
				"default_fence_overlay.png^[makealpha:255,126,126",
	material = "cherrytree:wood",
	groups = {choppy = 2, oddly_breakable_by_hand = 2, flammable = 2},
	sounds = default.node_sound_wood_defaults()
})

cherrytree.register_fence_rail("cherrytree:fence_rail_cherry_wood", {
	description = "Cherry Wood Fence Rail",
	texture = "cherrytree_wood.png",
	inventory_image = "default_fence_rail_overlay.png^cherrytree_wood.png^" ..
				"default_fence_rail_overlay.png^[makealpha:255,126,126",
	wield_image = "default_fence_rail_overlay.png^cherrytree_wood.png^" ..
				"default_fence_rail_overlay.png^[makealpha:255,126,126",
	material = "cherrytree:wood",
	groups = {choppy = 2, oddly_breakable_by_hand = 2, flammable = 2},
	sounds = default.node_sound_wood_defaults()
})

cherrytree.register_fence("cherrytree:fence__cherrytree", {
	description = "Cherry Tree Fence",
	texture = "cherrytree_trunk.png",
	inventory_image = "default_fence_overlay.png^cherrytree_trunk.png^" ..
				"default_fence_overlay.png^[makealpha:255,126,126",
	wield_image = "default_fence_overlay.png^cherrytreetrunk.png^" ..
				"default_fence_overlay.png^[makealpha:255,126,126",
	material = "cherrytree:trunk",
	groups = {choppy = 2, oddly_breakable_by_hand = 2, flammable = 2},
	sounds = default.node_sound_wood_defaults()
})

cherrytree.register_fence_rail("cherrytree:fence_rail_cherrytree", {
	description = "Cherry Tree Fence Rail",
	texture = "cherrytree_trunk.png",
	inventory_image = "default_fence_rail_overlay.png^cherrytree_trunk.png^" ..
				"default_fence_rail_overlay.png^[makealpha:255,126,126",
	wield_image = "default_fence_rail_overlay.png^cherrytree_trunk.png^" ..
				"default_fence_rail_overlay.png^[makealpha:255,126,126",
	material = "cherrytree:trunk",
	groups = {choppy = 2, oddly_breakable_by_hand = 2, flammable = 2},
	sounds = default.node_sound_wood_defaults()
})
Last edited by trainwrecktony on Fri Jul 26, 2019 04:00, edited 1 time in total.
Server Owner trainwrecktony.serveminecraft.net:30000 irc.freenode.net ##minetest-trainwrecktony

User avatar
runs
Member
Posts: 3225
Joined: Sat Oct 27, 2018 08:32

Re: [ModPack] Cool Trees [cool_trees] (v3.2)

by runs » Post

ThorfinnS wrote:Don't know how we missed this for so long, but did you mean for slabs to be made from logs rather than planks as is the case with the default trees?

Oh, and birch may have no slab at all defined.
Yes, I have to improve it. :-)

ThorfinnS
Member
Posts: 311
Joined: Mon Feb 25, 2019 22:05
GitHub: ThorfinnS

Re: [ModPack] Cool Trees [cool_trees] (v3.2)

by ThorfinnS » Post

Does that handle internationalization, trainwrecktony? If so, that's an elegant answer.

In this case, each of the init.lua files needs one tiny tweak.For chestnut, for instance, at line 223 is

Code: Select all

		"chestnuttree:trunk",
but if you replace it with

Code: Select all

		"chestnuttree:wood",
things work as expected.

Nice fence registration. Would be nice to have that in a lightweight utility mod so you aren't required to use cherrytree just to access the function.

runs, what does the first parameter of that function do? I thought it was to define the graphic tileset, but that seems not to be the case.

[EDIT]
Oh, and have you considered making the code a function call, runs? Most of the code for each tree is identical, except for a few names. Pass in the name of the tree, it could access the schematic and graphics for that name, and Bob's your uncle. Making new trees would be mostly defining graphics.Might want to include handling a parameter for exception groups like wood=0 as an exception to the rule that the function always defines the wood and subsequent products. I'm thinking for things like bamboo. Or if you wanted to replace default flammability or choppiness something. No need to code that in advance, though. Just add it as you need it.

Alternatively for bamboo, you might choose to let it define the wood, stairs, slabs, etc., then once you return from the function, just replace the recipe for bamboo wood to, say, one trunk yields one bamboo wood.
[/EDIT]

User avatar
runs
Member
Posts: 3225
Joined: Sat Oct 27, 2018 08:32

Re: [ModPack] Cool Trees [cool_trees] (v3.2)

by runs » Post

ThorfinnS wrote:Does that handle internationalization, trainwrecktony? If so, that's an elegant answer.

In this case, each of the init.lua files needs one tiny tweak.For chestnut, for instance, at line 223 is

Code: Select all

		"chestnuttree:trunk",
but if you replace it with

Code: Select all

		"chestnuttree:wood",
things work as expected.

Nice fence registration. Would be nice to have that in a lightweight utility mod so you aren't required to use cherrytree just to access the function.

runs, what does the first parameter of that function do? I thought it was to define the graphic tileset, but that seems not to be the case.

[EDIT]
Oh, and have you considered making the code a function call, runs? Most of the code for each tree is identical, except for a few names. Pass in the name of the tree, it could access the schematic and graphics for that name, and Bob's your uncle. Making new trees would be mostly defining graphics.Might want to include handling a parameter for exception groups like wood=0 as an exception to the rule that the function always defines the wood and subsequent products. I'm thinking for things like bamboo. Or if you wanted to replace default flammability or choppiness something. No need to code that in advance, though. Just add it as you need it.

Alternatively for bamboo, you might choose to let it define the wood, stairs, slabs, etc., then once you return from the function, just replace the recipe for bamboo wood to, say, one trunk yields one bamboo wood.
[/EDIT]
For internationalization you have to embrace the strings into S(" ")

What function?

To make a function is the paradigm that every programmer should follow. What happens is that this mod is thought not as a mod, but as a mod pack. If you don't want a tree then delete its folder. So you don't have to touch the code. They are two models, one has some advantages and the other some disadvantages.

Anyway I will make changes and put the missing slabs, etc.

ThorfinnS
Member
Posts: 311
Joined: Mon Feb 25, 2019 22:05
GitHub: ThorfinnS

Re: [ModPack] Cool Trees [cool_trees] (v3.2)

by ThorfinnS » Post

Sorry, runs. I was replying to both of you, and it must have not been obvious to which at any time. I thought that was how intl worked. I couldn't figure out how pkarc might have handled it, though I have no idea what pkarc is.
What function?

Code: Select all

if minetest.get_modpath("stairs") ~= nil then	
	stairs.register_stair_and_slab(
		"cherrytree_trunk",
		"cherrytree:trunk",
		{choppy = 2, oddly_breakable_by_hand = 2, flammable = 2},
		{"cherrytree_wood.png"},
		S("Cherry Tree Stair"),
		S("Cherry Tree Slab"),
		default.node_sound_wood_defaults()
	)
end
What does the first parameter, "cherrytree_trunk", do? I thought maybe it had something to do with the graphic used, because that's the format of the names in the textures directory, but changing the second parameter to wood uses the wood graphic, not the trunk graphic, so that's not it. Guess I would have been better off to have just read the stairs code.

Re: my edit, never mind. I didn't explain it well enough, and it's not that big a deal anyway. It's not like there are hundreds of people out there creating trees for minetest.

User avatar
runs
Member
Posts: 3225
Joined: Sat Oct 27, 2018 08:32

Re: [ModPack] Cool Trees [cool_trees] (v3.2)

by runs » Post

ThorfinnS wrote:Sorry, runs. I was replying to both of you, and it must have not been obvious to which at any time. I thought that was how intl worked. I couldn't figure out how pkarc might have handled it, though I have no idea what pkarc is.
What function?

Code: Select all

if minetest.get_modpath("stairs") ~= nil then	
	stairs.register_stair_and_slab(
		"cherrytree_trunk",
		"cherrytree:trunk",
		{choppy = 2, oddly_breakable_by_hand = 2, flammable = 2},
		{"cherrytree_wood.png"},
		S("Cherry Tree Stair"),
		S("Cherry Tree Slab"),
		default.node_sound_wood_defaults()
	)
end
What does the first parameter, "cherrytree_trunk", do? I thought maybe it had something to do with the graphic used, because that's the format of the names in the textures directory, but changing the second parameter to wood uses the wood graphic, not the trunk graphic, so that's not it. Guess I would have been better off to have just read the stairs code.

Re: my edit, never mind. I didn't explain it well enough, and it's not that big a deal anyway. It's not like there are hundreds of people out there creating trees for minetest.
That parameter is the 'subname'. It is used to compose the name of the node. I.e:

Code: Select all

":stairs:stair_" .. subname

User avatar
runs
Member
Posts: 3225
Joined: Sat Oct 27, 2018 08:32

Re: [ModPack] Cool Trees [cool_trees] (v3.3)

by runs » Post

v3.4
- Added slab and stairs for birch and palm.

User avatar
runs
Member
Posts: 3225
Joined: Sat Oct 27, 2018 08:32

Re: [ModPack] Cool Trees [cool_trees] (v3.4)

by runs » Post

Coming soon
Jacaranda Tree!

Image

Image

User avatar
TenPlus1
Member
Posts: 3715
Joined: Mon Jul 29, 2013 13:38
In-game: TenPlus1
Contact:

Re: [ModPack] Cool Trees [cool_trees] (v3.4)

by TenPlus1 » Post

I like the new trees you've added :)

If you would like the saplings to grow using bonemeal you could easily add support using the api:

https://notabug.org/TenPlus1/bonemeal/s ... pi.txt#L31

User avatar
runs
Member
Posts: 3225
Joined: Sat Oct 27, 2018 08:32

Re: [ModPack] Cool Trees [cool_trees] (v3.4)

by runs » Post

TenPlus1 wrote:I like the new trees you've added :)

If you would like the saplings to grow using bonemeal you could easily add support using the api:

https://notabug.org/TenPlus1/bonemeal/s ... pi.txt#L31
I will do for sure. Thanx :-)

CalebJ
Member
Posts: 407
Joined: Sat Dec 29, 2018 19:21
GitHub: KaylebJay
IRC: KaylebJay
In-game: CalebJ
Location: Tunnelers' Abyss

Re: [ModPack] Cool Trees [cool_trees] (v3.4)

by CalebJ » Post

Ooooh, looks awesome. Good pick for the next tree! Will be good for botanical gardens ;)

User avatar
runs
Member
Posts: 3225
Joined: Sat Oct 27, 2018 08:32

Re: [ModPack] Cool Trees [cool_trees] (v3.4)

by runs » Post

v3.5
Bonemeal support!
Now all the trees could grown faster thanks to bonemeal.

User avatar
runs
Member
Posts: 3225
Joined: Sat Oct 27, 2018 08:32

Re: [ModPack] Cool Trees [cool_trees] (v3.5)

by runs » Post

v3.6

- Fix: When you dig Blossom Cherry Leaves, you get normal leaves instead of.

Jacaranda

Image
Image

Add some color to jungles.
Bonemeal support as the rest.

ThatGraemeGuy
Member
Posts: 139
Joined: Thu Jul 31, 2014 11:02
GitHub: thatgraemeguy
IRC: ThatGraemeGuy
In-game: thatgraemeguy
Location: Cape Town, South Africa

Re: [ModPack] Cool Trees [cool_trees] (v3.6)

by ThatGraemeGuy » Post

Could this me modified to support technic's chainsaw? Or does the chainsaw code need to be changed to cater for these trees instead? I'm not sure how it works.

User avatar
runs
Member
Posts: 3225
Joined: Sat Oct 27, 2018 08:32

Re: [ModPack] Cool Trees [cool_trees] (v3.6)

by runs » Post

ThatGraemeGuy wrote:Could this me modified to support technic's chainsaw? Or does the chainsaw code need to be changed to cater for these trees instead? I'm not sure how it works.
I will check.

User avatar
paramat
Developer
Posts: 3700
Joined: Sun Oct 28, 2012 00:05
GitHub: paramat
IRC: paramat
Location: UK

Re: [ModPack] Cool Trees [cool_trees] (v3.1)

by paramat » Post

> Oh, really quickly, if the spawn is in a region of birch and bamboo, it's very often in the trunk of a birch. I don't know if there's anything you can do about that, but its common enough that I've put a sign up in the computer lab of what to do if you spawn and get the HUD but totally black screen.

This happens with all decorations and in any game, and has nothing to do with 'is_ground_content'

> I currently see a tree spawning on top of grass in areas.

Order of decoration registration determines order of placement, try swapping the order, and consider how 'force placement' is set for each decoration.
This is why MTG registers decorations in a certain order, usually largest first.

> I'm working on a fix, but it may mean using different noises for each tree / plant that I spawn.

That won't help.

User avatar
runs
Member
Posts: 3225
Joined: Sat Oct 27, 2018 08:32

Re: [ModPack] Cool Trees [cool_trees] (v3.6)

by runs » Post

v3.7
(thanks to thomasrudin)
-Added stairsplus support for bamboo.
-Added bamboo wood.
-Fixed decay of manually placed cherry leaves.

ThorfinnS
Member
Posts: 311
Joined: Mon Feb 25, 2019 22:05
GitHub: ThorfinnS

Re: [ModPack] Cool Trees [cool_trees] (v3.7)

by ThorfinnS » Post

Bamboo doesn't seem to grow.

Might want to register stairs and slabs for bamboo wood.

Also, for some weird reason, torches stick straight out from birch trunks.

User avatar
runs
Member
Posts: 3225
Joined: Sat Oct 27, 2018 08:32

Re: [ModPack] Cool Trees [cool_trees] (v3.7)

by runs » Post

v3.8
- Fixed: Bamboo not grow.
- Added Bamboo Stairs and Slab.
- Fixed: Bad torch position on trunks.

ThorfinnS
Member
Posts: 311
Joined: Mon Feb 25, 2019 22:05
GitHub: ThorfinnS

Re: [ModPack] Cool Trees [cool_trees] (v3.8)

by ThorfinnS » Post

Wow! That was fast! Thanks!

ThorfinnS
Member
Posts: 311
Joined: Mon Feb 25, 2019 22:05
GitHub: ThorfinnS

Re: [ModPack] Cool Trees [cool_trees] (v3.8)

by ThorfinnS » Post

I see if you use default stairs, it constructs slabs and stairs out of bamboo:trunk, but if you use moreblocks, it uses bamboo:wood, similar to the way all the rest of the trees do it.

Did you intend that?

Haven't actually seen bamboo grow yet (but it's only been 4 game days and I'm only watching 25 bamboo shoots) but it does grow when I use bonemeal's mulch, so it's probably just bad luck.

[EDIT]
Oh, and how did you fix the torch? One of the guys in my afterschool program is having a similar issue, and I don't know what to suggest. More to the point, why did commenting out that line fix it? Does mt's default right-click work, and that line overwrote it, or wnat?
[/EDIT]

User avatar
runs
Member
Posts: 3225
Joined: Sat Oct 27, 2018 08:32

Re: [ModPack] Cool Trees [cool_trees] (v3.8)

by runs » Post

ThorfinnS wrote:I see if you use default stairs, it constructs slabs and stairs out of bamboo:trunk, but if you use moreblocks, it uses bamboo:wood, similar to the way all the rest of the trees do it.

Did you intend that?

Haven't actually seen bamboo grow yet (but it's only been 4 game days and I'm only watching 25 bamboo shoots) but it does grow when I use bonemeal's mulch, so it's probably just bad luck.

[EDIT]
Oh, and how did you fix the torch? One of the guys in my afterschool program is having a similar issue, and I don't know what to suggest. More to the point, why did commenting out that line fix it? Does mt's default right-click work, and that line overwrote it, or wnat?
[/EDIT]
1) No, I will check it. :-D

2) It grows only new sprouts after the update, old ones no. Please, inform me that the error is solved.

3) Yes, you have to do torch code in that onright function. Or something similar. When I'd time I will research for that.

ThorfinnS
Member
Posts: 311
Joined: Mon Feb 25, 2019 22:05
GitHub: ThorfinnS

Re: [ModPack] Cool Trees [cool_trees] (v3.8)

by ThorfinnS » Post

runs wrote:2) It grows only new sprouts after the update, old ones no. Please, inform me that the error is solved.
Yep. Just had to wait. Shelly said it was something like 8 days, then 5 popped up in less than a minute. Others came up over the next couple days. Thanks!
runs wrote:) Yes, you have to do torch code in that onright function. Or something similar. When I'd time I will research for that.
Don't put yourself out on my account. For whatever reason, that worked for him, too. I have no idea where he copied the block from, but it had similar (but not the same) coding.

ThorfinnS
Member
Posts: 311
Joined: Mon Feb 25, 2019 22:05
GitHub: ThorfinnS

Re: [ModPack] Cool Trees [cool_trees] (v3.8)

by ThorfinnS » Post

There are more of those that use trunks as the feedstock for slabs. Chestnut and birch for sure. I did not check any further -- n++ does not do multi-line search. Hadn't had anyone notice it before because I fixed the recipes in my tweaks mod, and only recently started trimming stuff from it.

Also, only bamboo appears to have moreblocks support. Not that I use moreblocks anyway. (I really don't like the new improved orientation algorithm, and it's way heavy in terms of nodes added.)

Post Reply

Who is online

Users browsing this forum: No registered users and 12 guests