From b55afc940b4a95ac0191cc24a40c5c3824ab2f0f Mon Sep 17 00:00:00 2001 From: "madmaxoft@gmail.com" Date: Fri, 8 Feb 2013 20:57:42 +0000 Subject: cChunkDesc can now read and write cBlockAreas. A simple example is provided in the Debuggers plugin. git-svn-id: http://mc-server.googlecode.com/svn/trunk@1201 0a769ca7-a7f5-676a-18bf-c427514a06d6 --- MCServer/Plugins/Debuggers/Debuggers.lua | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) (limited to 'MCServer/Plugins') diff --git a/MCServer/Plugins/Debuggers/Debuggers.lua b/MCServer/Plugins/Debuggers/Debuggers.lua index 04f7af3c9..ae639f6a6 100644 --- a/MCServer/Plugins/Debuggers/Debuggers.lua +++ b/MCServer/Plugins/Debuggers/Debuggers.lua @@ -14,8 +14,9 @@ function Initialize(Plugin) Plugin:SetVersion(1) PluginManager = cRoot:Get():GetPluginManager() - PluginManager:AddHook(Plugin, cPluginManager.HOOK_PLAYER_USING_ITEM) - PluginManager:AddHook(Plugin, cPluginManager.HOOK_TAKE_DAMAGE) + PluginManager:AddHook(Plugin, cPluginManager.HOOK_PLAYER_USING_ITEM); + PluginManager:AddHook(Plugin, cPluginManager.HOOK_TAKE_DAMAGE); + PluginManager:AddHook(Plugin, cPluginManager.HOOK_CHUNK_GENERATED); LOG("Initialized " .. Plugin:GetName() .. " v." .. Plugin:GetVersion()) @@ -186,3 +187,18 @@ end + + +function OnChunkGenerated(World, ChunkX, ChunkZ, ChunkDesc) + -- Test ChunkDesc / BlockArea interaction + local BlockArea = cBlockArea(); + ChunkDesc:ReadBlockArea(BlockArea, 0, 15, 50, 70, 0, 15); + BlockArea:SaveToSchematicFile("ChunkBlocks_" .. ChunkX .. "_" .. ChunkZ .. ".schematic"); + + ChunkDesc:WriteBlockArea(BlockArea, 5, 115, 5); + return false; +end + + + + -- cgit v1.2.3