Using @command to copy a written_book to new location #290


Closed
  • _ForgeUser8803250 created this issue Sep 12, 2017

    I'd like to use a written_book in a recipe and have a copy of that book, with @itemlore including the coordinates of the place the crafting was done created in a set location, ideally in a container.

     

    Previously discussed information can be found here:

    What I'm trying to do is have a player craft something with a written book and have that player receive nothing in return. Meanwhile, a copy of that book is deposited elsewhere in the world (always the same spot). I can live without it, but having the contents of the book preserved in the new location would help me tremendously.

    So far, what I have is this:

    @world world
    @cooldown 24h | failmsg Do not bother the gods with your petty wishes. Pray once a day.
    @holditem leather_helmet | slot helmet | enchant Binding_Curse
    @holditem leather_chestplate | slot chestplate | enchant Binding_Curse
    @holditem leather_leggings | slot leggings | enchant Binding_Curse
    @holditem leather_boots | slot boots | enchant Binding_Curse
    craft
    @displayresult first
    air + air + air
    air + written_book + air
    air + air + air
    = 0% written_book
    @cloneingredient all
    @itemname Prayer to The Philosopher
    = 100% written_book
    @cloneingredient all
    @itemlore X: {x} | Y: {y} | Z: {z}
    @command /summon @cloneingredient 0 80 72
    @noresult

    In context, what I'm doing is I have a server where you cannot use the debug information to see your coordinates. There are gods that you can "pray" to. "Praying" involves placing a book with what you want written on the first page into a crafting table with whichever god you are praying to's icon (haven't added that, but I know how to). I need the book to be teleported to a storage location so that the admin that's playing the part of the god can look over the prayers when they log in. The god needs to know who made the prayer (book author) the location the prayer was made, thus the X, Y and Z coordinates in the item lore.

     

     

  • Ryan_plays_mediocrely posted a comment Sep 12, 2017

    Is the only non-working part of this the "teleporting" of the ingredient and/or result? Specifically, I assume "@command /summon @cloneingredient 0 80 72" does not work as intended and you're looking for a replacement to that.

  • _ForgeUser8803250 posted a comment Sep 12, 2017

    Yes. It'd be easy enough to generate a new book at whatever location I want, but if I do that I can't figure out any way to have the contents of the book be what was written in the book used as an ingredient. I knew "@command /summon @cloneingredient 0 80 72" wouldn't work because that's trying to summon an entity called "@cloneingredient" but it demonstrates what I'm trying to do the best.

     

    To be clear, if there isn't a way to do this, it's not the end of the world. Don't stress over it, I can make the players do something else to get their request across. I was just hoping there was some combination of flags and commands I hadn't considered.

  • Ryan_plays_mediocrely posted a comment Sep 12, 2017

    I don't think there's any current flag combination that can do this, but give me a few days to ponder over what might be possible or how this could be implemented.

  • _ForgeUser8803250 posted a comment Sep 12, 2017

    Okay, I got closer, but still not quite able to pull it off. My current code is as follows:

    @world world
    @cooldown 24h | failmsg Do not bother the gods with your petty wishes. Pray once a day.
    @holditem leather_helmet | slot helmet | enchant Binding_Curse
    @holditem leather_chestplate | slot chestplate | enchant Binding_Curse
    @holditem leather_leggings | slot leggings | enchant Binding_Curse
    @holditem leather_boots | slot boots | enchant Binding_Curse
    craft
    @displayresult first
    air + air + air
    air + written_book + air
    air + air + air
    = 0% written_book
    @cloneingredient all
    @itemname Prayer to The Philosopher
    = 100% written_book
    @cloneingredient all

    @itemlore X: {x} | Y: {y} | Z: {z}
    @command summon Item 2445 65 -2450 {Item:{id:written_book,Count:1,tag:{generation:3,title:"{result}",author:"{player}",pages:["X: {x}, Y: {y}, Z: {z}"]}}}
    @noresult

     The reason I said I was close is that you can use {result} to get the name of the item that was crafted, and using @cloneingredient all, the result should have the same name as the book used as the input for the recipe. Unfortunately, the book that is summoned is just named "written_book" which makes this a dead end, unless I'm missing something. I actually thought this might work. The prayer contents would have to go in the title of the book, but it'd still be a step up from what I currently have.

  • Ryan_plays_mediocrely posted a comment Sep 14, 2017

    Starting playing around with some ideas tonight. I think I can get this working, but will need some more time to get pages working (currently running into issues with line breaks) and do a lot of testing to make sure this doesn't break anything else.

     

    Will let you know of any decent progress. Hopefully I'll get some time this weekend to dig into it more.

  • Ryan_plays_mediocrely posted a comment Sep 14, 2017

    I had some extra time tonight and got something that works. Currently it looks something like this:

    @command summon Item {x} {y} {z} {Item:{id:written_book,Count:1,tag:{generation:3,title:"{booktitle}",display:{Lore:[{lore}]},author:"{player}",pages:[{bookpages}]}}}

     

    I'm going to think about the naming of these and consider what other arguments could potentially be added over the new few days as well as testing it out a bit more. It seems to be working pretty well so far though.

  • _ForgeUser8803250 posted a comment Sep 15, 2017

    Thanks so much, you really went above and beyond for me.

  • Ryan_plays_mediocrely posted a comment Sep 18, 2017

    This weekend was a bit crazy. Let me know if you would like a build to play with and I can create one. Not sure how soon I can get a proper release out.

  • _ForgeUser8803250 posted a comment Sep 19, 2017

    I'm not in a huge hurry right now, I've still got a lot of other things to configure and set up before the server goes live. And even once it goes live, most players won't be able to make a prayer for quite a while. So don't worry about it, I can wait for the release like everyone else.

  • Ryan_plays_mediocrely posted a comment Jan 20, 2018

    Forgot to update this, but these have been available since v2.13.2

  • Ryan_plays_mediocrely closed issue Jan 20, 2018

To post a comment, please login or register a new account.