Skip to content

Commit

Permalink
Support MCBE 1.20.50
Browse files Browse the repository at this point in the history
  • Loading branch information
Kaooot committed Nov 17, 2023
1 parent c2196f5 commit 225a0d7
Show file tree
Hide file tree
Showing 15 changed files with 31,167 additions and 6 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
Upstream is the NukkitX major version
PN is an indicator that software is running PowerNukkit, it must be present both in releases and snapshot versions
-->
<version>1.20.40</version>
<version>1.20.50</version>

<inceptionYear>2020</inceptionYear>
<organization>
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/cn/nukkit/network/protocol/Protocol.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ public enum Protocol {
V1_20_0(589, "1.20.0", 11),
V1_20_10(594, "1.20.10", 11),
V1_20_30(618, "1.20.30", 11),
V1_20_40(622, "1.20.40", 11);
V1_20_40(622, "1.20.40", 11),
V1_20_50(630, "1.20.50", 11);

private final int version;
private final String minecraftVersion;
Expand Down
16 changes: 14 additions & 2 deletions src/main/java/cn/nukkit/network/protocol/ShowStoreOfferPacket.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package cn.nukkit.network.protocol;

import cn.nukkit.network.protocol.types.StoreOfferRedirectType;

/**
* @author Kaooot
* @version 1.0
Expand All @@ -8,6 +10,7 @@ public class ShowStoreOfferPacket extends DataPacket {

public String offerId;
public boolean showAll;
public StoreOfferRedirectType redirectType;

@Override
public byte pid() {
Expand All @@ -17,13 +20,22 @@ public byte pid() {
@Override
public void decode() {
this.offerId = this.getString();
this.showAll = this.getBoolean();

if (this.protocolVersion < Protocol.V1_20_50.version()) {
this.showAll = this.getBoolean();
} else {
this.redirectType = StoreOfferRedirectType.values()[this.getByte()];
}
}

@Override
public void encode() {
this.reset();
this.putString(this.offerId);
this.putBoolean(this.showAll);
if (this.protocolVersion < Protocol.V1_20_50.version()) {
this.putBoolean(this.showAll);
} else {
this.putByte((byte) this.redirectType.ordinal());
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package cn.nukkit.network.protocol.types;

public enum StoreOfferRedirectType {

MARKETPLACE,
DRESSING_ROOM,
THIRD_PARTY_SERVER_PAGE
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ public class ItemEntryUpdaterBuilder {
build(Protocol.V1_20_0, "0111_1.19.80_to_1.20.0.23_beta.json"),
build(Protocol.V1_20_10, "0121_1.20.0.23_beta_to_1.20.10.24_beta.json"),
//build(Protocol.V1_20_20, "0131_1.20.10.24_beta_to_1.20.20.23_beta.json"),
build(Protocol.V1_20_30, "0141_1.20.20.23_beta_to_1.20.30.22_beta.json")
build(Protocol.V1_20_30, "0141_1.20.20.23_beta_to_1.20.30.22_beta.json"),
build(Protocol.V1_20_50, "0151_1.20.30.22_beta_to_1.20.50.23_beta.json")
);
}

Expand Down
Loading

0 comments on commit 225a0d7

Please sign in to comment.