1
0
Fork 0

fix even more warnings (nether portals and potions)

This commit is contained in:
AFCMS 2021-05-22 23:04:18 +02:00
parent 1870a89af0
commit a71a0e9161
3 changed files with 27 additions and 14 deletions

View File

@ -137,8 +137,20 @@ local function find_exit(p, dx, dy, dz)
if not p or not p.y or not p.z or not p.x then return end if not p or not p.y or not p.z or not p.x then return end
local dx, dy, dz = dx or DISTANCE_MAX, dy or DISTANCE_MAX, dz or DISTANCE_MAX local dx, dy, dz = dx or DISTANCE_MAX, dy or DISTANCE_MAX, dz or DISTANCE_MAX
if dx < 1 or dy < 1 or dz < 1 then return false end if dx < 1 or dy < 1 or dz < 1 then return false end
local x, y, z = floor(p.x), floor(p.y), floor(p.z)
local x1, y1, z1, x2, y2, z2 = x-dx+1, y-dy+1, z-dz+1, x+dx-1, y+dy-1, z+dz-1 --y values aren't used
local x = floor(p.x)
--local y = floor(p.y)
local z = floor(p.z)
local x1 = x-dx+1
--local y1 = y-dy+1
local z1 = z-dz+1
local x2 = x+dx-1
--local y2 = y+dy-1
local z2 = z+dz-1
local k1x, k2x = floor(x1/256), floor(x2/256) local k1x, k2x = floor(x1/256), floor(x2/256)
local k1z, k2z = floor(z1/256), floor(z2/256) local k1z, k2z = floor(z1/256), floor(z2/256)
@ -371,7 +383,7 @@ local function finalize_teleport(obj, exit)
if is_player then if is_player then
name = obj:get_player_name() name = obj:get_player_name()
end end
local y, dim = mcl_worlds.y_to_layer(exit.y) local _, dim = mcl_worlds.y_to_layer(exit.y)
-- If player stands, player is at ca. something+0.5 which might cause precision problems, so we used ceil for objpos.y -- If player stands, player is at ca. something+0.5 which might cause precision problems, so we used ceil for objpos.y

View File

@ -558,8 +558,8 @@ function mcl_potions.make_invisible(player, toggle)
local is_player = player:is_player() local is_player = player:is_player()
local entity = player:get_luaentity() local entity = player:get_luaentity()
local playername = player:get_player_name() --local playername = player:get_player_name()
local skin_file = "" local skin_file
if toggle then -- hide player if toggle then -- hide player
@ -567,22 +567,22 @@ function mcl_potions.make_invisible(player, toggle)
if entity then if entity then
EF.invisible[player].old_size = entity.visual_size EF.invisible[player].old_size = entity.visual_size
elseif not player:is_player() then -- if not a player or entity, do nothing elseif not is_player then -- if not a player or entity, do nothing
return return
end end
if player:is_player() then if is_player then
mcl_player.player_set_skin(player, "mobs_mc_empty.png") mcl_player.player_set_skin(player, skin_file)
elseif not player:is_player() then elseif not is_player then
player:set_properties({visual_size = {x = 0, y = 0}}) player:set_properties({visual_size = {x = 0, y = 0}})
end end
player:set_nametag_attributes({color = {a = 0}}) player:set_nametag_attributes({color = {a = 0}})
elseif EF.invisible[player] then -- show player elseif EF.invisible[player] then -- show player
if player:is_player() then if is_player then
mcl_skins.update_player_skin(player) mcl_skins.update_player_skin(player)
elseif not player:is_player() then elseif not is_player then
player:set_properties({visual_size = EF.invisible[player].old_size}) player:set_properties({visual_size = EF.invisible[player].old_size})
end end
player:set_nametag_attributes({color = {r = 255, g = 255, b = 255, a = 255}}) player:set_nametag_attributes({color = {r = 255, g = 255, b = 255, a = 255}})

View File

@ -3580,7 +3580,8 @@ local function register_decorations()
local fern_minimal = { "Jungle", "JungleM", "JungleEdge", "JungleEdgeM", "Taiga", "MegaTaiga", "MegaSpruceTaiga", "ColdTaiga" } local fern_minimal = { "Jungle", "JungleM", "JungleEdge", "JungleEdgeM", "Taiga", "MegaTaiga", "MegaSpruceTaiga", "ColdTaiga" }
local fern_low = { "Jungle", "JungleM", "JungleEdge", "JungleEdgeM", "Taiga", "MegaTaiga", "MegaSpruceTaiga" } local fern_low = { "Jungle", "JungleM", "JungleEdge", "JungleEdgeM", "Taiga", "MegaTaiga", "MegaSpruceTaiga" }
local fern_Jungle = { "Jungle", "JungleM", "JungleEdge", "JungleEdgeM" } local fern_Jungle = { "Jungle", "JungleM", "JungleEdge", "JungleEdgeM" }
local fern_JungleM = { "JungleM" }, --local fern_JungleM = { "JungleM" },
register_grass_decoration("fern", -0.03, 0.09, fern_minimal) register_grass_decoration("fern", -0.03, 0.09, fern_minimal)
register_grass_decoration("fern", -0.015, 0.075, fern_minimal) register_grass_decoration("fern", -0.015, 0.075, fern_minimal)
register_grass_decoration("fern", 0, 0.06, fern_minimal) register_grass_decoration("fern", 0, 0.06, fern_minimal)
@ -3591,7 +3592,7 @@ local function register_decorations()
register_grass_decoration("fern", 0.05, 0.01, fern_Jungle) register_grass_decoration("fern", 0.05, 0.01, fern_Jungle)
register_grass_decoration("fern", 0.07, -0.01, fern_Jungle) register_grass_decoration("fern", 0.07, -0.01, fern_Jungle)
register_grass_decoration("fern", 0.09, -0.03, fern_Jungle) register_grass_decoration("fern", 0.09, -0.03, fern_Jungle)
register_grass_decoration("fern", 0.12, -0.03, fern_JungleM) register_grass_decoration("fern", 0.12, -0.03, {"JungleM"})
local b_seagrass = {"ColdTaiga_ocean","ExtremeHills_ocean","ExtremeHillsM_ocean","ExtremeHills+_ocean","Taiga_ocean","MegaTaiga_ocean","MegaSpruceTaiga_ocean","StoneBeach_ocean","Plains_ocean","SunflowerPlains_ocean","Forest_ocean","FlowerForest_ocean","BirchForest_ocean","BirchForestM_ocean","RoofedForest_ocean","Swampland_ocean","Jungle_ocean","JungleM_ocean","JungleEdge_ocean","JungleEdgeM_ocean","MushroomIsland_ocean","Desert_ocean","Savanna_ocean","SavannaM_ocean","Mesa_ocean","MesaBryce_ocean","MesaPlateauF_ocean","MesaPlateauFM_ocean", local b_seagrass = {"ColdTaiga_ocean","ExtremeHills_ocean","ExtremeHillsM_ocean","ExtremeHills+_ocean","Taiga_ocean","MegaTaiga_ocean","MegaSpruceTaiga_ocean","StoneBeach_ocean","Plains_ocean","SunflowerPlains_ocean","Forest_ocean","FlowerForest_ocean","BirchForest_ocean","BirchForestM_ocean","RoofedForest_ocean","Swampland_ocean","Jungle_ocean","JungleM_ocean","JungleEdge_ocean","JungleEdgeM_ocean","MushroomIsland_ocean","Desert_ocean","Savanna_ocean","SavannaM_ocean","Mesa_ocean","MesaBryce_ocean","MesaPlateauF_ocean","MesaPlateauFM_ocean",
"ColdTaiga_deep_ocean","ExtremeHills_deep_ocean","ExtremeHillsM_deep_ocean","ExtremeHills+_deep_ocean","Taiga_deep_ocean","MegaTaiga_deep_ocean","MegaSpruceTaiga_deep_ocean","StoneBeach_deep_ocean","Plains_deep_ocean","SunflowerPlains_deep_ocean","Forest_deep_ocean","FlowerForest_deep_ocean","BirchForest_deep_ocean","BirchForestM_deep_ocean","RoofedForest_deep_ocean","Swampland_deep_ocean","Jungle_deep_ocean","JungleM_deep_ocean","JungleEdge_deep_ocean","JungleEdgeM_deep_ocean","MushroomIsland_deep_ocean","Desert_deep_ocean","Savanna_deep_ocean","SavannaM_deep_ocean","Mesa_deep_ocean","MesaBryce_deep_ocean","MesaPlateauF_deep_ocean","MesaPlateauFM_deep_ocean", "ColdTaiga_deep_ocean","ExtremeHills_deep_ocean","ExtremeHillsM_deep_ocean","ExtremeHills+_deep_ocean","Taiga_deep_ocean","MegaTaiga_deep_ocean","MegaSpruceTaiga_deep_ocean","StoneBeach_deep_ocean","Plains_deep_ocean","SunflowerPlains_deep_ocean","Forest_deep_ocean","FlowerForest_deep_ocean","BirchForest_deep_ocean","BirchForestM_deep_ocean","RoofedForest_deep_ocean","Swampland_deep_ocean","Jungle_deep_ocean","JungleM_deep_ocean","JungleEdge_deep_ocean","JungleEdgeM_deep_ocean","MushroomIsland_deep_ocean","Desert_deep_ocean","Savanna_deep_ocean","SavannaM_deep_ocean","Mesa_deep_ocean","MesaBryce_deep_ocean","MesaPlateauF_deep_ocean","MesaPlateauFM_deep_ocean",
@ -3974,7 +3975,7 @@ if mg_name ~= "singlenode" then
mcl_mapgen_core.register_generator("chorus_grow", nil, function(minp, maxp, blockseed) mcl_mapgen_core.register_generator("chorus_grow", nil, function(minp, maxp, blockseed)
local gennotify = minetest.get_mapgen_object("gennotify") local gennotify = minetest.get_mapgen_object("gennotify")
--local poslist = {} --local poslist = {}
pr = PseudoRandom(blockseed + 14) local pr = PseudoRandom(blockseed + 14)
for _, pos in ipairs(gennotify["decoration#"..deco_id_chorus_plant] or {}) do for _, pos in ipairs(gennotify["decoration#"..deco_id_chorus_plant] or {}) do
local x, y, z = pos.x, pos.y, pos.z local x, y, z = pos.x, pos.y, pos.z
if x < -2 or x > 2 or z < -2 or z > 2 then if x < -2 or x > 2 or z < -2 or z > 2 then