Complex Code for moving entire blocks including all related tileentities


#1

I’m in the middle of porting Movecraft to Sponge and I need to be able to move blocks including tileentities which I believe includes inventory and any ongoing redstone pulses?

I don’t know how I should be doing it. Would BlockSnapshot get all of that? and if it does how should I be using that information?


#2

Hey. Im the developer of Ships so I went through a lot of what you are going through.

The way I did it was getting the BlockSnapshot and then moved the snapshot’s location. So to answer your question. Yes.

Feel free to look at Ships code and/or ask me any questions


#3

So can your plugin move a repeater that’s got say 2 ticks of redstone pulse in it and it will still pulse for 2 ticks after being moved?

Also, as a note. Perhaps we could work together to create a plugin instead of making two similar plugins?


#4

To be honest i have not tested the outcome of that, but probably (assuming that the slightly changed priority system in the Ships for Sponge works for redstone based components).

And I am the owner of the Ships for Bukkit to, so i would rather port a “direct” (Sponge edition has more features) of my own plugin tbh.

Thats not to say I cannot help on the port of movecraft if you want help programming it


#5

From what I can gather about this issue from the Spigot Dev of Movecraft is that when you move the tileentity you have to update the global list of tileentities?

In regards to doing two separate plugins. That’s fine. I can understand why you would want that and thanks for offering to help.


#6

If you do the storing of BlockSnapshot and restore them. You dont need to update the tile entity at all. Just run the restore function and then its done.

Hold on ill get a github link of how I do it in Ships.

P.s i know it doesnt use java naming convention. I am going through the whole of Ships for both sponge and bukkit changing the names to best suit.

The sponge version was a direct copy of the bukkit version with the functions changed.


#7

@MoseMister Hey. So I decided to test your Ships plugin to see if your BlockSnapshot method works.
Unfortunately I didn’t actually get to test the redstone as it disappeared as soon as I moved the ship.


#8

That means ny protocol for moving attachables isnt correct yet. I have been busy so i havent been able to work on it, but i have been aware of it thanks to someone pointing out carpet