From 8b759faf44efb92aceb9f8b683e1c8788f3986df Mon Sep 17 00:00:00 2001 From: Paul Date: Tue, 23 Oct 2018 19:00:19 +0200 Subject: [PATCH] Update to Minecraft 1.13.2 --- pom.xml | 2 +- .../mc/protocol/MinecraftConstants.java | 4 ++-- .../steveice10/mc/protocol/util/NetUtil.java | 15 +++++++-------- 3 files changed, 10 insertions(+), 11 deletions(-) diff --git a/pom.xml b/pom.xml index 5e40d4a7..cb1a6483 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ com.github.steveice10 mcprotocollib - 1.13.1-1-SNAPSHOT + 1.13.2-1-SNAPSHOT jar MCProtocolLib diff --git a/src/main/java/com/github/steveice10/mc/protocol/MinecraftConstants.java b/src/main/java/com/github/steveice10/mc/protocol/MinecraftConstants.java index 69276591..da1fe68b 100644 --- a/src/main/java/com/github/steveice10/mc/protocol/MinecraftConstants.java +++ b/src/main/java/com/github/steveice10/mc/protocol/MinecraftConstants.java @@ -2,8 +2,8 @@ package com.github.steveice10.mc.protocol; public class MinecraftConstants { // General Constants - public static final String GAME_VERSION = "1.13.1"; - public static final int PROTOCOL_VERSION = 401; + public static final String GAME_VERSION = "1.13.2"; + public static final int PROTOCOL_VERSION = 404; // General Key Constants public static final String PROFILE_KEY = "profile"; diff --git a/src/main/java/com/github/steveice10/mc/protocol/util/NetUtil.java b/src/main/java/com/github/steveice10/mc/protocol/util/NetUtil.java index 28b0d61c..a20f9761 100644 --- a/src/main/java/com/github/steveice10/mc/protocol/util/NetUtil.java +++ b/src/main/java/com/github/steveice10/mc/protocol/util/NetUtil.java @@ -69,19 +69,18 @@ public class NetUtil { } public static ItemStack readItem(NetInput in) throws IOException { - short item = in.readShort(); - if(item < 0) { + boolean present = in.readBoolean(); + if (!present) { return null; - } else { - return new ItemStack(item, in.readByte(), readNBT(in)); } + int item = in.readVarInt(); + return new ItemStack(item, in.readByte(), readNBT(in)); } public static void writeItem(NetOutput out, ItemStack item) throws IOException { - if(item == null) { - out.writeShort(-1); - } else { - out.writeShort(item.getId()); + out.writeBoolean(item != null); + if (item != null) { + out.writeVarInt(item.getId()); out.writeByte(item.getAmount()); writeNBT(out, item.getNBT()); }