Update Fork #1

Merged
chmodsayshello merged 696 commits from MineClone5/MineClone5:master into master 2022-03-23 14:40:26 +01:00
4 changed files with 56 additions and 3 deletions
Showing only changes of commit 19e77c755b - Show all commits

View File

@ -30,6 +30,7 @@ mcl_mapgen.LAST_BLOCK = mcl_mapgen.CS - 1
mcl_mapgen.LAST_NODE_IN_BLOCK = mcl_mapgen.BS - 1
mcl_mapgen.LAST_NODE_IN_CHUNK = mcl_mapgen.CS_NODES - 1
mcl_mapgen.HALF_CS_NODES = math_floor(mcl_mapgen.CS_NODES / 2)
mcl_mapgen.HALF_BS = math_floor(mcl_mapgen.BS / 2)
mcl_mapgen.CS_3D = mcl_mapgen.CS^3
mcl_mapgen.CHUNK_WITH_SHELL = mcl_mapgen.CS + 2
mcl_mapgen.CHUNK_WITH_SHELL_3D = mcl_mapgen.CHUNK_WITH_SHELL^3

View File

@ -0,0 +1,50 @@
local radius_min = 3
local radius_max = mcl_mapgen.HALF_BS
local layers = {
{
[100] = "mcl_core:andesite",
},
{
[100] = "mcl_amethyst:calcite",
},
{
[95] = "mcl_amethyst:amethyst_block",
[5] = "mcl_amethyst:budding_amethyst_block",
},
{
[100] = "air",
}
}
local function place(pos, rotation, pr)
local radius = pr:next(radius_min, radius_max)
local pos = vector.add(pos, radius)
for x = pos.x - radius, pos.x + radius do
for y = pos.y - radius, pos.y + radius do
for z = pos.z - radius, pos.z + radius do
local node_pos = vector.new(x, y, z)
local inverted_layer = vector.round(vector.distance(node_pos, pos))
if inverted_layer <= radius then
local layer = math.max(radius - inverted_layer + 1, #layers)
local node_candidates = layers[layer]
local node_name
local chance_index = pr:next(1, 100)
local current_weight = 0
for chance, node_name_iterated in pairs(node_candidates) do
if chance_index < current_weight + chance then
node_name = node_name_iterated
break
end
current_weight = current_weight + chance
end
minetest.swap_node(node_pos, {name = node_name})
end
end
end
end
end
mcl_structures.register_structure({
name = "amethyst_geode",
place_function = place,
})

View File

@ -1,4 +1,6 @@
local S = minetest.get_translator(minetest.get_current_modname())
local modname = minetest.get_current_modname()
local modpath = minetest.get_modpath(modname)
mcl_amethyst = {}
-- Amethyst block
@ -208,5 +210,5 @@ if minetest.get_modpath("mcl_spyglass") then
end
end
-- Amethyst Growing
dofile(minetest.get_modpath(minetest.get_current_modname()) .. "/grow.lua")
dofile(modpath .. "/grow.lua")
dofile(modpath .. "/geode.lua")

View File

@ -1,5 +1,5 @@
name = mcl_amethyst
author = Emojiminetest
description = Amethyst related stuff for MCL5
depends = mcl_init, mcl_core, mcl_wip
depends = mcl_init, mcl_core, mcl_wip, mcl_mapgen, mcl_structures
optional_depends = mcl_spyglass, mcl_copper