LiquidBounce icon indicating copy to clipboard operation
LiquidBounce copied to clipboard

[BUG] QUICK_MOVE alternative for Minecraft 1.8 - 1.11.2

Open 1zun4 opened this issue 1 year ago • 13 comments

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.

https://github.com/user-attachments/assets/e455eca0-18a6-4f5d-aed5-c6c96493b974

Steps to reproduce

Use ChestStealer on supercraft

Client Log

-

Screenshots

No response

1zun4 avatar Nov 23 '24 19:11 1zun4

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

masterBeans990 avatar Nov 24 '24 14:11 masterBeans990

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

This is what this issue is about.

1zun4 avatar Nov 24 '24 15:11 1zun4

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 avatar Nov 25 '24 03:11 DataM0del

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

DataM0del avatar Nov 25 '24 03:11 DataM0del

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

FatMolePanda avatar Nov 27 '24 04:11 FatMolePanda

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

decompile it!

DataM0del avatar Nov 27 '24 05:11 DataM0del

Windows 7, Windows 8, Windows 8.1

Those OSes are long dead... Anyways :skull:

DataM0del avatar Nov 27 '24 05:11 DataM0del

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/

Some1whosAnonymous avatar Nov 28 '24 22:11 Some1whosAnonymous

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

DataM0del avatar Nov 28 '24 23:11 DataM0del

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;
   }

Some1whosAnonymous avatar Nov 28 '24 23:11 Some1whosAnonymous

https://github.com/Sigma-Skidder-Team/SigmaRemap/blob/2624f15d0ca4a44fd6f2fd862b9c13fdb1101240/src/java/mapped/InvManagerUtils.java#L314-L331

DataM0del avatar Nov 29 '24 01:11 DataM0del

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;
}

DataM0del avatar Nov 29 '24 01:11 DataM0del

cancel s2f?

dingzhenstone avatar May 03 '25 02:05 dingzhenstone