Jump to content

Recommended Posts

Posted

Hi!

 

I just started making my first really big mod (already got blocks, items, really scary textures...) but now 2 problems turned up.

I want to "teleport" a selected part of the world (+all entities+player) to other coordinates and dimension(passed as arguments).

 

In order to do so i first need to mark a part of the world.(either by marking every block/mob/player that touches the main controlling block/a block that touches the main controlling bock... or by simply selecting a sphere)

Then i would have to move every selected block to the new location. Since im pretty that there is no "move" command(is there?) i think that it would be the best to copy it to the new location, delete the old blocks and finally to teleport the players. (is there any simple way to create a schematic file ingame?)

 

 

Can someone link me an example or a tutorial? would be really great if you could help me :D

thx in advance, Jacky2611

 

Ps: Im to 99.99% sure that this is the wrong section... :( pls move this topic

Here could be your advertisement!

Posted

I have written a couple of mods that do pretty much what you're asking (both teleportation and volume manipulation). However, the approach I'm taking is more like 3D copy & paste. But others have pointed out that I'm doing both character and matter teleportation in a sense. I also provide a way to archive an arbitrary volume as a JSON file that you can reload later, perhaps into another world.

 

My approach to copying is to define a boundary cuboid, and copy all of the blocks I find in that cuboid into an internal representation. I use JSON serialization to save, and deserialization to load. To save the contents of chests, etc. you have to serialize the contents of TileEntity objects. Generalizing to a sphere is certainly doable, but a cuboid is usually good enough.

Posted

I have written a couple of mods that do pretty much what you're asking (both teleportation and volume manipulation). However, the approach I'm taking is more like 3D copy & paste. But others have pointed out that I'm doing both character and matter teleportation in a sense. I also provide a way to archive an arbitrary volume as a JSON file that you can reload later, perhaps into another world.

 

My approach to copying is to define a boundary cuboid, and copy all of the blocks I find in that cuboid into an internal representation. I use JSON serialization to save, and deserialization to load. To save the contents of chests, etc. you have to serialize the contents of TileEntity objects. Generalizing to a sphere is certainly doable, but a cuboid is usually good enough.

 

Yeah thx, this is exactly what i want for the beginning.

 

Can u link me a tutorial/example/documentation to learn from?

I never die something linke this before.

Next step would be to get only blocks that are somehow connected to my main Block. Any idea how to do this?

Here could be your advertisement!

  • 4 weeks later...
Posted

Wow.

I missed this thread.

Only a week after you started it, look at what I did:

 

http://binarymage.com/forum/viewtopic.php?f=10&t=1882

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Posted

lol...

I managed it with a lot of help from the_clyde to copy metadata and entities.

How do you move the blocks? can u think of somezhing thats faster than a simple get block and set block loop? (Speeded it up by using a thread and a 1ms pause after every block, but it still takes a few seconds until everything is moved.)

Here could be your advertisement!

Posted

I sliced across time.  Rather than using a loop, I had a variable that incremented every time the entity got an update, and that was the Z value (or X or Y, depending on how you want to do it) for that time slice.

 

Essentially, first I'd read, taking an approximated "height" of the landscape (so looking for known-natural blocks like dirt, stone, and sand).  Next I'd wait for player input for the destination (actually, a direction to look, whereupon it would scan farther and farther away looking for a valid place to plop things down; ie. above water), then I'd scan the destination for landscape height (the same way), then the blending on those two matricies, then I'd place the old blocks in the new location, then I'd go back and delete the old blocks.  Last, I attempted to teleport non-block entities.

 

It wasn't perfect though.  Due to the fact that I couldn't build bottom up (the place-blocks to achieve desired landscape in the blended areas only had a height value and stopped placing blocks by going down on Y until a stop condition) and that my time slices were across Z, it had trouble placing torches (and other can-stay-here blocks like rails), gravity effected blocks (top down, remember?), and pistons.  If the piston head was copied/deleted before the base I wouldn't get a base.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Posted

Have you managed to teleport doors (my function only teleports 50% the rest is dropped 3-4x) and torches?

And how do you teleport entities? Do they keep their effects (potions...)?

Here could be your advertisement!

Posted

You guys might be interested in taking a look at my Structure Generation API; not exactly the same, but I faced a lot of similar issues such as placing torches, pistons, etc., which I solved by storing them separately and placing them after the rest of the blocks were finished.

 

I was using static arrays, but it would work just the same if you build an array out of the blocks you were going to move, whether a two-dimensional array only for a line of blocks at a time (one array index for the blocks data: id and meta, at the very least), or you could fool around with 4-dimensional arrays like I did ;P

Posted

Torches, doors, pistons all tended to fail more often than not.

 

As for entities, there's a function something along the lines of setPositionAndUpdate.

 

Given that I was just doing it because I could, I didn't care if it failed in some situations.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Posted

You guys might be interested in taking a look at my Structure Generation API; not exactly the same, but I faced a lot of similar issues such as placing torches, pistons, etc., which I solved by storing them separately and placing them after the rest of the blocks were finished.

 

I was using static arrays, but it would work just the same if you build an array out of the blocks you were going to move, whether a two-dimensional array only for a line of blocks at a time (one array index for the blocks data: id and meta, at the very least), or you could fool around with 4-dimensional arrays like I did ;P

 

so you checked for isOpaqueBlock and placed pistons, toches... after normal blocks? Should have came up with this on my own...

Here could be your advertisement!

Posted

Random question:

Does your structure API handle sand held up by torches?

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Posted

You know, I've never tried that, but it should be able to. I use flag 2 when setting blocks so it doesn't update neighbors, meaning the sand should not fall. I've placed torches hanging in mid-air this way.

 

I used Flag 2 as well, but that didn't stop doors and pistons from breaking. :P

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Posted

My doors and pistons work just fine; it's not an issue of flag 2 for those, it's an issue of when you place them. Doors, for instance, will break if there isn't a block underneath them, so you have to place the lower layers first. As for pistons, you can place the base first, then after it's placed, you have to manually set the metadata once again to get the correct rotation / head state. Same goes for any block that auto-sets metadata when placed; e.g. chests and the like.

 

EDIT: Actually, for piston heads, I set those as a separate block and then, like the base, manually set the metadata after it's placed. That's only necessary if you want it extended right away without needing a redstone update.

Posted
EDIT: Actually, for piston heads, I set those as a separate block and then, like the base, manually set the metadata after it's placed. That's only necessary if you want it extended right away without needing a redstone update.

 

Yes, but if you set the piston head to air before you've copied the base, the base won't get copied (it drops).  Flag 2 be damned.

 

Rails are also a bitch to copy, but I think doing them during a second pass would be sufficient.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Posted

Yes, but if you set the piston head to air before you've copied the base, the base won't get copied (it drops).  Flag 2 be damned.

 

Rails are also a bitch to copy, but I think doing them during a second pass would be sufficient.

Rails I just set the metadata manually on a second pass; I store all such blocks in a temporary array of BlockData objects (stores position, id, meta) so I can go back and fix them after all is said and done.

 

Guess I've never had to worry about the piston base dropping, as I'm usually either just setting or removing, never copying. Seems you're stuck on that one with either doing a 3rd pass (1 - copy, 2 - set, 3 - erase) or checking for those blocks as you go and, when encountered, scanning the adjacent neighboring blocks to pick up the data you need.

Posted

Probably.  I was just doing a proof of concept thing.  I didn't need the copy to be perfect, as the "concept" part was being able to blend the edges of the copy with the destination, so that it looked natural.

 

Here's the only set of screenshots I took of one such teleport.

 

width=800 height=449http://s16.postimg.org/d0vp5qjid/2014_01_24_23_09_54.png[/img]

width=800 height=449http://s23.postimg.org/q9poehyt7/2014_01_25_01_52_15.png[/img]

width=800 height=449http://s27.postimg.org/5t6vwu11f/2014_01_25_02_04_16.png[/img]

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • When I first heard about Bitcoin back in 2018, I was skeptical. The idea of a decentralized, digital currency seemed too good to be true. But I was intrigued as I learned more about the technology behind it and its potential. I started small, investing just a few hundred dollars, dipping my toes into the cryptocurrency waters. At first, it was exhilarating to watch the value of my investment grow exponentially. I felt like I was part of the future, an early adopter of this revolutionary new asset. But that euphoria was short-lived. One day, I logged into my digital wallet only to find it empty - my Bitcoin had vanished without a trace. It turned out that the online exchange I had trusted had been hacked, and my funds were stolen. I was devastated, both financially and emotionally. All the potential I had seen in Bitcoin was tainted by the harsh reality that with decentralization came a lack of regulation and oversight. My hard-earned money was gone, lost to the ether of the digital world. This experience taught me a painful lesson about the price of trust in the uncharted territory of cryptocurrency. While the technology holds incredible promise, the risks can be catastrophic if you don't approach it with extreme caution. My Bitcoin investment gamble had failed, and I was left to pick up the pieces, wiser but poorer for having placed my faith in the wrong hands. My sincere appreciation goes to MUYERN TRUST HACKER. You are my hero in recovering my lost funds. Send a direct m a i l ( muyerntrusted ( @ ) mail-me ( . )c o m ) or message on whats app : + 1 ( 4-4-0 ) ( 3 -3 -5 ) ( 0-2-0-5 )
    • You could try posting a log (if there is no log at all, it may be the launcher you are using, the FAQ may have info on how to enable the log) as described in the FAQ, however this will probably need to be reported to/remedied by the mod author.
    • So me and a couple of friends are playing with a shitpost mod pack and one of the mods in the pack is corail tombstone and for some reason there is a problem with it, where on death to fire the player will get kicked out of the server and the tombstone will not spawn basically deleting an entire inventory, it doesn't matter what type of fire it is, whether it's from vanilla fire/lava, or from modded fire like ice&fire/lycanites and it's common enough to where everyone on the server has experienced at least once or twice and it doesn't give any crash log. a solution to this would be much appreciated thank you!
    • It is 1.12.2 - I have no idea if there is a 1.12 pack
  • Topics

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.