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

Adding right click, left clicking interacting protocols #808

Closed
jakeau opened this issue Sep 21, 2019 · 4 comments
Closed

Adding right click, left clicking interacting protocols #808

jakeau opened this issue Sep 21, 2019 · 4 comments
Labels
a:question General question in:protocol-compatibility Related to implementing new Minecraft versions in:terrain-handling Related to terrain and movements

Comments

@jakeau
Copy link

jakeau commented Sep 21, 2019

Was wondering if there was a place I could contact you about MC protocols. Cheers.

@Mhowser
Copy link
Contributor

Mhowser commented Sep 21, 2019 via email

@TheSnoozer TheSnoozer added a:question General question resolved The issue has been resolved labels Sep 21, 2019
@ORelio
Copy link
Member

ORelio commented Sep 21, 2019

Related: #502 #205 and #183
Documentation: https://wiki.vg/Protocol
If you have any question on how MCC handles packet or how a packet works, feel free to ask 😉

@jakeau
Copy link
Author

jakeau commented Sep 22, 2019

Cheers for the help.

I am attempting to implement this IOT click a button. I am testing it by attacking the sender.
https://wiki.vg/Protocol#Use_Entity

public void SendUseEntity(int target, int type = 0, float x = 0, float y = 0, float z = 0, int hand = 0)
{
    handler.SendUseEntity(target, type, x, y, z, hand);
}

public bool SendUseEntity(int target, int type = 0, float x = 0, float y = 0, float z = 0, int hand = 0)
{
    byte[] yawpitch = new byte[0];
    PacketOutgoingType packetType = PacketOutgoingType.UseEntity;


    try
    {
        SendPacket(packetType, dataTypes.ConcatBytes(
            dataTypes.GetVarInt(target),
            dataTypes.GetVarInt(type),
            dataTypes.GetFloat(x),
            dataTypes.GetFloat(y),
            dataTypes.GetFloat(z),
            dataTypes.GetVarInt(hand)));
        return true;
    }
    catch (SocketException) { return false; }
}

I am being disconnected from the server. I am using varInt Target as the playerID of the player it wishes to attack. I believe this is wrong, what are the target value and the best way to obtain it.

Cheers.

ORelio added a commit that referenced this issue Sep 23, 2019
@ORelio
Copy link
Member

ORelio commented Sep 23, 2019

If not already the case, I'd suggest to run a vanilla server on your own computer since an anti-cheat plugin may interfer with your work (you'll make it right later, get it working first on vanilla even if it's not fully correct) and the console may show useful error messages.

Regarding the packet itself: make sure the ID of your target is right, visible, and you are looking at it. You may need to enable terrain and movements. You may also want to examine packet content sent by a vanilla client. To do this, I just added for you a tool previously developed for issues such as #195. It's a man-in-the-middle proxy that can intercept and display packets from a Vanilla client as long as encryption is disabled (offline mode servers only). Just need to add the relevant parsing code.

@ORelio ORelio added in:protocol-compatibility Related to implementing new Minecraft versions in:terrain-handling Related to terrain and movements and removed resolved The issue has been resolved labels Sep 23, 2019
@ORelio ORelio changed the title Interested in adding right click, left clicking interacting protocols Adding right click, left clicking interacting protocols Sep 23, 2019
@ORelio ORelio closed this as completed May 21, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
a:question General question in:protocol-compatibility Related to implementing new Minecraft versions in:terrain-handling Related to terrain and movements
Projects
None yet
Development

No branches or pull requests

4 participants