Cuberite Forum
VoidGenerator (obsolete) - Printable Version

+- Cuberite Forum (https://forum.cuberite.org)
+-- Forum: Plugins (https://forum.cuberite.org/forum-1.html)
+--- Forum: Plugin Releases (https://forum.cuberite.org/forum-2.html)
+---- Forum: Archived Plugins (https://forum.cuberite.org/forum-18.html)
+---- Thread: VoidGenerator (obsolete) (/thread-1868.html)



VoidGenerator (obsolete) - DiamondToaster - 04-11-2015

OBSOLETE! The User's Manual contains information about creating an empty world: https://book.cuberite.org/#3.7

Ever wanted to generate a completely empty world?  No?  Well, I don't care!  I made a void generator anyways!

https://github.com/DevToaster/VoidGenerator

How to use:
In the plugin folder, create a file named "worlds.ini" (Also generates on first use)
Create a line called "[Worlds]" (no quotes) if it does not exist.
under [Worlds], type "world1=InsertNameOfWorldHere".  The next world will be put under "world2", and so on.

Example:

[Worlds]
world1=VoidWorld
world2=FloatingBuildings
world3=MoreStuff


RE: VoidGenerator - Aberts10 - 09-18-2015

(04-11-2015, 10:56 AM)DiamondToaster Wrote: Ever wanted to generate a completely empty world? No? Well, I don't care! I made a void generator anyways!

https://github.com/DevToaster/VoidGenerator

How to use:
In the plugin folder, create a file named "worlds.ini" (Also generates on first use)
Create a line called "[Worlds]" (no quotes) if it does not exist.
under [Worlds], type "world1=InsertNameOfWorldHere". The next world will be put under "world2", and so on.

Example:

[Worlds]
world1=VoidWorld
world2=FloatingBuildings
world3=MoreStuff

Does it have a floating starting block?


RE: VoidGenerator - DiamondToaster - 09-18-2015

Nope. You gotta use WorldEdit and the command "/up 0" to create a block where you're standing to start building.


RE: VoidGenerator - NiLSPACE - 09-23-2015

That should be pretty easy to add though. Something like this should work:
function OnChunkGenerating(World, ChunkX, ChunkZ, ChunkDesc)
	-- Other code
	
	local ChunkSpawnX, ChunkSpawnZ = math.floor(World:GetSpawnX() / 16), math.floor(World:GetSpawnZ())
	if ((ChunkSpawnX == ChunkX) and (ChunkSpawnZ == ChunkZ)) then
		FillRelCuboid(0, 15, 8, 8, 0, 15, E_BLOCK_STONE, 0)
	end
end

This will create a floor of stone blocks on the spawn chunks at layer 8. Smile


RE: VoidGenerator - DiamondToaster - 09-24-2015

Unfortunately, when you spawn/do a /portal into the void world, there's no guarantee that you'll end up at spawn and may just fall. I'm not really sure on what to do with that. :/


RE: VoidGenerator - Seadragon91 - 09-24-2015

(09-24-2015, 05:54 AM)DiamondToaster Wrote: Unfortunately, when you spawn/do a /portal into the void world, there's no guarantee that you'll end up at spawn and may just fall. I'm not really sure on what to do with that. :/

I guess that the chunk is not loaded. Try cWorld:ChunkStay (look in the api-docs), with that the chunk will be loaded. Had that problem in my skyblock plugin and with that I was able to fix that.


RE: VoidGenerator - xoft - 09-24-2015

The plugin could check (I think OnPlayerSpawn is called each time the player changes worlds) and if the player is above in a block a column that is entirely empty, it could teleport them to spawn. This way players won't end up dying, yet they can portal into the world after they have built something there.


RE: VoidGenerator - DrMasik - 09-24-2015

Before player spawn you must:
1. Get SpawnX
2. Get SpawnZ
3. Load chunk.
4. Detect (get) free height (SpawnY) bloks for spawn player.
5. Teleport player to SpawnX, SpawnY, SpawnZ.
Sample code:

-- ...
    -- Get world default spawn point
    local world = cRoot:Get():GetWorld("world2");
    local SpawnX = world:GetSpawnX();
    local SpawnZ = world:GetSpawnZ();

    -- Get player last bed position
    local PlayerX = (-8);
    local PlayerZ = 3;

    local OnAllChunksAvailable = function()
      console_log(func_name .." -> chunks redy for player ID ".. a_player:GetUniqueID(), 1);
      a_player:MoveToWorld("world2");
      local ret1, SpawnY = obj_world:TryGetHeight(SpawnX, SpawnZ);
      a_player:TeleportToCoords(SpawnX, SpawnY , SpawnZ);
      a_player:SetGameMode(1);
    end

    world:ChunkStay({{PlayerX, PlayerZ}, {SpawnX, SpawnZ}}, OnChunkAvailable, OnAllChunksAvailable);

-- ...