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

[BUG] QUICK_MOVE alternative for Minecraft 1.8 - 1.11.2 #4640

Open
1zun4 opened this issue Nov 23, 2024 · 12 comments
Open

[BUG] QUICK_MOVE alternative for Minecraft 1.8 - 1.11.2 #4640

1zun4 opened this issue Nov 23, 2024 · 12 comments
Labels
🐛 bug Something isn't working 🌑 nextgen

Comments

@1zun4
Copy link
Member

1zun4 commented Nov 23, 2024

LiquidBounce Branch

Nextgen

LiquidBounce Build/Version

0.19.1

Operating System

macOS, Linux, Windows 7, Windows 8, Windows 8.1, Windows 10, Windows 11

Minecraft Version

1.21.1

Describe the bug

QUICK_MOVE is not supported on versons below 1.12 and it seems ViaFabricPlus is lacking the required implementation for it to function correctly causing item lag-back on some servers. It seems to work on most servers though, so I'm a bit confused as to what is causing this problem.

2024-11-22.20-20-42.mp4

Steps to reproduce

Use ChestStealer on supercraft

Client Log

-

Screenshots

No response

@github-actions github-actions bot added 🌑 nextgen 🐛 bug Something isn't working labels Nov 23, 2024
@masterBeans990
Copy link

all 1.8 servers has this issue, also invcleaner is extremely buggy

@1zun4
Copy link
Member Author

1zun4 commented Nov 24, 2024

all 1.8 servers has this issue, also invcleaner is extremely buggy

This is what this issue is about.

@1zun4 1zun4 pinned this issue Nov 24, 2024
@DataM0del
Copy link
Contributor

Probably the best way to find an alternative is to see where it is used in 1.11.3 (or whatever is closest to the version which doesn't have QUICK_MOVE) and see the 1.11 or 1.11.1 code compared to the version you're inspecting.

@DataM0del
Copy link
Contributor

@1zun4 This seems to be related.
Issue Earthcomputer/multiconnect#114 is about QUICK_MOVE, the PR fixing the issue is Earthcomputer/multiconnect#121

@FatMolePanda
Copy link

I think the only client I know that had a fix for this was Sigma and idk how they did it

@DataM0del
Copy link
Contributor

I think the only client I know that had a fix for this was Sigma and idk how they did it

decompile it!

@DataM0del
Copy link
Contributor

Windows 7, Windows 8, Windows 8.1

Those OSes are long dead... Anyways 💀

@Some1whosAnonymous
Copy link

Some1whosAnonymous commented Nov 28, 2024

I think the only client I know that had a fix for this was Sigma and idk how they did it

A project has already deobfuscated and decompiled Sigma. https://github.com/Sigma-Skidder-Team/SigmaRemap/

@DataM0del
Copy link
Contributor

I think the only client I know that had a fix for this was Sigma and idk how they did it

A project has already deobfuscated and decompiled Sigma. https://github.com/Sigma-Skidder-Team/SigmaRemap/

https://github.com/search?q=repo%3ASigma-Skidder-Team%2FSigmaRemap%20QUICK_MOVE&type=code

@Some1whosAnonymous
Copy link

I think the only client I know that had a fix for this was Sigma and idk how they did it

public static ItemStack fixedClick(int var0, int var1, int var2, ClickType var3, PlayerEntity var4, boolean var5) {
      ItemStack var8 = null;
      if (var1 >= 0) {
         var8 = var4.openContainer.getSlot(var1).getStack().copy();
      }

      short var9 = var4.openContainer.getNextTransactionID(mc.player.inventory);
      ItemStack var10 = var4.openContainer.slotClick(var1, var2, var3, var4);
      if (var3 == null) {
         return var10;
      }
      if (var8 == null || /*JelloPortal.getCurrentVersion().getVersionNumber() > ViaVerList._1_12.getVersionNumber() && */!var5 || var3 == ClickType.SWAP) {
         var8 = var10;
      }

      mc.getConnection().sendPacket(new CClickWindowPacket(var0, var1, var2, var3, var8, var9));
      return var10;
   }

@DataM0del
Copy link
Contributor

I think the only client I know that had a fix for this was Sigma and idk how they did it

public static ItemStack fixedClick(int var0, int var1, int var2, ClickType var3, PlayerEntity var4, boolean var5) {
      ItemStack var8 = null;
      if (var1 >= 0) {
         var8 = var4.openContainer.getSlot(var1).getStack().copy();
      }

      short var9 = var4.openContainer.getNextTransactionID(mc.player.inventory);
      ItemStack var10 = var4.openContainer.slotClick(var1, var2, var3, var4);
      if (var3 == null) {
         return var10;
      }
      if (var8 == null || /*JelloPortal.getCurrentVersion().getVersionNumber() > ViaVerList._1_12.getVersionNumber() && */!var5 || var3 == ClickType.SWAP) {
         var8 = var10;
      }

      mc.getConnection().sendPacket(new CClickWindowPacket(var0, var1, var2, var3, var8, var9));
      return var10;
   }

I renamed some variables (TabNine documented the code, I added the link to mappings.dev):

/**
 * Performs a fixed click operation in a container and sends a packet to the server.
 * This method handles various click types and updates the item stack accordingly.
 *
 * @param syncId     The synchronization ID of the container.
 * @param slot       The slot number in the container being clicked.
 * @param clickData  Additional data about the click operation.
 * @param actionType The type of click action being performed.
 * @param player     The player entity performing the click action.
 * @param b1         A boolean flag affecting the stack update logic.
 * @return The resulting ItemStack after the click operation.
 */
public static ItemStack fixedClick(int syncId, int slot, int clickData, ClickType actionType, PlayerEntity player, boolean b1) {
    ItemStack stack = null;
    if (slot >= 0) {
        stack = player.openContainer.getSlot(slot).getStack().copy();
    }

    short actionID = player.openContainer.getNextTransactionID(mc.player.inventory);
    ItemStack item = player.openContainer.slotClick(slot, clickData, actionType, player);
    if (actionType == null) {
        return item;
    }
    if (stack == null || /*JelloPortal.getCurrentVersion().getVersionNumber() > ViaVerList._1_12.getVersionNumber() && */!b1 || actionType == ClickType.SWAP) {
        stack = item;
    }

    // https://mappings.dev/1.16.5/net/minecraft/network/protocol/game/ServerboundContainerClickPacket.html
    mc.getConnection().sendPacket(new CClickWindowPacket(syncId, slot, clickData, actionType, stack, actionID));
    return item;
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 bug Something isn't working 🌑 nextgen
Projects
None yet
Development

No branches or pull requests

5 participants