SkyBlock v3
Fixed a bug with generation of englisch language file, it was not generated for new installations.
Reply
Thanks given by:
Updated:
- Fixed cBlockArea:Write call
- Player was not send to island on "/skyblock play"
Reply
Thanks given by:
Reply
Thanks given by:
Any reason why you can't implement the function in the plugin itself? WorldEdit is able to do large actions on a cBlockArea, so I'm sure SkyBlock van as well.
Reply
Thanks given by:
This are the results from my skyblock plugin for a single chunk, all in milliseconds. The difference is that sykblock is mostly of air and with that I don't need let cuberite count the air blocks and this is much faster.

Function CountAllNonAirBlocksAndMetas in cBlockArea

Calc(for loop):  25
Calc(CountAllNonAirBlocksAndMetas):    1
Calc(CountSpecificBlocks):      13

Calc(for loop):  26
Calc(CountAllNonAirBlocksAndMetas):    0
Calc(CountSpecificBlocks):      14

Calc(for loop):  28
Calc(CountAllNonAirBlocksAndMetas):    1
Calc(CountSpecificBlocks):      14

Calc(for loop):  25
Calc(CountAllNonAirBlocksAndMetas):    1
Calc(CountSpecificBlocks (147 times)):      14

The reason for 147 times with CountSpecificBlocks is that I check for 147 block id / metas in the island area to calculate the points of a island area.


Tested that function in WorldEdit in a normal generated world, the amount of air blocks I can get by just subtracting the found blocks with the volume:

Changes in WorldEdit

Area Size: 101 * 234 * 100
Current: 1197 ms
New: 159 ms

Area Size: 101 * 244* 100
Current: 1253 ms
New: 185 ms

That's the results I have.
Reply
Thanks given by:
This seems to work pretty well to count all the blocks:

local BlockArea = cBlockArea()
BlockArea:Read(World, SrcCuboid, cBlockArea.baTypes + cBlockArea.baMetas)
local output = {};

for X = SrcCuboid.p1.x, SrcCuboid.p2.x do
	for Y = SrcCuboid.p1.y, SrcCuboid.p2.y do
		for Z = SrcCuboid.p1.z, SrcCuboid.p2.z do
			local blocktype, meta = BlockArea:GetBlockTypeMeta(X, Y, Z);
			local type = output[blocktype] or {};
			type[meta] = (type[meta] or 0) + 1;
			output[blocktype] = type;
		end
	end
end

for blocktype, metas in pairs(output) do
	print(blocktype);
	for meta, num in pairs(metas) do
		print("\t" .. meta .. ": " .. num);
	end
end
Reply
Thanks given by:
I have already tested something like that and it's slower than the solution where I use CountSpecificBlocks that will be called 147 times Smile
Reply
Thanks given by:
Could you try that again but with `tbCounted` as a local variable instead of global?
Reply
Thanks given by:
This variable will be cleared before the blocks are counted. There will be no change.
Reply
Thanks given by:
Global variables are saved in _G (a table) which means the tbCounted variable has to be fetched again every time in the loop. Local variables are written to a register which is much faster.
Reply
Thanks given by:




Users browsing this thread: 2 Guest(s)