mirror of
https://github.com/ViaVersion/ViaFabricPlus.git
synced 2024-11-07 09:42:03 +01:00
Revert 929ab2f588
because it has been fixed in ViaVersion.
This commit is contained in:
parent
8e9f5fa141
commit
abcb5f9271
@ -18,9 +18,8 @@
|
||||
package de.florianmichael.viafabricplus.injection.mixin.fixes.minecraft;
|
||||
|
||||
import com.llamalad7.mixinextras.injector.WrapWithCondition;
|
||||
import com.viaversion.viaversion.api.connection.UserConnection;
|
||||
import com.viaversion.viaversion.api.minecraft.item.Item;
|
||||
import com.viaversion.viaversion.api.protocol.packet.PacketWrapper;
|
||||
import de.florianmichael.viafabricplus.ViaFabricPlus;
|
||||
import de.florianmichael.viafabricplus.definition.ClientPlayerInteractionManager1_18_2;
|
||||
import net.minecraft.client.network.SequencedPacketCreator;
|
||||
import net.minecraft.client.world.ClientWorld;
|
||||
@ -129,29 +128,20 @@ public abstract class MixinClientPlayerInteractionManager {
|
||||
else
|
||||
slotItemBeforeModification = viafabricplus_oldItems.get(clickSlot.getSlot());
|
||||
|
||||
final UserConnection userConnection = networkHandler.getConnection().channel.attr(ProtocolHack.LOCAL_VIA_CONNECTION).get();
|
||||
final short syncId = (short) clickSlot.getSyncId();
|
||||
final short slot = (short) clickSlot.getSlot();
|
||||
final byte button = (byte) clickSlot.getButton();
|
||||
final short lastActionId = ((IScreenHandler) client.player.currentScreenHandler).viafabricplus_getAndIncrementLastActionId();
|
||||
final int actionType = clickSlot.getActionType().ordinal();
|
||||
final Item item = ItemTranslator.MC_TO_VIA_LATEST_TO_TARGET(slotItemBeforeModification, VersionEnum.r1_16);
|
||||
final var clickSlotPacket = PacketWrapper.create(ServerboundPackets1_16_2.CLICK_WINDOW, networkHandler.getConnection().channel.attr(ProtocolHack.LOCAL_VIA_CONNECTION).get());
|
||||
|
||||
userConnection.getChannel().eventLoop().submit(() -> {
|
||||
final PacketWrapper clickSlotPacket = PacketWrapper.create(ServerboundPackets1_16_2.CLICK_WINDOW, userConnection);
|
||||
|
||||
clickSlotPacket.write(Type.UNSIGNED_BYTE, syncId);
|
||||
clickSlotPacket.write(Type.SHORT, slot);
|
||||
clickSlotPacket.write(Type.BYTE, button);
|
||||
clickSlotPacket.write(Type.SHORT, lastActionId);
|
||||
clickSlotPacket.write(Type.VAR_INT, actionType);
|
||||
clickSlotPacket.write(Type.FLAT_VAR_INT_ITEM, item);
|
||||
clickSlotPacket.write(Type.UNSIGNED_BYTE, (short) clickSlot.getSyncId());
|
||||
clickSlotPacket.write(Type.SHORT, (short) clickSlot.getSlot());
|
||||
clickSlotPacket.write(Type.BYTE, (byte) clickSlot.getButton());
|
||||
clickSlotPacket.write(Type.SHORT, ((IScreenHandler) client.player.currentScreenHandler).viafabricplus_getAndIncrementLastActionId());
|
||||
clickSlotPacket.write(Type.VAR_INT, clickSlot.getActionType().ordinal());
|
||||
clickSlotPacket.write(Type.FLAT_VAR_INT_ITEM, ItemTranslator.MC_TO_VIA_LATEST_TO_TARGET(slotItemBeforeModification, VersionEnum.r1_16));
|
||||
|
||||
try {
|
||||
clickSlotPacket.sendToServer(Protocol1_17To1_16_4.class);
|
||||
} catch (Exception ignored) {
|
||||
} catch (Exception e) {
|
||||
ViaFabricPlus.LOGGER.error("Failed to send Click Slot Packet", e);
|
||||
}
|
||||
});
|
||||
|
||||
viafabricplus_oldCursorStack = null;
|
||||
viafabricplus_oldItems = null;
|
||||
|
@ -24,6 +24,7 @@ import com.viaversion.viaversion.api.protocol.packet.PacketWrapper;
|
||||
import com.viaversion.viaversion.api.type.Type;
|
||||
import com.viaversion.viaversion.protocols.protocol1_12to1_11_1.Protocol1_12To1_11_1;
|
||||
import com.viaversion.viaversion.protocols.protocol1_9_3to1_9_1_2.ServerboundPackets1_9_3;
|
||||
import de.florianmichael.viafabricplus.ViaFabricPlus;
|
||||
import de.florianmichael.viafabricplus.injection.access.IMinecraftClient;
|
||||
import de.florianmichael.viafabricplus.protocolhack.ProtocolHack;
|
||||
import de.florianmichael.viafabricplus.base.settings.groups.DebugSettings;
|
||||
@ -127,14 +128,14 @@ public abstract class MixinMinecraftClient implements IMinecraftClient {
|
||||
final UserConnection userConnection = ProtocolHack.getMainUserConnection();
|
||||
|
||||
if (userConnection != null && userConnection.getProtocolInfo().getPipeline().contains(Protocol1_12To1_11_1.class)) {
|
||||
userConnection.getChannel().eventLoop().submit(() -> {
|
||||
final PacketWrapper clientStatus = PacketWrapper.create(ServerboundPackets1_9_3.CLIENT_STATUS, userConnection);
|
||||
clientStatus.write(Type.VAR_INT, 2); // Open Inventory Achievement
|
||||
|
||||
try {
|
||||
clientStatus.sendToServer(Protocol1_12To1_11_1.class);
|
||||
} catch (Exception ignored) {}
|
||||
});
|
||||
} catch (Exception e) {
|
||||
ViaFabricPlus.LOGGER.error("Failed to send Open Inventory Packet", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user