Datapack Utils

Datapack Utils

2k Downloads

[Bug/Improvement] Last bedrock layer is removed...

arboriginal opened this issue ยท 6 comments

commented

Hi there,

I've installed the datapack right now and making tests, and seen the deeper bedrock layer is replaced by barriers...

Reading your description, I suppose you use this to detect the generation has been done here, but that's -for me- a very bad way, as I've seen breakable blocks (stone and redstone ore for example) viewable when in spec and under height 0.

This means players can break them and see a hole in the map (ok, they can't fall through it but anyway... this is not really clean).

Maybe you should use NBT or similar things to flag generated chunks, or only generate in new chunks (if datapacks can detect if chunk is new).

commented

To illustrate:
(a glowstone block has been manually added around to light the area)

  1. In spectator mode, under height 0

  1. Above height 0

commented

Unfortunately there isn't a great alternative. Every other solution has a noticeable (and sometimes huge) impact on performance.
I'm also using an open source library for chunk scanning, so it would be up to that developer to change the system (I am actively working with them to improve it).

The "being able to see a hole in the map" could be fixed by forcing a layer of bedrock to fill at y=1...

commented

You mean the fact to replace last layers of bedrock by barrier is done in the library itself?
If yes... huh...

If no, I'm not sure changing a data value of a block is more consuming than replacing the block item. As said, I can be wrong because I'm not making datapacks but with Bukkit / Spigot / Paper API, there is a wrapping around NBT, letting you set metadatas, for example flag it with a custom value.

Anyway, maybe you can also do something which will improve performance by NOT changing all bedrock blocks at 0 height (or flag them all), but only do it to the one at 0,0 coords of the chunk. So if you can't do it with a tag and have to replace it by a barrier, you only alter one block per chunk (instead of 16x16=256 blocks).

commented

In datapacks you can't just change the "data value" of a block- you can altar it's NBT if it had NBT to begin with (chests, furnaces, etc), and it's block state if it has other block states. Bedrock has neither, so that only alternative is to change it's "state" by using another block (most people use barriers, but anything unbreakable would suffice). Also accessing NBT via datapack is very laggy for reasons...

Back in 1.14 I had my own chunk generation solution that only used 1 barrier every 9 chunks, but I switched to the new system to be compatible with other datapacks. (This is the other library: https://github.com/misode/ChunkScan). The new system does have slightly better passive performance (when not generating chunks).

All of this stems from the fact that datapacks can't add world gen- you have to hack it.

commented

OK, if you can't, you can't ;) That's not a big deal. Again, thanks for you time and the sharing, I'll keep an eye on your wonderful datapack and will fork it when I'll have time before using it.

commented

2.1.1 adds a layer of bedrock at y=1. While imperfect, I thin this is as good as it gets.