-
Notifications
You must be signed in to change notification settings - Fork 109
Description
As the title suggests, the data types for SHULKER_ATTACHED and SHULKER_ATTACH_FACE are defined incorrectly in EntityDataTypes. In fact, this may be a problem specific to Bedrock_v291, as this is the first and last place where these types were defined (with an index specified). On the other hand, it may be that the change in types (by Mojang) happened somewhere between 291 and 844, and that these types were correct in 291. I encountered this problem specifically on Bedrock_v844 (game version 1.21.110), and I have no idea in which version of the protocol Mojang changed (if they did) the data types for these properties. As for 844, here's what is known at this point:
- On 844, the IDs of these types are shifted:
- SHULKER_ATTACH_FACE = 65 (on v291 it is 64)
- SHULKER_ATTACHED = 66 (in v291 it is 65)
And yes, most likely they are also shifted correctly in Protocol, but it is impossible to find out because, due to the “upgrade” system, the shift was done via shift() rather than via direct insert() or replace() in the previous protocols between 291 and 844.
- In 844, these types have the following data types:
- SHULKER_ATTACH_FACE = BYTE (not Int, as in v291)
- SHULKER_ATTACHED = SHORT (not Byte, as in v291. But the possible values also remained: 0 or 1, which also leaves Boolean as the correct type for EntityDataTypes definition. WTF MOJANG...)
PROOF.
When accessing the corresponding Bedrock Server via ProxyPass (protocol v844), there is one spawned shulker entity at the spawn point. I am in creative mode, so all it does is peek and does not attack. I entered the server and did nothing, but the Bedrock server sent the necessary SetEntityDataPackets. When I tried to decode them, Protocol returned the following: 1
[16:01:38 DEBUG]: Unknown entity data: 65 type BYTE value 0
[16:01:38 DEBUG]: Unknown entity data: 66 type SHORT value 1
[16:01:38 DEBUG]: Unknown entity data: 65 type BYTE value 0
[16:01:38 DEBUG]: Unknown entity data: 66 type SHORT value 1And, of course, due to a decoding error, these data types do not appear in packets.log. This fix helped to correct this (for _v844 on ProxyPass):
public class CustomBedrock_v844 extends Bedrock_v827 {
protected static final TypeMap<EntityFlag> ENTITY_FLAGS = Bedrock_v827.ENTITY_FLAGS
.toBuilder()
.insert(125, EntityFlag.CAN_USE_VERTICAL_MOVEMENT_ACTION)
.build();
protected static final EntityDataTypeMap ENTITY_DATA = Bedrock_v827.ENTITY_DATA
.toBuilder()
.update(EntityDataTypes.FLAGS, new FlagTransformer(ENTITY_FLAGS, 0))
.update(EntityDataTypes.FLAGS_2, new FlagTransformer(ENTITY_FLAGS, 1))
.remove(65)
.remove(66)
.insert(EntityDataTypes.SHULKER_ATTACH_FACE, 65, EntityDataFormat.BYTE, ByteToIntTransformer.INSTANCE)
.insert(EntityDataTypes.SHULKER_ATTACHED, 66, EntityDataFormat.SHORT, ShortToBooleanTransformer.INSTANCE)
/* yes, I could use .replace() but I realized it later. */
.build();After using this custom codec, the data types are now correctly displayed in packet.log
Footnotes
-
Recorded with _v844, server spawns one Shulker ↩