Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

I found a fix for the 1.19.3 packet 78 error #29

Open
GilanRanger opened this issue Feb 12, 2023 · 3 comments
Open

I found a fix for the 1.19.3 packet 78 error #29

GilanRanger opened this issue Feb 12, 2023 · 3 comments
Labels
documentation Improvements or additions to documentation enhancement New feature or request

Comments

@GilanRanger
Copy link

I was recently trying to use XGlow in 1.19.3, but it was crashing when the client received a packet due to a cast exception.

The solution seems to be to change the setMetadata() in WrapperPlayServerEntityMetadata to this

public void setMetadata(List<WrappedWatchableObject> value) {
        final List<WrappedDataValue> wrappedDataValueList = new ArrayList<>();
        value.stream().filter(Objects::nonNull).forEach(entry -> {
            final WrappedDataWatcher.WrappedDataWatcherObject dataWatcherObject = entry.getWatcherObject();
            wrappedDataValueList.add(new WrappedDataValue(dataWatcherObject.getIndex(), dataWatcherObject.getSerializer(), entry.getRawValue()));
        });
        handle.getDataValueCollectionModifier().write(0, wrappedDataValueList);
    }

And the onPacketSending in GlowAPI to this

public void onPacketSending(PacketEvent event) {
                PacketContainer packet = event.getPacket();
                Entity entity = packet.getEntityModifier(event).read(0);

                GlowsManager.getInstance().getGlowByEntity(entity).ifPresent((glow) -> {
                    final List<WrappedDataValue> wrappedDataValueList = new ArrayList<>();
                    GlowProcessor.getInstance().createDataWatcher(entity, glow.sees(event.getPlayer()))
                            .getWatchableObjects().stream().filter(Objects::nonNull).forEach(entry -> {
                            final WrappedDataWatcher.WrappedDataWatcherObject dataWatcherObject = entry.getWatcherObject();
                            wrappedDataValueList.add(new WrappedDataValue(dataWatcherObject.getIndex(), dataWatcherObject.getSerializer(), entry.getRawValue()));
                    });
                    packet.getDataValueCollectionModifier().write(0, wrappedDataValueList);

                    event.setPacket(packet);
                });
            }

I was having trouble getting a pull request/fork to work (and this solution is quite messy), so in the meantime, I'll just post this here so that if anyone needs to fix it they can.

@Xezard Xezard added documentation Improvements or additions to documentation enhancement New feature or request labels Feb 13, 2023
@Xezard
Copy link
Owner

Xezard commented Feb 13, 2023

Thank you. As soon as I get a chance, I will update the plugin.

@Dymeth
Copy link
Contributor

Dymeth commented Feb 19, 2023

Made this changes in #30, thank you. Just waiting for @Xezard review for now

@Varunda
Copy link

Varunda commented Jul 18, 2023

i've found another fix based on:
https://www.spigotmc.org/threads/unable-to-modify-entity-metadata-packet-using-protocollib-1-19-3.582442/

implemented it in my fork: https://github.com/Varunda/XGlow

only tested with 1.20, but it seems a bit simpler to implement for me than #30

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants