shorter workaround

This commit is contained in:
creeper123123321 2019-03-07 14:56:00 -03:00
parent ce63e5ee62
commit a352822afa
No known key found for this signature in database
GPG Key ID: 0AC57D54786721D1

View File

@ -27,6 +27,7 @@ import us.myles.ViaVersion.packets.State;
import us.myles.ViaVersion.protocols.protocol1_9_1_2to1_9_3_4.types.Chunk1_9_3_4Type;
import us.myles.ViaVersion.protocols.protocol1_9_3to1_9_1_2.storage.ClientWorld;
import us.myles.viaversion.libs.opennbt.tag.builtin.CompoundTag;
import us.myles.viaversion.libs.opennbt.tag.builtin.DoubleTag;
import us.myles.viaversion.libs.opennbt.tag.builtin.ListTag;
import java.util.Collections;
@ -172,6 +173,21 @@ public class BlockItemPackets1_12 extends BlockItemRewriter<Protocol1_11_1To1_12
handler(new PacketHandler() {
@Override
public void handle(PacketWrapper wrapper) throws Exception {
if (wrapper.get(Type.VAR_INT, 0) == 1) { // Shift click
CompoundTag tag = new CompoundTag("");
tag.put(new DoubleTag("force reject", Double.NaN));
wrapper.set(Type.ITEM, 0, new Item((short) 1, (byte) 1, (short) 1, tag));
PacketWrapper confirm = wrapper.create(0x6);
confirm.write(Type.BYTE, wrapper.get(Type.UNSIGNED_BYTE, 0).byteValue());
confirm.write(Type.SHORT, wrapper.get(Type.SHORT, 1));
confirm.write(Type.BOOLEAN, false);
wrapper.sendToServer(Protocol1_11_1To1_12.class, true, true);
wrapper.cancel();
confirm.sendToServer(Protocol1_11_1To1_12.class, true, true);
return;
}
Item item = wrapper.get(Type.ITEM, 0);
handleItemToServer(item);
}