Mirror von
https://github.com/ViaVersion/ViaBackwards.git
synchronisiert 2024-09-07 21:32:52 +02:00
Set item to null when shift clicking
Dieser Commit ist enthalten in:
Ursprung
44d71ec538
Commit
bb2e089f27
@ -174,14 +174,17 @@ public class BlockItemPackets1_12 extends BlockItemRewriter<Protocol1_11_1To1_12
|
|||||||
@Override
|
@Override
|
||||||
public void handle(PacketWrapper wrapper) throws Exception {
|
public void handle(PacketWrapper wrapper) throws Exception {
|
||||||
if (wrapper.get(Type.VAR_INT, 0) == 1) { // Shift click
|
if (wrapper.get(Type.VAR_INT, 0) == 1) { // Shift click
|
||||||
CompoundTag tag = new CompoundTag("");
|
// https://github.com/ViaVersion/ViaVersion/pull/754
|
||||||
tag.put(new DoubleTag("force reject", Double.NaN));
|
// Previously clients grab the item from the clicked slot *before* it has
|
||||||
wrapper.set(Type.ITEM, 0, new Item((short) 1, (byte) 1, (short) 1, tag));
|
// been moved however now they grab the slot item *after* it has been moved
|
||||||
|
// and send that in the packet.
|
||||||
|
wrapper.set(Type.ITEM, 0, null); // Set null item (probably will work)
|
||||||
|
|
||||||
|
// Apologize (may happen in some cases, maybe if inventory is full?)
|
||||||
PacketWrapper confirm = wrapper.create(0x6);
|
PacketWrapper confirm = wrapper.create(0x6);
|
||||||
confirm.write(Type.BYTE, wrapper.get(Type.UNSIGNED_BYTE, 0).byteValue());
|
confirm.write(Type.BYTE, wrapper.get(Type.UNSIGNED_BYTE, 0).byteValue());
|
||||||
confirm.write(Type.SHORT, wrapper.get(Type.SHORT, 1));
|
confirm.write(Type.SHORT, wrapper.get(Type.SHORT, 1));
|
||||||
confirm.write(Type.BOOLEAN, false);
|
confirm.write(Type.BOOLEAN, false); // Success - not used
|
||||||
|
|
||||||
wrapper.sendToServer(Protocol1_11_1To1_12.class, true, true);
|
wrapper.sendToServer(Protocol1_11_1To1_12.class, true, true);
|
||||||
wrapper.cancel();
|
wrapper.cancel();
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren