Skip to content

Commit

Permalink
Add 1.21.0 support (#2184)
Browse files Browse the repository at this point in the history
  • Loading branch information
PetteriM1 authored Jun 13, 2024
1 parent 9735a92 commit 381687c
Show file tree
Hide file tree
Showing 12 changed files with 33 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,21 @@ public byte pid() {
}

public int windowId;
public int type;
public boolean wasServerInitiated = true;

@Override
public void decode() {
this.windowId = (byte) this.getByte();
this.type = (byte) this.getByte();
this.wasServerInitiated = this.getBoolean();
}

@Override
public void encode() {
this.reset();
this.putByte((byte) this.windowId);
this.putByte((byte) this.type);
this.putBoolean(this.wasServerInitiated);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -82,11 +82,12 @@ public void encode() {
for (Item ingredient : ingredients) {
this.putRecipeIngredient(ingredient);
}
this.putUnsignedVarInt(1);
this.putUnsignedVarInt(1); // Results length
this.putSlot(shapeless.getResult(), true);
this.putUUID(shapeless.getId());
this.putString(CRAFTING_TAG_CRAFTING_TABLE);
this.putVarInt(shapeless.getPriority());
this.putByte((byte) 1); // Requirement ordinal, 1 = ALWAYS_UNLOCKED
this.putUnsignedVarInt(recipeNetworkId++);
break;
case SHAPED:
Expand All @@ -111,6 +112,7 @@ public void encode() {
this.putString(CRAFTING_TAG_CRAFTING_TABLE);
this.putVarInt(shaped.getPriority());
this.putBoolean(true); // Assume symmetry
this.putByte((byte) 1); // Requirement ordinal, 1 = ALWAYS_UNLOCKED
this.putUnsignedVarInt(recipeNetworkId++);
break;
case FURNACE:
Expand Down
5 changes: 1 addition & 4 deletions src/main/java/cn/nukkit/network/protocol/EventPacket.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,6 @@ public void decode() {

@Override
public void encode() {
this.reset();
this.putVarLong(this.eid);
this.putVarInt(this.unknown1);
this.putByte(this.unknown2);

}
}
4 changes: 2 additions & 2 deletions src/main/java/cn/nukkit/network/protocol/ProtocolInfo.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ public interface ProtocolInfo {
* Actual Minecraft: PE protocol version
*/
@SuppressWarnings("UnnecessaryBoxing")
int CURRENT_PROTOCOL = Integer.valueOf("671"); // DO NOT REMOVE BOXING
int CURRENT_PROTOCOL = Integer.valueOf("685"); // DO NOT REMOVE BOXING

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

String MINECRAFT_VERSION_NETWORK = "1.20.80";
String MINECRAFT_VERSION_NETWORK = "1.21.0";
String MINECRAFT_VERSION = 'v' + MINECRAFT_VERSION_NETWORK;

byte BATCH_PACKET = (byte) 0xff;
Expand Down
3 changes: 3 additions & 0 deletions src/main/java/cn/nukkit/network/protocol/StartGamePacket.java
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,9 @@ public void encode() {
this.putBoolean(false); // Experimental Gameplay
this.putByte(this.chatRestrictionLevel);
this.putBoolean(this.disablePlayerInteractions);
this.putString(""); // ServerId
this.putString(""); // WorldId
this.putString(""); // ScenarioId
/* Level settings end */
this.putString(this.levelId);
this.putString(this.worldName);
Expand Down
3 changes: 3 additions & 0 deletions src/main/java/cn/nukkit/network/protocol/TextPacket.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ public byte pid() {
public boolean isLocalized = false;
public String xboxUserId = "";
public String platformChatId = "";
public String filteredMessage = "";

@Override
public void decode() {
Expand All @@ -61,6 +62,7 @@ public void decode() {
}
this.xboxUserId = this.getString();
this.platformChatId = this.getString();
this.filteredMessage = this.getString();
}

@Override
Expand Down Expand Up @@ -92,5 +94,6 @@ public void encode() {
}
this.putString(this.xboxUserId);
this.putString(this.platformChatId);
this.putString(this.filteredMessage);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,19 @@ public enum AuthInputAction {
/**
* @since v649
*/
IN_CLIENT_PREDICTED_IN_VEHICLE;
IN_CLIENT_PREDICTED_IN_VEHICLE,
/**
* @since v662
*/
PADDLE_LEFT,
/**
* @since v662
*/
PADDLE_RIGHT,
/**
* @since v685
*/
BLOCK_BREAKING_DELAY_ENABLED;

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

Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/creative_items.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/main/resources/item_mappings.json

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion src/main/resources/report_template.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<!--- Please do not ask questions or create discussion in the bug tracker. Use https://nukkitx.com -->
<!--- Please do not ask questions or create discussion in the bug tracker. Use cloudburstmc.org forum or Discord for that. -->
<!--- ONLY POST ISSUES WITH A CLEAN SERVER ON THE LATEST VERSION -->

## Generated Bug Report

<!--- DO NOT OPEN A ISSUE IF THIS IS A PLUGIN ERROR -->
Expand Down
Binary file modified src/main/resources/runtime_block_states.dat
Binary file not shown.
2 changes: 1 addition & 1 deletion src/main/resources/runtime_item_states.json

Large diffs are not rendered by default.

0 comments on commit 381687c

Please sign in to comment.