Skip to content

Commit

Permalink
1.19.3: fix metadata packet bug
Browse files Browse the repository at this point in the history
  • Loading branch information
mcmonkey4eva committed Dec 16, 2022
1 parent 980b86b commit 947fb2b
Showing 1 changed file with 2 additions and 5 deletions.
Expand Up @@ -212,7 +212,6 @@ public void setListener(PacketListener packetlistener) {
public static Field SECTIONPOS_MULTIBLOCKCHANGE = ReflectionHelper.getFields(ClientboundSectionBlocksUpdatePacket.class).get(ReflectionMappingsInfo.ClientboundSectionBlocksUpdatePacket_sectionPos, SectionPos.class);
public static Field OFFSETARRAY_MULTIBLOCKCHANGE = ReflectionHelper.getFields(ClientboundSectionBlocksUpdatePacket.class).get(ReflectionMappingsInfo.ClientboundSectionBlocksUpdatePacket_positions, short[].class);
public static Field BLOCKARRAY_MULTIBLOCKCHANGE = ReflectionHelper.getFields(ClientboundSectionBlocksUpdatePacket.class).get(ReflectionMappingsInfo.ClientboundSectionBlocksUpdatePacket_states, BlockState[].class);
public static Field ENTITY_METADATA_LIST = ReflectionHelper.getFields(ClientboundSetEntityDataPacket.class).get(ReflectionMappingsInfo.ClientboundSetEntityDataPacket_packedItems, List.class);

@Override
public void send(Packet<?> packet) {
Expand Down Expand Up @@ -696,13 +695,12 @@ else if (packet instanceof ClientboundMoveEntityPacket) {
for (SynchedEntityData.DataValue item : data) {
EntityDataSerializer<?> watcherObject = item.serializer();
if (item.id() == 0) { // Entity flags
ClientboundSetEntityDataPacket altPacket = new ClientboundSetEntityDataPacket(copyPacket(metadataPacket));
data = new ArrayList<>(data);
ENTITY_METADATA_LIST.set(altPacket, data);
data.remove(item);
byte flags = (byte) item.value();
flags |= 0x20; // Invisible flag
data.add(new SynchedEntityData.DataValue(item.id(), watcherObject, flags));
ClientboundSetEntityDataPacket altPacket = new ClientboundSetEntityDataPacket(metadataPacket.id(), data);
ClientboundSetEntityDataPacket updatedPacket = getModifiedMetadataFor(altPacket);
oldManager.send(updatedPacket == null ? altPacket : updatedPacket, genericfuturelistener);
return true;
Expand Down Expand Up @@ -825,8 +823,7 @@ else if (item.id() == 3 && nameToApply != null) { // 3: custom name visible meta
if (!any) {
return null;
}
ClientboundSetEntityDataPacket altPacket = new ClientboundSetEntityDataPacket(copyPacket(metadataPacket));
ENTITY_METADATA_LIST.set(altPacket, data);
ClientboundSetEntityDataPacket altPacket = new ClientboundSetEntityDataPacket(metadataPacket.id(), data);
return altPacket;
}
catch (Throwable ex) {
Expand Down

0 comments on commit 947fb2b

Please sign in to comment.