Skip to content

Commit 381687c

Browse files
authored
Add 1.21.0 support (#2184)
1 parent 9735a92 commit 381687c

12 files changed

+33
-12
lines changed

src/main/java/cn/nukkit/network/protocol/ContainerClosePacket.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,18 +16,21 @@ public byte pid() {
1616
}
1717

1818
public int windowId;
19+
public int type;
1920
public boolean wasServerInitiated = true;
2021

2122
@Override
2223
public void decode() {
2324
this.windowId = (byte) this.getByte();
25+
this.type = (byte) this.getByte();
2426
this.wasServerInitiated = this.getBoolean();
2527
}
2628

2729
@Override
2830
public void encode() {
2931
this.reset();
3032
this.putByte((byte) this.windowId);
33+
this.putByte((byte) this.type);
3134
this.putBoolean(this.wasServerInitiated);
3235
}
3336
}

src/main/java/cn/nukkit/network/protocol/CraftingDataPacket.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,11 +82,12 @@ public void encode() {
8282
for (Item ingredient : ingredients) {
8383
this.putRecipeIngredient(ingredient);
8484
}
85-
this.putUnsignedVarInt(1);
85+
this.putUnsignedVarInt(1); // Results length
8686
this.putSlot(shapeless.getResult(), true);
8787
this.putUUID(shapeless.getId());
8888
this.putString(CRAFTING_TAG_CRAFTING_TABLE);
8989
this.putVarInt(shapeless.getPriority());
90+
this.putByte((byte) 1); // Requirement ordinal, 1 = ALWAYS_UNLOCKED
9091
this.putUnsignedVarInt(recipeNetworkId++);
9192
break;
9293
case SHAPED:
@@ -111,6 +112,7 @@ public void encode() {
111112
this.putString(CRAFTING_TAG_CRAFTING_TABLE);
112113
this.putVarInt(shaped.getPriority());
113114
this.putBoolean(true); // Assume symmetry
115+
this.putByte((byte) 1); // Requirement ordinal, 1 = ALWAYS_UNLOCKED
114116
this.putUnsignedVarInt(recipeNetworkId++);
115117
break;
116118
case FURNACE:

src/main/java/cn/nukkit/network/protocol/EventPacket.java

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,6 @@ public void decode() {
2121

2222
@Override
2323
public void encode() {
24-
this.reset();
25-
this.putVarLong(this.eid);
26-
this.putVarInt(this.unknown1);
27-
this.putByte(this.unknown2);
24+
2825
}
2926
}

src/main/java/cn/nukkit/network/protocol/ProtocolInfo.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,11 @@ public interface ProtocolInfo {
1414
* Actual Minecraft: PE protocol version
1515
*/
1616
@SuppressWarnings("UnnecessaryBoxing")
17-
int CURRENT_PROTOCOL = Integer.valueOf("671"); // DO NOT REMOVE BOXING
17+
int CURRENT_PROTOCOL = Integer.valueOf("685"); // DO NOT REMOVE BOXING
1818

1919
List<Integer> SUPPORTED_PROTOCOLS = Ints.asList(CURRENT_PROTOCOL);
2020

21-
String MINECRAFT_VERSION_NETWORK = "1.20.80";
21+
String MINECRAFT_VERSION_NETWORK = "1.21.0";
2222
String MINECRAFT_VERSION = 'v' + MINECRAFT_VERSION_NETWORK;
2323

2424
byte BATCH_PACKET = (byte) 0xff;

src/main/java/cn/nukkit/network/protocol/StartGamePacket.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,9 @@ public void encode() {
157157
this.putBoolean(false); // Experimental Gameplay
158158
this.putByte(this.chatRestrictionLevel);
159159
this.putBoolean(this.disablePlayerInteractions);
160+
this.putString(""); // ServerId
161+
this.putString(""); // WorldId
162+
this.putString(""); // ScenarioId
160163
/* Level settings end */
161164
this.putString(this.levelId);
162165
this.putString(this.worldName);

src/main/java/cn/nukkit/network/protocol/TextPacket.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ public byte pid() {
3535
public boolean isLocalized = false;
3636
public String xboxUserId = "";
3737
public String platformChatId = "";
38+
public String filteredMessage = "";
3839

3940
@Override
4041
public void decode() {
@@ -61,6 +62,7 @@ public void decode() {
6162
}
6263
this.xboxUserId = this.getString();
6364
this.platformChatId = this.getString();
65+
this.filteredMessage = this.getString();
6466
}
6567

6668
@Override
@@ -92,5 +94,6 @@ public void encode() {
9294
}
9395
this.putString(this.xboxUserId);
9496
this.putString(this.platformChatId);
97+
this.putString(this.filteredMessage);
9598
}
9699
}

src/main/java/cn/nukkit/network/protocol/types/AuthInputAction.java

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,19 @@ public enum AuthInputAction {
7373
/**
7474
* @since v649
7575
*/
76-
IN_CLIENT_PREDICTED_IN_VEHICLE;
76+
IN_CLIENT_PREDICTED_IN_VEHICLE,
77+
/**
78+
* @since v662
79+
*/
80+
PADDLE_LEFT,
81+
/**
82+
* @since v662
83+
*/
84+
PADDLE_RIGHT,
85+
/**
86+
* @since v685
87+
*/
88+
BLOCK_BREAKING_DELAY_ENABLED;
7789

7890
private static final AuthInputAction[] VALUES = values();
7991

src/main/resources/creative_items.json

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

src/main/resources/item_mappings.json

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

src/main/resources/report_template.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
<!--- Please do not ask questions or create discussion in the bug tracker. Use https://nukkitx.com -->
1+
<!--- Please do not ask questions or create discussion in the bug tracker. Use cloudburstmc.org forum or Discord for that. -->
22
<!--- ONLY POST ISSUES WITH A CLEAN SERVER ON THE LATEST VERSION -->
3+
34
## Generated Bug Report
45

56
<!--- DO NOT OPEN A ISSUE IF THIS IS A PLUGIN ERROR -->

0 commit comments

Comments
 (0)