MCPcopy Create free account
hub / github.com/cuberite/cuberite / HandlePacketWindowClick

Method HandlePacketWindowClick

src/Protocol/Protocol17x.cpp:1915–1961  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1913
1914
1915void cProtocol172::HandlePacketWindowClick(cByteBuffer & a_ByteBuffer)
1916{
1917 HANDLE_READ(a_ByteBuffer, ReadChar, char, WindowID);
1918 HANDLE_READ(a_ByteBuffer, ReadBEShort, short, SlotNum);
1919 HANDLE_READ(a_ByteBuffer, ReadByte, Byte, Button);
1920 HANDLE_READ(a_ByteBuffer, ReadBEShort, short, TransactionID);
1921 HANDLE_READ(a_ByteBuffer, ReadByte, Byte, Mode);
1922 cItem Item;
1923 ReadItem(a_ByteBuffer, Item);
1924
1925 // Convert Button, Mode, SlotNum and HeldItem into eClickAction:
1926 eClickAction Action;
1927 switch ((Mode << 8) | Button)
1928 {
1929 case 0x0000: Action = (SlotNum != -999) ? caLeftClick : caLeftClickOutside; break;
1930 case 0x0001: Action = (SlotNum != -999) ? caRightClick : caRightClickOutside; break;
1931 case 0x0100: Action = caShiftLeftClick; break;
1932 case 0x0101: Action = caShiftRightClick; break;
1933 case 0x0200: Action = caNumber1; break;
1934 case 0x0201: Action = caNumber2; break;
1935 case 0x0202: Action = caNumber3; break;
1936 case 0x0203: Action = caNumber4; break;
1937 case 0x0204: Action = caNumber5; break;
1938 case 0x0205: Action = caNumber6; break;
1939 case 0x0206: Action = caNumber7; break;
1940 case 0x0207: Action = caNumber8; break;
1941 case 0x0208: Action = caNumber9; break;
1942 case 0x0300: Action = caMiddleClick; break;
1943 case 0x0400: Action = (SlotNum == -999) ? caLeftClickOutsideHoldNothing : caDropKey; break;
1944 case 0x0401: Action = (SlotNum == -999) ? caRightClickOutsideHoldNothing : caCtrlDropKey; break;
1945 case 0x0500: Action = (SlotNum == -999) ? caLeftPaintBegin : caUnknown; break;
1946 case 0x0501: Action = (SlotNum != -999) ? caLeftPaintProgress : caUnknown; break;
1947 case 0x0502: Action = (SlotNum == -999) ? caLeftPaintEnd : caUnknown; break;
1948 case 0x0504: Action = (SlotNum == -999) ? caRightPaintBegin : caUnknown; break;
1949 case 0x0505: Action = (SlotNum != -999) ? caRightPaintProgress : caUnknown; break;
1950 case 0x0506: Action = (SlotNum == -999) ? caRightPaintEnd : caUnknown; break;
1951 case 0x0600: Action = caDblClick; break;
1952 default:
1953 {
1954 LOGWARNING("Unhandled window click mode / button combination: %d (0x%x)", (Mode << 8) | Button, (Mode << 8) | Button);
1955 Action = caUnknown;
1956 break;
1957 }
1958 }
1959
1960 m_Client->HandleWindowClick(WindowID, SlotNum, Action, Item);
1961}
1962
1963
1964

Callers

nothing calls this directly

Calls 1

HandleWindowClickMethod · 0.80

Tested by

no test coverage detected