Skip to content

Commit

Permalink
1.20.30 (#2146)
Browse files Browse the repository at this point in the history
  • Loading branch information
PetteriM1 authored Sep 19, 2023
1 parent 9a84110 commit 10502df
Show file tree
Hide file tree
Showing 13 changed files with 87 additions and 11,345 deletions.
1 change: 1 addition & 0 deletions src/main/java/cn/nukkit/block/BlockID.java
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,7 @@ public interface BlockID {
int BLACK_GLAZED_TERRACOTTA = 235;
int CONCRETE = 236;
int CONCRETE_POWDER = 237;
int CONCRETEPOWDER = 237;

int CHORUS_PLANT = 240;
int STAINED_GLASS = 241;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,10 @@
public class EncryptionUtils {

private static final AesFactory AES_FACTORY;
public static final ECPublicKey MOJANG_PUBLIC_KEY;
public static final ECPublicKey OLD_MOJANG_PUBLIC_KEY;
private static final ECPublicKey MOJANG_PUBLIC_KEY;
private static final SecureRandom SECURE_RANDOM = new SecureRandom();
private static final String MOJANG_PUBLIC_KEY_BASE64 =
"MHYwEAYHKoZIzj0CAQYFK4EEACIDYgAECRXueJeTDqNRRgJi/vlRufByu/2G0i2Ebt6YMar5QX/R0DIIyrJMcUpruK4QveTfJSTp3Shlq4Gk34cD/4GUWwkv0DVuzeuB+tXija7HBxii03NHDbPAD0AKnLr2wdAp";
private static final String OLD_MOJANG_PUBLIC_KEY_BASE64 =
"MHYwEAYHKoZIzj0CAQYFK4EEACIDYgAE8ELkixyLcwlZryUQcu1TvPOmI2B7vX83ndnWRUaXm74wFfa5f/lwQNTfrLVHa2PmenpGI6JhIMUJaWZrjmMj90NoKNFSNBuKdm8rYiXsfaz3K36x/1U26HpG0ZxK/V1V";
private static final KeyPairGenerator KEY_PAIR_GEN;

static {
Expand All @@ -69,7 +66,6 @@ public class EncryptionUtils {
KEY_PAIR_GEN = KeyPairGenerator.getInstance("EC");
KEY_PAIR_GEN.initialize(new ECGenParameterSpec("secp384r1"));
MOJANG_PUBLIC_KEY = generateKey(MOJANG_PUBLIC_KEY_BASE64);
OLD_MOJANG_PUBLIC_KEY = generateKey(OLD_MOJANG_PUBLIC_KEY_BASE64);
} catch (NoSuchAlgorithmException | InvalidAlgorithmParameterException | InvalidKeySpecException e) {
throw new AssertionError("Unable to initialize required encryption", e);
}
Expand Down Expand Up @@ -160,7 +156,7 @@ public static boolean verifyChain(JSONArray chain) throws JOSEException, ParseEx
return !iterator.hasNext();
}

if (lastKey.equals(EncryptionUtils.MOJANG_PUBLIC_KEY) || lastKey.equals(EncryptionUtils.OLD_MOJANG_PUBLIC_KEY)) {
if (lastKey.equals(EncryptionUtils.getMojangPublicKey())) {
validChain = true;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -471,7 +471,14 @@ public class LevelSoundEventPacket extends DataPacket {
public static final int SOUND_SNIFFER_EGG_HATCHED = 467;
public static final int SOUND_WAXED_SIGN_INTERACT_FAIL = 468;
public static final int SOUND_RECORD_RELIC = 469;
public static final int SOUND_UNDEFINED = 470;
public static final int SOUND_BUMP = 470;
public static final int SOUND_PUMPKIN_CARVE = 471;
public static final int SOUND_CONVERT_HUSK_TO_ZOMBIE = 472;
public static final int SOUND_PIG_DEATH = 473;
public static final int SOUND_HOGLIN_CONVERT_TO_ZOMBIE = 474;
public static final int SOUND_AMBIENT_UNDERWATER_ENTER = 475;
public static final int SOUND_AMBIENT_UNDERWATER_EXIT = 476;
public static final int SOUND_UNDEFINED = 477;

public int sound;
public float x;
Expand Down
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("594"); // DO NOT REMOVE BOXING
int CURRENT_PROTOCOL = Integer.valueOf("618"); // DO NOT REMOVE BOXING

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

String MINECRAFT_VERSION_NETWORK = "1.20.10";
String MINECRAFT_VERSION_NETWORK = "1.20.30";
String MINECRAFT_VERSION = 'v' + MINECRAFT_VERSION_NETWORK;

byte BATCH_PACKET = (byte) 0xff;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
package cn.nukkit.network.protocol;

import cn.nukkit.resourcepacks.ResourcePack;
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
import lombok.ToString;
import lombok.Value;

import java.util.List;

@ToString
public class ResourcePacksInfoPacket extends DataPacket {
Expand All @@ -13,6 +17,7 @@ public class ResourcePacksInfoPacket extends DataPacket {
public boolean forceServerPacks;
public ResourcePack[] behaviourPackEntries = new ResourcePack[0];
public ResourcePack[] resourcePackEntries = new ResourcePack[0];
public List<CDNEntry> CDNEntries = new ObjectArrayList<>();

@Override
public void decode() {
Expand All @@ -27,6 +32,12 @@ public void encode() {
this.putBoolean(this.forceServerPacks);
this.encodeBehaviourPacks(this.behaviourPackEntries);
this.encodeResourcePacks(this.resourcePackEntries);

this.putUnsignedVarInt(this.CDNEntries.size());
this.CDNEntries.forEach((entry) -> {
this.putString(entry.getPackId());
this.putString(entry.getRemoteUrl());
});
}

private void encodeBehaviourPacks(ResourcePack[] packs) {
Expand Down Expand Up @@ -60,4 +71,10 @@ private void encodeResourcePacks(ResourcePack[] packs) {
public byte pid() {
return NETWORK_ID;
}

@Value
public static class CDNEntry {
String packId;
String remoteUrl;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,34 @@ public enum AuthInputAction {
PERFORM_ITEM_INTERACTION,
PERFORM_BLOCK_ACTIONS,
PERFORM_ITEM_STACK_REQUEST,
HANDLE_TELEPORT;
/**
* @since v567
*/
HANDLE_TELEPORT,
/**
* @since v575
*/
EMOTING,
/**
* @since v594
*/
MISSED_SWING,
/**
* @since v594
*/
START_CRAWLING,
/**
* @since v594
*/
STOP_CRAWLING,
/**
* @since v618
*/
START_FLYING,
/**
* @since v618
*/
STOP_FLYING;

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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,30 @@ public enum PlayerActionType {
CONTINUE_DESTROY_BLOCK,
START_ITEM_USE_ON,
STOP_ITEM_USE_ON,
HANDLED_TELEPORT;
/**
* @since v567
*/
HANDLED_TELEPORT,
/**
* @since v594
*/
MISSED_SWING,
/**
* @since v594
*/
START_CRAWLING,
/**
* @since v594
*/
STOP_CRAWLING,
/**
* @since v618
*/
START_FLYING,
/**
* @since v618
*/
STOP_FLYING;

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

Expand Down
2 changes: 1 addition & 1 deletion src/main/java/cn/nukkit/utils/ClientChainData.java
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ private boolean verifyChain(List<String> chains) throws Exception {
return !iterator.hasNext();
}

if (lastKey.equals(EncryptionUtils.MOJANG_PUBLIC_KEY) || lastKey.equals(EncryptionUtils.OLD_MOJANG_PUBLIC_KEY)) {
if (lastKey.equals(EncryptionUtils.getMojangPublicKey())) {
mojangKeyVerified = true;
}

Expand Down
Loading

0 comments on commit 10502df

Please sign in to comment.