2

I have a bunch of named items which I would like an Adventure Mode player to be able to set in certain places around a table. Then I want to test the items and do an action when all the correct items are in the correct places.

I know I can put item frames as the "place settings" and let the player stick the items in them. However, there are two problems with this:

  • They can rotate the items, which in this case shouldn't actually change anything but would cause the testforblocks call to fail. Not the end of the world, but not ideal.
  • If they make a mistake, there's no way to get the items out of the frames.

I tried concocting a setblock command to replace all of the item frames with new ones. This would let me make a button to start over, getting around the second problem. In theory, this should be possible with something like:

setblock ~~~ frame 0

However, no matter what I use for the data integer, I can't find a way to get the frame to sit on the ground. It's always sitting on some other internal (N/S/E/W/top) face of the cube. I also need to make sure that the player can't cause the items to disappear from the game, because there's no way to make more of them. (I think I'm OK with "destroy" being used, and relying on the player picking the items up before they despawn.)

Is there an approach that I'm missing here?

1 Answer 1

2

The answer I finally arrived at was to use hoppers instead of item frames. I then created a copy of the hopper table in the basement and compared them with testforblocks. As long as the hoppers are pointing in the same direction, and the player places the item to compare in the first slot of the hopper, it works. And it's easy to make a change if needed, and a lot harder to accidentally stick something in the wrong place.

While this solved my problem, I would still like to know how to programmatically place an item frame.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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