TransWikia.com

How can I execute at a chest with a specific pattern of certain items?

Arqade Asked on July 23, 2021

I’m trying to use commands to make something similar to the "pop-up tower" chest on Hypixel bed wars.

I am trying to testfor and execute at any chest with a specific pattern of certain items, or at least one with a specific name, and also at unspecific coordinates.

As of now, I can testfor a chest with specific items, but only relative to the player. And also, any item can be in the other unspecified slots, so when I test, how do I check for no item in a slot?

And what command would I use to execute at this chest?

I’m on 1.12 by the way. So 1.13+ commands won’t work for me.

One Answer

You should use /testforblocks. This tests if two chests are the same.

/testforblocks templateX templateY templateZ templateX templateY templateZ testforX testforY testforZ

You will need to place a template chest down with the specific item pattern.

Then if it passes, you use a conditional command block placed after that to continue the chain.

If you need to use non-relative coordinates, remove the tilde ~ from your coordinates. So instead of typing ~1 ~2 ~3, type 1 2 3 to always execute at world coordinates (1, 2, 3), instead of relative.

Otherwise, I don't quite understand what you mean by "unspecific coordinates". I assume it means that it is not relative, but a certain world coordinates each time. If not, please update it in your question to be more specific.

If you want to test for any chest, anywhere, it's going to be quite tricky, and I'm not skilled enough to solve it. Sorry.

Answered by ExpertCoder14 on July 23, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP