Playing with cSignEntities
#1
Hello there!

Currently, I'm attempting to move a sign in MCServer. I can move the sign block well enough, but the text is stored in a cSignEntity. Looking at the class,

http://mc-server.xoft.cz/doxy/html/de/d3d/a00409.html

I'm not sure how MCServer's housekeeping deals with the creation and removal of cSignEntities. Nor am I sure how to access one using a cBlockSignHandler

For reference, I'm trying to do with in cBlockSignHandler's MetaRotate and MetaMirror functions. I'm pretty sure I can't do what I want, but I'd like to know more about how cSignEntity (and similar objects) work.
Reply
Thanks given by:
#2
All the block entities are managed by the cChunk class, and access to them is more or less forbidden, due to multithreading issues. You can only manipulate them from the outside by using cWorld's DoWithBlockEntityAt and the specialized similar functions.
Reply
Thanks given by:
#3
(04-04-2014, 01:31 AM)xoft Wrote: All the block entities are managed by the cChunk class, and access to them is more or less forbidden, due to multithreading issues. You can only manipulate them from the outside by using cWorld's DoWithBlockEntityAt and the specialized similar functions.

Hm, so then I suppose I can't play with the text on a sign from cBlockSignHandler.

In fact, I suppose I couldn't do much with MobHeads either.
Reply
Thanks given by:
#4
Why not? All you need is a cWorld pointer, then you can manipulate any sign within the loaded chunks, using the cWorld::DoWithBlockEntityAt() function (if you need, you can write a specific DoWithSignEntityAt() function; although it'd be nice to somehow templatize this piece of code to avoid copy-pasting it to new functions).
Reply
Thanks given by:
#5
(04-05-2014, 12:41 AM)xoft Wrote: Why not? All you need is a cWorld pointer, then you can manipulate any sign within the loaded chunks, using the cWorld::DoWithBlockEntityAt() function (if you need, you can write a specific DoWithSignEntityAt() function; although it'd be nice to somehow templatize this piece of code to avoid copy-pasting it to new functions).

Well, I'm trying to fix up the MetaRotate and MetaMirror Functions for cBlockSignHandler and I don't think I can get any cWorld pointers into that function without rewriting the declarations and calls of all the MetaRotate and MetaMirror Functions. These functions are virtual member functions of cBlockHandler and only take a particular metadata as a parameter.
Reply
Thanks given by:
#6
I don't see what sign rotation has in common with the sign text. The text doesn't take part in the rotation and rotating the sign doesn't change the text.

If you're referring to cBlockArea's inability to remember sign areas, that is a completely different issue. cBlockArea needs to get aware of block entities altogether, somehow.
Reply
Thanks given by:
#7
(04-06-2014, 06:07 AM)xoft Wrote: I don't see what sign rotation has in common with the sign text. The text doesn't take part in the rotation and rotating the sign doesn't change the text.

If you're referring to cBlockArea's inability to remember sign areas, that is a completely different issue. cBlockArea needs to get aware of block entities altogether, somehow.

So I need to change cBlockArea then? Is that a reasonable project?
Reply
Thanks given by:
#8
It is rather deep, it will most probably require changing quite a bit of BlockEntities' internals (since they assume they are always owned by a cWorld, which won't be the case here; and you need them to be able to duplicate themselves).
Reply
Thanks given by:




Users browsing this thread: 4 Guest(s)