I would like to make a Minecraft minigame map where you can enter a code to get something. Here is how I would like it to work.

When you first join you get a written book inside it says:

Bla bla bla
Click "here" if you have a code.

Then if you click "here" it gives you a book and quill that says:

Enter code below:

Then they type a code, sign, close it and title it "code". Then takes it and gives them a reward or something.

  • 1
    Just wondering would you be hosting this on a bukkit server (so that plugins would be a option) or is this a vanilla map you would distribute? – user271360 Oct 31 '14 at 1:44
  • The easiest way that I can think of is not to use a book, but rather a nametag and something that can be named, say a wooden sword. You can detect the name of something easily enough, so you just need to provide the item, an anvil, and the necessary experience (all easily accomplished as well). I don't have the time currently to flesh out the answer, but it'll look something like this answer I gave a while ago. – MBraedley Oct 31 '14 at 2:39
  • And actually, come to think of it, you don't even need the nametag. – MBraedley Oct 31 '14 at 2:39
  • @sebie its for a sigle player world that people might be able to download. – Kingbluesapphire Oct 31 '14 at 6:50
  • Is Computercraft an option? – kutschkem Oct 31 '14 at 8:53

There are two methods that come to mind:

Book and Quill

If you want to use the book and quill, you could detect what metadata the book had in it by using this command:

/testfor @p {SelectedItem:{id:minecraft:writable_book,tag:{pages:["CODE"]}}}

You can replace @p by whatever Target Selector (+Arguments) you like, but note the space after @p. This also works for written books with a specific title.

 /testfor @p {SelectedItem:{id:minecraft:written_book,tag:{title:"TITLE",pages:["CODE"]}}}

Check the wiki page for item NBT structure.

Item Name

As has been suggested, you could test for the name of an item (like in the map The Code by JesperTheEnd).

/clear @p paper 0 0 {display:{Name:"CODE"}}
  • 1
    Great first answer ZL123. I took the liberty of expanding it slightly to include checking for Written Books with a specific title. – MrLemon Oct 31 '14 at 10:03

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.