-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathend_platform_generation.lua
More file actions
40 lines (39 loc) · 1.21 KB
/
end_platform_generation.lua
File metadata and controls
40 lines (39 loc) · 1.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
---@param Entity cEntity
---@param World cWorld
function GenerateEndPlatformOnEntityChangingWorld(Entity, World)
local SpawnPos = World:GetSpawnPos()
local hasBeenGenerated = SpawnPos:EqualsEps(Vector3i(100,50,0),0.001)
if not hasBeenGenerated then
World:SetSpawn(100,50,0)
end
if World:GetDimension() ~= dimEnd then
return
end
World:ChunkStay(
{{6,0},{6,-1}},nil,
function ()
for x = 98, 102 do
for y = 49, 51 do
for z = -2, 2 do
if hasBeenGenerated then
World:DropBlockAsPickups(Vector3i(x,y,z))
else
World:SetBlock(Vector3i(x,y,z),0,0)
end
end
end
end
for x = 98, 102 do
for z = -2, 2 do
if World:GetBlock(Vector3i(x,48,z)) ~= E_BLOCK_OBSIDIAN then
if hasBeenGenerated then
World:DropBlockAsPickups(Vector3i(x,y,48))
end
World:SetBlock(Vector3i(x,48,z),E_BLOCK_OBSIDIAN,0)
end
end
end
Entity:TeleportToCoords(100.5,50,0.5)
end
)
end