3
0
Mirror von https://github.com/ViaVersion/ViaBackwards.git synchronisiert 2024-12-26 16:12:43 +01:00

Merge pull request #97 from creeper123123321/master

Workaround for #48
Dieser Commit ist enthalten in:
Myles 2019-04-19 11:40:49 +01:00 committet von GitHub
Commit 44d71ec538
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 4AEE18F83AFDEB23

Datei anzeigen

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