mojira.dev
MC-94252

ArmorStands' DisabledSlots incorrect flags implementation

Current problems:

  • Cannot enable the offhand slot

  • Cannot disable the mainhand slot.

  • Can replace when placing is disabled.

The current implementation is:

1 << slot = disables all interaction
1 << (slot + 8) = disables removing/replacing
1 << (slot + 16) = disables placing, allows removing/replacing

Slot values:
boots slot: 1, pants slot: 2, chest slot: 3, helmet slot: 4
offhand is always disabled, mainhand is always enabled.

To reproduce:

  • /summon armor_stand

  • /entitydata @e[type=armor_stand] {DisabledSlots:255}, for instance (more example values below)

Example values:
Disabled all interaction, except boots: 11111101= 253
Disabled all interaction, except pants: 11111011= 251
Disabled all interaction, except chest: 11110111= 247
Disabled all interaction, except helmet: 11101111= 239
Disabled all interaction, all slots: 11111111 = 255
Disabled removing/replacing, all slots: 11111111 00000000 = 65280
Disabled placing, allow removing, all slots: 11111111 00000000 00000000 = 16711680

What the implementation should be (see Searge's comment here):

1 << slot = disables all interaction
1 << (slot + 8) = disables removing
1 << (slot + 16) = disables placing

'Replacing' should theoretically not be possible, and the first flag should also disable placing and not just removing.

Linked issues

Attachments

Comments 22

I can't reproduce it, for example using 31 disables all interactions with all slots on the armorstand, works fine here. Do you have a world save that can reproduce the problem you described?

@Searge, Sure, added a world file. Setting to 31 indeed works for all slots, but when attempting to set flags for specific slots (such as 16 for head slot), it allows me to place/replace.

The new implementation use (1 << slot) to disables all interactions. If you apply this formula to the 5 slots, you have :
DisabledSlots = (1 << 0) + (1 << 1) + (1 << 2) + (1 << 3) + (1 << 5)
DisabledSlots = 1 + 2 + 4 + 8 +16 = 31

This change is relatively recent, so things like wiki and online generator have a high chance to be outdated.

I want the following:
Enabled:
Only "Remove" (not "Replace") o only the head slot.
All other slots and Placing/Replacing Items are disbaled.
What number do I need?

@@unknown You should be asking elsewhere like on Reddit. Value you need: 1114382

12 more comments

I would keep the offhand part out of this because it is not related to DisabledSlots.
And why is there a need for a flag to disable all interaction when this can be achieved by combining flags?

Edit: It looks like only 1 << slot is not working for the mainhand, all other situations should work.

This Issue still occurs in release 1.14.

In 1.15 pre-1, I tried to disable all slots for an armor stand (DisabledSlots:2039583), but it doesn't work, I can still e.g. have the AS equip a helmet, whilst being in Survival.

As I'm unsure where I should report this, I'll add this comment to MC-94252, MC-142946 and MC-156585.

Something in this description of the disabled flags isn't quite right, and it is possible to disable the mainhand, despite this report claiming you cannot. (The information on the wiki is mostly correct here https://minecraft.gamepedia.com/Armor_Stand/ED)

DisabledSlots:1 Prevents adding/replacing a hand slot

However, it seems that DisabledSlots:16 does not function as the wiki states (which may be due to incorrect information rather than a bug, I can't tell). While it seems like it should disable adding to a head slot, it instead disabled removing from the head slot, behaving the same as DisabledSlots:4096

It may be necessary for someone to examine the actual game code to figure out the algorithm behind this feature.

Skylinerw

(Unassigned)

Confirmed

Platform

Low

Commands

Minecraft 15w50a, Minecraft 1.9, Minecraft 1.9.2, Minecraft 1.10.2, Minecraft 16w43a, ..., Minecraft 1.12, Minecraft 1.14, Minecraft 1.14.1, Minecraft 1.14.2 Pre-Release 1, 20w07a

Minecraft 15w51a

Retrieved