Single block data storage
#1
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?
Reply
Thanks given by:
#2
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_...ity_Format
Reply
Thanks given by:
#3
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...)
Reply
Thanks given by:
#4
did you have the scheme in the world.ini to Anvil? if not do that i think that wil fix the problem.
Reply
Thanks given by:
#5
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...
Reply
Thanks given by:
#6
did it work?
Reply
Thanks given by:
#7
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)
Reply
Thanks given by: xoft
#8
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
Reply
Thanks given by:
#9
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)
Reply
Thanks given by:
#10
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...
Reply
Thanks given by:




Users browsing this thread: 1 Guest(s)