Cuberite Forum
Single block data storage - Printable Version

+- Cuberite Forum (https://forum.cuberite.org)
+-- Forum: Cuberite (https://forum.cuberite.org/forum-4.html)
+--- Forum: Development (https://forum.cuberite.org/forum-13.html)
+--- Thread: Single block data storage (/thread-528.html)

Pages: 1 2


Single block data storage - l0udPL - 08-11-2012

Hello. I'm trying to implement decent support for note blocks and have a problem with storage of current pitch. I see that block meta data is trimmed to only 4 bits, which don't allow me to store the full range of possibilities=25.
Is there any other place to store that number?


RE: Single block data storage - xoft - 08-11-2012

Vanilla minecraft has to do it somehow, so the best place is to look at the minecraftwiki.net:
http://www.minecraftwiki.net/wiki/Data_values
From there, you can see that note blocks are tile entities (in MCServer terminology, cBlockEntity class descendants), somewhat like chests and furnaces.
http://www.minecraftwiki.net/wiki/Tile_entity
And finally, the storage:
http://www.minecraftwiki.net/wiki/Chunk_format#Tile_Entity_Format


RE: Single block data storage - l0udPL - 08-13-2012

Trying to figure out how entities works I noticed that signs does not work at all (after reconnect they just disappear going back to inventory which is weird).
Are they on todo list, or we have some regression here? (judging from the amount of related code it's rather second option...)


RE: Single block data storage - NiLSPACE - 08-13-2012

did you have the scheme in the world.ini to Anvil? if not do that i think that wil fix the problem.


RE: Single block data storage - l0udPL - 08-13-2012

Nope, it's default. It may help, thanks. But it's still weird to me especially when I can see sign-handling code in WSSCompat... And default storage should be best in the terms of compatibility...


RE: Single block data storage - NiLSPACE - 08-14-2012

did it work?


RE: Single block data storage - l0udPL - 08-27-2012

Well I came back from holidays and finally finished this:
https://dl.dropbox.com/u/29021761/notes.diff

However:
- makefile needs to be updated, unfortunately I don't know how to do that by myself (is there some kind of script, maybe?)
- note blocks are not connected to redstone (yet) Sad
- I completed signs storage in anvil (only 1 line loaded, someone was sleepy I think Smile)


RE: Single block data storage - xoft - 08-27-2012

Committed as rev 793. Thanks.

We decided to drop the old makefile some time ago; it was woefully defunct anyway, so I deleted it from svn completely prior to comitting your patch.

And Anvil - not sleepy, I think, but in a haste to get it working altogether, so I guess I left that out "for later", and never came back to finish it. Weird that no-one noticed, though.
Also, we currently use VC2008, so the VC2010 project file gets a bit behind from time to time. There is a consensus to remove VC2010 project files altogether, since people with 2010 can open the 2008 project, and most of us do development on 2008 anyway (it's much much much faster Smile


RE: Single block data storage - Lapayo - 08-29-2012

Hey,
thanks for the patch, l0udPL.

But I think we have to work on the Entity system. It´s very ugly that we have to hardcode every entity in that many places. (For full compatibility we need to add much more entities)

Wouldn´t it be much cleaner to somehow merge cBlockEntity and cBlockEntityHandler?

The only problem would be the storage at the runtime. (Although it is no problem to create multiple instances of a blockhandler)


RE: Single block data storage - l0udPL - 08-29-2012

Lapayo, I was thinking about the same thing, unfortunately I'm not familiar enough with this code to make such a big changes.
Anyway, storage should be pretty easy to standardize if we assume that every cBlockEntity - cBlockEntityHandler hybrid must have handlers to reading/writing in Anvil and [default thing]. The current solution is weird - we have json-related methods to [default thing] but Anvil does everything independently...

xoft, is there any easy way to get the block entity having world handler and block coordinates? Maybe I'm blind but I cannot find anything to use in 1 line...