Merge branch 'main' into Add_new_mob_ender_salmon

This commit is contained in:
Xeno333 2024-08-30 09:17:08 -05:00 committed by GitHub
commit ae57c4ce3c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
26 changed files with 155 additions and 101 deletions

View File

@ -39,4 +39,4 @@ dofile(mcl_better_end.code_loc .. "/nightite/nightite_craft.lua")
dofile(mcl_better_end.code_loc .. "/entities/ender_salmon.lua")
dofile(mcl_better_end.code_loc .. "/physics.lua")
dofile(mcl_better_end.code_loc .. "/physics.lua")

View File

@ -1,4 +1,4 @@
local YMAX = -27020
local YMAX = -26500
local YMIN = -27100
mcl_better_end.mapgen.registered_nodes.enderite_ore = minetest.get_content_id("mcl_better_end:enderite_ore")
@ -8,7 +8,7 @@ mcl_better_end.mapgen.ores.enderite = {
--enderite
if data[vi] == mcl_better_end.mapgen.registered_nodes.end_stone then
if pr:next(1, 1000) == 5 then
if pr:next(1, 10) == 5 then
if pr:next(1, 7) == 5 then
data[vi] = mcl_better_end.mapgen.registered_nodes.enderite_ore
end
end

View File

@ -63,9 +63,9 @@ end
mcl_better_end.api.register_biome({
type = "sea",
dec = function(pr, x, y, z, perlin_l, noise_center)
dec = function(pr, x, y, z, perlin_l, noise_center, plnoise, plnoise_1)
if pr:next(1, 4000) == 5 then
if perlin_l:get_3d({x = x, y = y, z = z}) < (mcl_better_end.api.consts.sea_ends + 0.00001) then
if plnoise < (mcl_better_end.api.consts.sea_ends + 0.00001) then
make_sub({x=x,y=y,z=z}, pr)
end
end

View File

@ -18,13 +18,19 @@ local night_vines_bottom = mcl_better_end.mapgen.registered_nodes.night_vines_bo
mcl_better_end.api.register_biome({
type = "cave",
gen = function(data, vi, area, pr, x, y, z, perlin_l, noise_center)
if mcl_better_end.api.is_island(x, y-1, z) then
gen = function(data, vi, area, pr, x, y, z, perlin_l, noise_center, plnoise, plnoise_1)
local noise = perlin_l:get_3d({x = x, y = y-1, z = z})
if mcl_better_end.api.is_island(noise) then
data[vi] = filler
if pr:next(1, 100) == 2 then
minetest.add_entity({x = x, y = y+1, z = z}, "mobs_mc:endermite", minetest.serialize({}))
end
--add topww
if pr:next(1, 20) == 3 then
if mcl_better_end.api.is_cave(x, y+1, z) then
if mcl_better_end.api.is_cave(plnoise, plnoise_1) then
local vi = area:index(x, y+1, z)
if data[vi] == mcl_better_end.mapgen.registered_nodes.air then
data[vi] = topper
@ -32,7 +38,7 @@ mcl_better_end.api.register_biome({
end
elseif pr:next(1, 200) == 3 then
if mcl_better_end.api.is_cave(x, y+1, z) then
if mcl_better_end.api.is_cave(plnoise, plnoise_1) then
local vi = area:index(x, y+1, z)
if data[vi] == mcl_better_end.mapgen.registered_nodes.air then
data[vi] = night_candle_plant
@ -40,7 +46,7 @@ mcl_better_end.api.register_biome({
end
end
elseif mcl_better_end.api.is_island(x, y+1, z) then
elseif mcl_better_end.api.is_island(plnoise_1) then
if pr:next(1, 5) == 1 then
data[vi] = night_vines
end
@ -52,11 +58,6 @@ mcl_better_end.api.register_biome({
end
end
end,
dec = function(pr, x, y, z, perlin_l, noise_center)
if pr:next(1, 600) == 2 then
minetest.add_entity({x = x, y = y+1, z = z}, "mobs_mc:endermite", minetest.serialize({}))
end
end,
noise_high = 1,
noise_low = -1
})

View File

@ -16,18 +16,18 @@ local glow_berry_plant = mcl_better_end.mapgen.registered_nodes.oasis_glow_berry
mcl_better_end.api.register_biome({
type = "island",
gen = function(data, vi, area, pr, x, y, z, perlin_l, noise_center)
gen = function(data, vi, area, pr, x, y, z, perlin_l, noise_center, plnoise, plnoise_1)
data[vi] = filler
--add topww
if pr:next(1, 20) == 3 then
if not mcl_better_end.api.is_island(x, y+1, z) then
if not mcl_better_end.api.is_island(plnoise_1) then
local vi = area:index(x, y+1, z)
data[vi] = topper
end
elseif pr:next(1, 200) == 3 then
if not mcl_better_end.api.is_island(x, y+1, z) then
if not mcl_better_end.api.is_island(plnoise_1) then
local vi = area:index(x, y+1, z)
data[vi] = glow_berry_plant
end

View File

@ -7,8 +7,10 @@ mcl_better_end.mapgen.registered_nodes.plains_topper = minetest.get_content_id("
mcl_better_end.mapgen.registered_nodes.plains_magibulb = minetest.get_content_id("mcl_better_end:end_plains_magibulb_plant")
mcl_better_end.mapgen.registered_nodes.plains_chorus_plant = minetest.get_content_id("mcl_end:chorus_plant")
mcl_better_end.mapgen.registered_nodes.plains_chorus_flower_dead = minetest.get_content_id("mcl_end:chorus_flower_dead")
mcl_better_end.mapgen.registered_nodes.sand = minetest.get_content_id("mcl_better_end:end_sand")
local sand = mcl_better_end.mapgen.registered_nodes.sand
local topper = mcl_better_end.mapgen.registered_nodes.plains_topper
local filler = mcl_better_end.mapgen.registered_nodes.plains_filler
local magibulb = mcl_better_end.mapgen.registered_nodes.plains_magibulb
@ -16,18 +18,19 @@ local chorus_plant = mcl_better_end.mapgen.registered_nodes.plains_chorus_plant
local chorus_plant_top = mcl_better_end.mapgen.registered_nodes.plains_chorus_flower_dead
local function grow_chorus_branch(pos, height, pr, data, area)
local function grow_chorus_branch(pos, height, pr, data, area, perlin_l)
local current_pos = {x = pos.x, y = pos.y, z = pos.z}
for i = 0, height do
current_pos.y = current_pos.y + 1
local vi = area:index(current_pos.x, current_pos.y, current_pos.z)
data[vi] = chorus_plant
-- Randomly decide if we branch
-- Randomly decide if we branch
if pr:next(1, 2) == 1 then
local branch_dir = pr:next(1, 4)
local branch_pos
if not mcl_better_end.api.is_free(current_pos.x, current_pos.y, current_pos.z) then
local noise = perlin_l:get_3d({x=current_pos.x, y=current_pos.y, z=current_pos.z})
if not mcl_better_end.api.is_free(noise) then
return
end
if branch_dir == 1 then
@ -58,34 +61,39 @@ end
mcl_better_end.api.register_biome({
type = "island",
gen = function(data, vi, area, pr, x, y, z, perlin_l, noise_center)
data[vi] = filler
if pr:next(1, 20) == 5 then
if not mcl_better_end.api.is_island(x, y+1, z) then
local vi = area:index(x, y+1, z)
data[vi] = topper
end
elseif pr:next(1, 100) == 5 then
data[vi] = mcl_better_end.mapgen.registered_nodes.end_stone
grow_chorus_branch({x = x, y = y, z = z}, pr:next(1, 20), pr, data, area)
elseif pr:next(1, 200) == 46 then
if not mcl_better_end.api.is_island(x, y+1, z) then
local vi = area:index(x, y+1, z)
data[vi] = magibulb
end
gen = function(data, vi, area, pr, x, y, z, perlin_l, noise_center, plnoise, plnoise_1)
if noise_center < -0.5 then
data[vi] = sand
else
data[vi] = filler
end
end,
dec = function(pr, x, y, z, perlin_l, noise_center)
if pr:next(1, 600) == 2 then
minetest.add_entity({x = x, y = y+1, z = z}, "mobs_mc:enderman", minetest.serialize({}))
elseif pr:next(1, 800) == 2 then
minetest.add_entity({x = x, y = y+1, z = z}, "mobs_mc:shulker", minetest.serialize({}))
end
if pr:next(1, 20) == 5 then
if not mcl_better_end.api.is_island(plnoise_1) then
local vi = area:index(x, y+1, z)
data[vi] = topper
end
elseif pr:next(1, 100) == 5 then
data[vi] = mcl_better_end.mapgen.registered_nodes.end_stone
grow_chorus_branch({x = x, y = y, z = z}, pr:next(1, 20), pr, data, area, perlin_l)
elseif pr:next(1, 200) == 46 then
if not mcl_better_end.api.is_island(plnoise_1) then
local vi = area:index(x, y+1, z)
data[vi] = magibulb
end
end
end,
noise_high = 0,
noise_low = -1

View File

@ -14,13 +14,6 @@ local perlin_l
-- Caching Perlin noise for a single coordinate
local function get_perlin_noise(perlin, x, y, z)
return perlin:get_3d({x = x, y = y, z = z})
end
--api
mcl_better_end.mapgen.registered_nodes = {
@ -40,22 +33,19 @@ mcl_better_end.api.consts.sea_starts = -0.5
mcl_better_end.api.consts.sea_ends = -1
mcl_better_end.api.is_cave = function(x, y, z)
local noise = get_perlin_noise(perlin_l, x, y, z)
return (noise >= 0.8) or (get_perlin_noise(perlin_l, x, y + 1, z) >= 0.8)
mcl_better_end.api.is_cave = function(noise, noise2)
return (noise >= 0.8) or (noise2 >= 0.8)
end
mcl_better_end.api.is_island = function(x, y, z)
local noise = get_perlin_noise(perlin_l, x, y, z)
mcl_better_end.api.is_island = function(noise)
return (noise > 0.5 and noise < 0.8)
end
mcl_better_end.api.is_sea = function(x, y, z)
return get_perlin_noise(perlin_l, x, y, z) < mcl_better_end.api.consts.sea_starts
mcl_better_end.api.is_sea = function(noise)
return noise < mcl_better_end.api.consts.sea_starts
end
mcl_better_end.api.is_free = function(x, y, z)
local noise = get_perlin_noise(perlin_l, x, y, z)
mcl_better_end.api.is_free = function(noise)
return not (noise >= 0.8 or (noise > 0.5 and noise < 0.8) or noise < -0.5)
end
@ -101,24 +91,26 @@ function mcl_better_end.mapgen.gen(minp, maxp, seed)
local light_data = vm:get_light_data()
local pr = PseudoRandom((seed + minp.x + maxp.z) / 3)
if minp.y > YMAX_biome then
for y = maxp.y, minp.y, -1 do
for z = maxp.z, minp.z, -1 do
for x = maxp.x, minp.x, -1 do
local vi = area:index(x, y, z)
if mcl_better_end.api.is_free(x, y, z) then
local noise = perlin_l:get_3d({x = x, y = y, z = z})
if not mcl_better_end.api.is_island(noise) then
data[vi] = mcl_better_end.mapgen.registered_nodes.air
light_data[vi] = light_level
elseif mcl_better_end.api.is_island(x, y, z) then
else
data[vi] = mcl_better_end.mapgen.registered_nodes.end_stone
end
for _, f in pairs(mcl_better_end.mapgen.ores) do
if y >= f.ymin and y <= f.ymax then
f.gen(data, vi, area, pr, x, y, z, perlin_l)
for _, f in pairs(mcl_better_end.mapgen.ores) do
if y >= f.ymin and y <= f.ymax then
f.gen(data, vi, area, pr, x, y, z, perlin_l)
end
end
end
end
end
end
@ -129,48 +121,77 @@ function mcl_better_end.mapgen.gen(minp, maxp, seed)
vm:update_map()
return
end
local noises = {l={}, m={}}
for y = maxp.y, minp.y, -1 do
if not noises.l[y] then
noises.l[y] = {}
noises.m[y] = {}
end
if not noises.l[y + 1] then
noises.l[y + 1] = {}
end
for z = maxp.z, minp.z, -1 do
if not noises.l[y][z] then
noises.l[y][z] = {}
noises.m[y][z] = {}
end
if not noises.l[y+1][z] then
noises.l[y+1][z] = {}
end
for x = maxp.x, minp.x, -1 do
if not noises.l[y][z][x] then
noises.l[y][z][x] = {}
noises.m[y][z][x] = {}
end
local vi = area:index(x, y, z)
local noise_center = get_perlin_noise(perlin, x, y, z)
if mcl_better_end.api.is_free(x, y, z) then
local noise = perlin_l:get_3d({x = x, y = y, z = z})
noises.l[y][z][x] = noise
if mcl_better_end.api.is_free(noise) then
data[vi] = mcl_better_end.mapgen.registered_nodes.air
light_data[vi] = light_level
goto keepitup2
end
if mcl_better_end.api.is_island(x, y, z) then
if not noises.l[y+1][z][x] then
noises.l[y+1][z][x] = perlin_l:get_3d({x = x, y = y + 1, z = z})
end
local noise2 = noises.l[y+1][z][x]
local noise_center = perlin:get_3d({x = x, y = y, z = z})
noises.m[y][z][x] = noise_center
if mcl_better_end.api.is_island(noise) then
data[vi] = mcl_better_end.mapgen.registered_nodes.end_stone
if mcl_better_end.api.is_free(x, y + 1, z) then
if mcl_better_end.api.is_free(noise2) then
for _, p in pairs(mcl_better_end.biomes) do
if p.type == "island" and p.gen and noise_center >= p.noise_low and noise_center <= p.noise_high then
p.gen(data, vi, area, pr, x, y, z, perlin_l, noise_center)
p.gen(data, vi, area, pr, x, y, z, perlin_l, noise_center, noise, noise2)
end
end
end
goto keepitup
elseif mcl_better_end.api.is_cave(x, y, z) then
elseif mcl_better_end.api.is_cave(noise, noise2) then
data[vi] = mcl_better_end.mapgen.registered_nodes.air
light_data[vi] = cave_light_level
for _, p in pairs(mcl_better_end.biomes) do
if p.type == "cave" and p.gen and noise_center >= p.noise_low and noise_center <= p.noise_high then
p.gen(data, vi, area, pr, x, y, z, perlin_l, noise_center)
p.gen(data, vi, area, pr, x, y, z, perlin_l, noise_center, noise, noise2)
end
end
goto keepitup
elseif mcl_better_end.api.is_sea(x, y, z) then
elseif mcl_better_end.api.is_sea(noise) then
data[vi] = mcl_better_end.mapgen.registered_nodes.sea
for _, p in pairs(mcl_better_end.biomes) do
if p.type == "sea" and p.gen and noise_center >= p.noise_low and noise_center <= p.noise_high then
p.gen(data, vi, area, pr, x, y, z, perlin_l, noise_center)
p.gen(data, vi, area, pr, x, y, z, perlin_l, noise_center, noise, noise2)
end
end
goto keepitup
end
::keepitup::
for _, f in pairs(mcl_better_end.mapgen.ores) do
if y >= f.ymin and y <= f.ymax then
@ -187,46 +208,42 @@ function mcl_better_end.mapgen.gen(minp, maxp, seed)
vm:set_light_data(light_data)
vm:write_to_map()
vm:update_map()
end
-- Mapgen Decoration Function
function mcl_better_end.mapgen.dec(minp, maxp, seed)
local vm, emin, emax = minetest.get_mapgen_object("voxelmanip")
local area = VoxelArea:new{MinEdge=emin, MaxEdge=emax}
local pr = PseudoRandom((seed + minp.x + maxp.z) / 3)
for y = minp.y, maxp.y do
for z = minp.z, maxp.z do
for x = minp.x, maxp.x do
if mcl_better_end.api.is_free(x, y, z) then
local noise = noises.l[y][z][x]
if mcl_better_end.api.is_free(noise) then
goto keepitup
end
local noise_center = get_perlin_noise(perlin, x, y, z)
if mcl_better_end.api.is_island(x, y, z) then
if mcl_better_end.api.is_free(x, y + 1, z) then
local noise2 = noises.l[y+1][z][x]
local noise_center = noises.m[y][z][x]
if mcl_better_end.api.is_island(noise) then
if mcl_better_end.api.is_free(noise2) then
for _, p in pairs(mcl_better_end.biomes) do
if p.type == "island" and p.dec and noise_center >= p.noise_low and noise_center <= p.noise_high then
p.dec(pr, x, y, z, perlin_l, noise_center)
p.dec(pr, x, y, z, perlin_l, noise_center, noise, noise2)
end
end
end
goto keepitup
elseif mcl_better_end.api.is_cave(x, y, z) then
elseif mcl_better_end.api.is_cave(noise, noise2) then
local vi = area:index(x, y, z)
for _, p in pairs(mcl_better_end.biomes) do
if p.type == "cave" and p.dec and noise_center >= p.noise_low and noise_center <= p.noise_high then
p.dec(pr, x, y, z, perlin_l, noise_center)
p.dec(pr, x, y, z, perlin_l, noise_center, noise, noise2)
end
end
goto keepitup
elseif mcl_better_end.api.is_sea(x, y, z) then
elseif mcl_better_end.api.is_sea(noise) then
for _, p in pairs(mcl_better_end.biomes) do
if p.type == "sea" and p.dec and noise_center >= p.noise_low and noise_center <= p.noise_high then
p.dec(pr, x, y, z, perlin_l, noise_center)
p.dec(pr, x, y, z, perlin_l, noise_center, noise, noise2)
end
end
goto keepitup
@ -237,15 +254,12 @@ function mcl_better_end.mapgen.dec(minp, maxp, seed)
end
end
end
end
minetest.register_on_generated(
function(minp, maxp, seed)
if maxp.y < YMIN or minp.y > YMAX then return end
mcl_better_end.mapgen.gen(minp, maxp, seed)
if maxp.y < YMIN or minp.y > YMAX_biome then return end
mcl_better_end.mapgen.dec(minp, maxp, seed)
mcl_better_end.mapgen.gen({x=minp.x, y=minp.y - 1,z=minp.z}, maxp, seed)
end
)

31
src/mobs.lua Normal file
View File

@ -0,0 +1,31 @@
-- Define the mob
minetest.register_entity("mcl_better_end:endfish", {
hp_max = 10, -- Health points
physical = true, -- Physical entity (can be interacted with)
weight = 0, -- Weight (affects how it interacts with other entities)
collisionbox = {-0.5, 0, -0.5, 0.5, 1.5, 0.5}, -- Collision box dimensions
visual = "cube", -- Visual representation as a box
mesh = "mymob.b3d", -- Mesh file for the mob
textures = {"mymob_texture.png"}, -- Texture for the mesh
visual_size = {x=1, y=1}, -- Size of the visual representation
-- Behavior
on_punch = function(self, hitter, tuch, point)
-- Behavior when punched
self.object:remove() -- Remove the mob when punched
end,
-- Step function called every server step
on_step = function(self, dtime)
-- Behavior per step (e.g., movement)
-- Example: Move forward
local pos = self.object:get_pos()
pos.x = pos.x + 0.1
self.object:set_pos(pos)
end,
-- Initialization
on_activate = function(self, staticdata, dtime_s)
-- Initialization code
end,
})

View File

@ -1,5 +1,5 @@
local YMAX = -26820
local YMIN = -26920
local YMAX = -25500
local YMIN = -26000
--oasis
local noise_high = 1
@ -15,7 +15,7 @@ mcl_better_end.mapgen.ores.nephrite = {
--nephrite
if data[vi] == mcl_better_end.mapgen.registered_nodes.end_stone then
if pr:next(1, 1000) == 5 then
if pr:next(1, 40) == 5 then
if pr:next(1, 10) == 5 then
data[vi] = mcl_better_end.mapgen.registered_nodes.nephrite_ore
end
end

View File

@ -1,6 +1,6 @@
minetest.register_node("mcl_better_end:end_sand", {
description = "End Sand",
tiles = {"end_sand.png"},
tiles = {"mcl_better_end_end_sand.png"},
stack_max = 64,
drop = "mcl_better_end:end_sand",
@ -98,4 +98,4 @@ minetest.register_craft({
{'mcl_better_end:end_berry_rock', 'mcl_better_end:end_glow_berry', 'mcl_better_end:end_berry_rock'},
{'mcl_better_end:end_berry_rock', 'mcl_better_end:end_berry_rock', 'mcl_better_end:end_berry_rock'},
}
})
})

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 932 B

View File

Before

Width:  |  Height:  |  Size: 5.2 KiB

After

Width:  |  Height:  |  Size: 5.2 KiB

View File

Before

Width:  |  Height:  |  Size: 5.2 KiB

After

Width:  |  Height:  |  Size: 5.2 KiB

View File

Before

Width:  |  Height:  |  Size: 5.2 KiB

After

Width:  |  Height:  |  Size: 5.2 KiB

View File

Before

Width:  |  Height:  |  Size: 6.6 KiB

After

Width:  |  Height:  |  Size: 6.6 KiB

View File

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

Before

Width:  |  Height:  |  Size: 6.7 KiB

After

Width:  |  Height:  |  Size: 6.7 KiB

View File

Before

Width:  |  Height:  |  Size: 5.4 KiB

After

Width:  |  Height:  |  Size: 5.4 KiB

View File

Before

Width:  |  Height:  |  Size: 5.4 KiB

After

Width:  |  Height:  |  Size: 5.4 KiB

View File

Before

Width:  |  Height:  |  Size: 5.4 KiB

After

Width:  |  Height:  |  Size: 5.4 KiB