forked from Mineclonia/Mineclonia
Generate pig spawners in mineshafts
In Minecraft Java Edition, when the map generator generates a spawner, it can generates a pig spawner instead of the spawner it should create. That behaviour is very rare, but has never been removed from Minecraft. This patch changes 1 in 1000 spawners in a mineshaft to be a pig spawner instead of a cave spider spawner.
This commit is contained in:
parent
eddbfb4b5c
commit
71cff7051f
|
@ -51,10 +51,23 @@ function tsm_railcorridors.get_default_treasure(pr)
|
|||
-- UNUSED IN MINECLONE 2!
|
||||
end
|
||||
|
||||
-- All spawners spawn cave spiders
|
||||
function tsm_railcorridors.on_construct_spawner(pos)
|
||||
-- Almost all spawners spawn cave spiders, but there is a 1 in 1000
|
||||
-- chance to spawn a pig spawner instead, inspired by multiple bugs
|
||||
-- in Minecraft that turn spawners in Mineshafts into pig spawners.
|
||||
-- (Basically any spawner bug in Minecraft generates pig spawners.)
|
||||
--
|
||||
-- The Minecraft chance to get a pig spawner here is way lower than
|
||||
-- 1 in 1000, but because of the small size of Minetest worlds, the
|
||||
-- Minecraft chance would risk not having a pig spawner in a world.
|
||||
--
|
||||
-- The world with the seed “pigs” generates a pig spawner at 3,-8,7
|
||||
function tsm_railcorridors.on_construct_spawner(pos, pr)
|
||||
if pr:next(1,1000) == 900 then
|
||||
mcl_mobspawners.setup_spawner(pos, "mobs_mc:pig", 0, 7)
|
||||
else
|
||||
mcl_mobspawners.setup_spawner(pos, "mobs_mc:cave_spider", 0, 7)
|
||||
end
|
||||
end
|
||||
|
||||
-- MineClone 2's treasure function. Gets all treasures for a single chest.
|
||||
-- Based on information from Minecraft Wiki.
|
||||
|
|
|
@ -114,7 +114,7 @@ if not tsm_railcorridors.nodes.corridor_woods_function then
|
|||
end
|
||||
|
||||
-- Random Perlin noise generators
|
||||
local pr, pr_carts, pr_treasures, pr_deco, webperlin_major, webperlin_minor
|
||||
local pr, pr_carts, pr_spawner, pr_treasures, pr_deco, webperlin_major, webperlin_minor
|
||||
|
||||
local function InitRandomizer(seed)
|
||||
-- Mostly used for corridor gen.
|
||||
|
@ -123,6 +123,8 @@ local function InitRandomizer(seed)
|
|||
pr_deco = PseudoRandom(seed+25)
|
||||
-- Separate randomizer for carts because spawning carts is very timing-dependent
|
||||
pr_carts = PseudoRandom(seed-654)
|
||||
-- Spawner type randomiser
|
||||
pr_spawner = PseudoRandom(seed+345)
|
||||
-- Chest contents randomizer
|
||||
pr_treasures = PseudoRandom(seed+777)
|
||||
-- Used for cobweb generation, both noises have to reach a high value for cobwebs to appear
|
||||
|
@ -751,7 +753,7 @@ local function create_corridor_section(waypoint, axis, sign, up_or_down, up_or_d
|
|||
if place_cobwebs then
|
||||
Cube(p, size, {name=tsm_railcorridors.nodes.cobweb}, true)
|
||||
end
|
||||
tsm_railcorridors.on_construct_spawner(p)
|
||||
tsm_railcorridors.on_construct_spawner(p, pr_spawner)
|
||||
no_spawner = true
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue