Cuberite Forum
Moving blocks - Printable Version

+- Cuberite Forum (https://forum.cuberite.org)
+-- Forum: Plugins (https://forum.cuberite.org/forum-1.html)
+--- Forum: Plugin Discussion (https://forum.cuberite.org/forum-8.html)
+--- Thread: Moving blocks (/thread-559.html)

Pages: 1 2 3


Moving blocks - Taugeshtu - 09-08-2012

Al right, I admit, this is a bit crazy idea, but bare with me:

What if we sent a client a packet, that tells it that some particular block is moved by a piston? And (magic) there isn't, and never was any piston. At all.
I assume (after short digging through MCS source), that this is possible. My serach led me to "cProtocol125::SendBlockAction" all the way from "cPiston::ExtendPiston". cPiston class uses "cWorld::BroadcastBlockAction" to perform such an action.
But it's now Lua-exported, and I assume there is quite good reason for it Smile

Question is: could we have some function in lua to move blocks without pistons? ^_^ That would be... awesome.


RE: Moving blocks - xoft - 09-08-2012

Though I'm not sure what it would do client-side, I don't quite follow what you're trying to achieve. All that the SendBlockAction should be doing is the animation; the actual block placement is handled via normal BlockChange packets. So why not simply use cWorld:SetBlock() ?


RE: Moving blocks - NiLSPACE - 09-08-2012

i think he wants to have the animation when the blocks are moving Smile


RE: Moving blocks - Taugeshtu - 09-08-2012

Quote:i think he wants to have the animation when the blocks are moving
Exactly. Think about moving elevators. FAST moving elevators (since there won't be piston retract delay and other inch-worm issues). Fast and silent. Any type of cabin. That's goddamn awesome! We could even make trains out of blocks Smile


RE: Moving blocks - FakeTruth - 09-09-2012

Doesn't that action only apply to pistons? I mean you tell a piston to push, and then the block next to the piston will be pushed instead of move out of its own


RE: Moving blocks - Taugeshtu - 09-09-2012

Quote:Doesn't that action only apply to pistons?
Yeah, looks so. Still, we could fake piston existance, could we?


RE: Moving blocks - xoft - 09-09-2012

Dunno, the "Block Action" packet has the BlockID - if we send a piston block ID, would it fake a piston?

If not, how about faking it through tile entities, like falling sand and gravel do? Convert the block into a tile entity, move that entity smoothly across, then convert it back into a block.


RE: Moving blocks - Taugeshtu - 09-09-2012

Quote:Convert the block into a tile entity, move that entity smoothly across, then convert it back into a block.
I'm not sure if any block could be recognized as tile entity. Inside server - yes, inside client - ????

Would anyone mind writing a generic "FakePiston()" lua function that will do exactly the same, what real piston does? (I'm talking about duplicated code right now so we could easily remove in then... Only for test purpose)


RE: Moving blocks - Taugeshtu - 01-03-2014

I'm bringing this matter up once again.
(after touching some low-level-ish concepts (by my standarts) in lua I feel a bit too restricted by careful and cautious MCS APIBig Grin)

Is there a reason why cWorld::BroadcastBlockAction isn't exported? Like real one, "it will all break down" kind of reason?
I can see BroadcastSoundEffect and BroadcastSoundParticleEffect here, so why won't we make BlockAction broadcastable as well?

Tried to look up TileEntities in the API, had no luck. Are they even exported or something?


RE: Moving blocks - xoft - 01-03-2014

I think the only reason is that no-one had the need to export it.

TileEntities are called BlockEntities in MCS, you'd find them if you looked up cChestEntity, for example - it inherits from cBlockEntityWithItems which in turn inherits from cBlockEntity.