[SPIGOT-3664] Non-deprecated method to get block id in chunksnapshot Created: 25/Nov/17 Updated: 06/Dec/17 Resolved: 06/Dec/17 |
|
Status: | Resolved |
Project: | Spigot |
Component/s: | None |
Affects Version/s: | None |
Fix Version/s: | None |
Type: | New Feature | Priority: | Minor |
Reporter: | Martin Olofsson | Assignee: | Unassigned |
Resolution: | Fixed | Votes: | 1 |
Labels: | None | ||
Environment: |
Latest version of Spigot |
Description |
ChunkSnapshot does not have a method that returns Material of a Block in the chunk. It does have getBlockTypeId(x, y, z) but is deprecated. |
Comments |
Comment by Martin Olofsson [ 06/Dec/17 ] |
I'm using ChunkSnapshot for looping over all blocks in a chunk, async. This would be dangerous to do with a Chunk object, right? Yes, Material only would be sufficient. I'm using Material.getMaterial(chunk.getBlockTypeId(x, y, z)) right now, but since it's going to be removed in 1.13 it would be great with a Material method. Thank you! |
Comment by md_5 [ 06/Dec/17 ] |
The root of this is that chunk snapshot was originally designed for tools such as Dynmap that require a very very fast access to the underlying chunk data. We could probably get away with adding a Material method and it won't be too slow, but MaterialData would probably have to wait till 1.13 https://www.spigotmc.org/threads/minecraft-1-13-what-to-expect.288714/
Is a Material only method sufficient for your purposes?
|
Comment by Martin Olofsson [ 27/Nov/17 ] |
Not even the getBlockTypeId(x, y, z) method does work. I've tried placing a block in a chunk and then catch the ChunkSnapshot of it and loop through all blocks in the chunk with setting a boolean to true if it finds the block - returns false. |
Comment by Martin Olofsson [ 25/Nov/17 ] |
Doesn't seem like I can change the issue. The version however is git-Spigot-3d850ec-f46ccd7 (1.12.2-R0.1-SNAPSHOT). |
Comment by Phoenix616 [ 25/Nov/17 ] |
There is also no way to get the data in a non-numeric way. With 1.13 and the flattening coming up this should be changed. The CraftChunkSnapshot implementation seems to still store numeric ids and data values instead of the Material enum and MaterialDatas (I guess for speed purposes? not sure) PS.: You should really set that the type as a new feature, add some more info to the title and add a version. "Latest" is not really clear |