2

Once again, I'm up to something advanced: In my map, I want to include a fast travelling system. Since the distance between warp points will likely be larger than the render distance (thus setting any blocks next to one warp point with a command launched at another loading point won't work because all out-of-render-distance blocks are "outside of the world"), I thought a book with JSON-formatted text that warps you around is most likely to work.

The problem is that, as in a typical fast travelling system, players shall only be able to warp to warp points they already visited. That means, when a player reaches a warp point, that player should be able to perform some action that adds in the JSON-formatted text in his/her book dynamically. That wouldn't be a problem, if it weren't for the existing text in the book...

I decided to dedicate a whole page for each warp point, mainly because I thought pages should be easier to keep separate. If someone has a solution that only works on a smaller scope for whatever reason, feel free to post that too. Basically, what I need to do is add new text (with click event) to a written book, without overwriting the text that's already there.

I know I could restrict where the players can go, so that I know in advance what text the book already has. That would be against the concept of the map though, because it's meant to be 100% nonlinear (which is why I want a fast travelling system in first place). The option to call different commands based on what content the book already has also came to my mind, but was quickly rejected because I would need to go through every possible combination of active and inactive pages, so the contraptions would grow exponentially with the number of warp points. Separate books for each warp point would be somewhat of an option, but it's only a last resort because it obviously takes up lots of inventory space.

I would prefer the solution to be compatible with 1.8, but if there's really no way without walking into above flaws, I can also resort to a later version. Mods are OK (preferably Forge compatible) as long as the map is playable in Vanilla afterwards.

  • 1. Why 1.8? 2. How many points are there? If it's a one digit number, it would be feasible to have one command per combination. – Fabian Röling Feb 25 '18 at 17:35
  • 3. A written book has indeed one NBT tag per page. The text in it is JSON and would be harder to make modular (if it's even possible). Does [this] (minecraft.gamepedia.com/Player.dat_format#Item_structure) help you? – Fabian Röling Feb 25 '18 at 17:40
  • I know it doesn't answer your question, but just to note it, command blocks can be placed within the spawn chunks and remain loaded at all times no matter where the player is in the world. – IronAnvil Feb 25 '18 at 21:43
  • @Fabian Regarding 1: I still think the cooldown system is (while good for PvP) simply in the way when making adventure maps, and I don't feel much like having to give myself an Attack Speed 50 sword every time I need to get rid of a swarm of bats. Plus, I can imagine many scenarios where offhand would be OP, or in other words, it can mean TONS of extra testing load to make sure it doesn't break anything. – Egor Hans Feb 26 '18 at 9:59
  • And what about 2 and 3? – Fabian Röling Feb 26 '18 at 11:23
0

You can not add pages. You can not add data to a specific element within the data tag with either of the data modifier commands.

A short quote from the dataTag section of both the blockdata and entitydata commands on the command wiki:

Specifies the data tag elements to be added to, or overwrite elements of

If you specify an element that is already in the data tag, it overwrites existing data.


You could use scoreboard tags as you can add/remove tags for each point in a nonlinear way without overwriting the existing tags.

The downside is having a book filled with clickEvents, some of which won't work until the player has the appropriate tag.

  • In 1.13 you should be able to edit single pages, right? Because you can write in a specific index of an array. – Fabian Röling Feb 27 '18 at 6:23
  • @Fabian I am not up to date on all the 1.13 stuff yet. I see the data command has a merge option so possibly. I was hoping the command would allow modification of player inventory data but the 1.13 wiki says that still isn't possible. – IronAnvil Feb 27 '18 at 17:23
  • That's an interesting approach actually, since with plain old scoreboards it's even 1.8 compatible. The true downside, by the way, is that it's impossible to also add the regional information dynamically. – Egor Hans Mar 13 '18 at 14:54
  • On a side note, if I ever happen to implement MCNeo (a very intricated Minecraft mod of sorts that completely redesigns multiple aspects, e.g. it makes the complete world gen run on Customized and overhauls structure generation to work similar to Ruins), it will also include conditional formatting. That would be enough to address the regional information issue by obfuscating everything where the scoreboard tag doesn't exist for the holding player. – Egor Hans Jun 27 '18 at 11:12
0

One option that came to my mind and that I'd like to mention (even though I'll go for scoreboards probably), is filling multiple books into a dedicated shulker box. Shulker boxes effectively expand the inventory, which allows for placing anything inside them. If you want to prevent the player from using the extra inventory space otherwise, you could constantly fill all slots of the shulker box that aren't marked to contain books (most efficiently by using scoreboard tags as described) with some rubbish items, and all those who do contain books with the respective book. Actually allows for exposing regional information dynamically along with the warps, and also easily makes unlockable items work.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.