Minecraft – How to keep items you hold from appearing to other players while invisible

minecraft-commandsminecraft-java-edition

I asked a question earlier about how to change what a mob is holding, using the mob's name. I got the answer and am very thankful, but the project I'm working on isn't finished. The project is a disguising creation for a YouTube roleplay I'm doing. The commands I have already made are below:

/tp @e[type=Zombie,name=Rocket] jackmaster110
/testfor jackmaster110 {SelectedItemSlot:0}
/replaceitem entity @e[name=Rocket] slot.weapon.mainhand iron_horse_armor

The problem is, when I hold the horse armor that's in slot 0, it appears in the zombie's hand, and floating behind his head because it's a baby. The problem is that the item still shows up when I'm invisible, but I don't want it to, is there any command (or plugin, but preferably command) that does this. (I don't want iDisguise, that plugin doesn't work with the replay mod and that's what I'm recording the series on). Thanks in advance.

Best Answer

In relating to your other question, and based on some of my own research, I don't think a baby mob can hold an item correctly, sorry. Should've tested it out myself then.

But hiding the item when you are invisible (assuming you mean the minecraft base effect, which can be caused by a potion) is possible. All you need to do is make sure the item holding command is only set off if this condition is met:

/testfor <selector> {ActiveEffects:[{Id:14b}]}

Where <selector> is the player/target selector (could be a name or a variation on @p/@e), and 14 is the effect ID, in this case for Invisibility. Other effect IDs can be found here. Remember the b to add at the end of the ID, as it is required.