From 9cbe89fc5c1c51498c0c82c7dfcc0634bd09831c Mon Sep 17 00:00:00 2001 From: Kiritow <1362050620@qq.com> Date: Mon, 12 Mar 2018 17:02:06 +0800 Subject: [PATCH] Try to fix debug call errors --- world.lua | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/world.lua b/world.lua index 8ae9dae..20dae73 100644 --- a/world.lua +++ b/world.lua @@ -14,20 +14,21 @@ function CopyArea(ax,ay,az,bx,by,bz) if(az>bz) then az,bz=bz,az end local total=(bx-ax+1)*(by-ay+1)*(bz-az+1) local cnt=0 + local world=debugcard.getWorld() for x=ax,bx,1 do for y=ay,by,1 do for z=az,bz,1 do cnt=cnt+1 print("Adding Block (" .. x .. "," .. y .. "," .. z .. ") " .. cnt .. " of " .. total .. " [" .. cnt*100/total .. "%]") - if(not debugcard.getWorld().isLoaded(x,y,z)) then + if(not world.isLoaded(x,y,z)) then error("Block (" .. x .. "," .. y .. "," .. z .. ") is not loaded.") end local t={} - t.x=x - t.y=y - t.z=z - t.id=debugcard.getWorld().getBlockId(x,y,z) - t.meta=debugcard.getWorld().getMetadata(x,y,z) + t.x=x-ax + t.y=y-ay + t.z=z-az + t.id=world.getBlockId(x,y,z) + t.meta=world.getMetadata(x,y,z) table.insert(box,t) end end @@ -40,7 +41,7 @@ function PasteArea(box,ax,ay,az) local world=debugcard.getWorld() for k,v in ipairs(box) do print("Pasting to (" .. ax+v.x .. "," .. ay+v.y .. "," .. az+v.z .. ")") - world.setBlock(ax+v.x,ay+v.y,az+v.z,v.meta) + world.setBlock(ax+v.x,ay+v.y,az+v.z,v.id,v.meta) cnt=cnt+1 end return cnt