Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

1.21.30 #2198

Merged
merged 4 commits into from
Sep 18, 2024
Merged

1.21.30 #2198

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,18 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v4
with:
submodules: true
- name: SetupJDK
uses: actions/setup-java@v3
uses: actions/setup-java@v4
with:
java-version: 8
distribution: 'temurin'
- name: Validate Gradle Wrapper
uses: gradle/wrapper-validation-action@v1
uses: gradle/wrapper-validation-action@v3
- name: Build
uses: gradle/gradle-build-action@v2
uses: gradle/gradle-build-action@v3
with:
gradle-version: wrapper
arguments: "publishNukkitPublicationToOpencollabRepository"
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,25 +8,25 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v4
with:
submodules: true
- name: SetupJDK
uses: actions/setup-java@v3
uses: actions/setup-java@v4
with:
java-version: 8
distribution: 'temurin'
- name: Validate Gradle Wrapper
uses: gradle/wrapper-validation-action@v1
uses: gradle/wrapper-validation-action@v3
- name: Build
uses: gradle/gradle-build-action@v2
uses: gradle/gradle-build-action@v3
with:
gradle-version: wrapper
arguments: "shadowJar"
env:
GRADLE_OPTS: "-Dorg.gradle.daemon=false -Dorg.gradle.caching=true -Dorg.gradle.welcome=never"
- name: Archive artifacts
uses: actions/upload-artifact@v1
uses: actions/upload-artifact@v4
if: success()
with:
name: Nukkit
Expand Down
11 changes: 5 additions & 6 deletions src/main/java/cn/nukkit/command/defaults/EffectCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -71,12 +71,11 @@ public boolean execute(CommandSender sender, String commandLabel, String[] args)
try {
effect = Effect.getEffect(Integer.parseInt(args[1]));
} catch (NumberFormatException | ServerException a) {
try {
effect = Effect.getEffectByName(args[1]);
} catch (Exception e) {
sender.sendMessage(new TranslationContainer("commands.effect.notFound", args[1]));
return true;
}
effect = Effect.getEffectByName(args[1]);
}
if (effect == null) {
sender.sendMessage(new TranslationContainer("commands.effect.notFound", args[1]));
return true;
}
int duration = 300;
int amplification = 0;
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/cn/nukkit/entity/Entity.java
Original file line number Diff line number Diff line change
Expand Up @@ -1090,7 +1090,7 @@ protected DataPacket createAddEntityPacket() {

addEntity.links = new EntityLink[this.passengers.size()];
for (int i = 0; i < addEntity.links.length; i++) {
addEntity.links[i] = new EntityLink(this.getId(), this.passengers.get(i).getId(), i == 0 ? EntityLink.TYPE_RIDER : TYPE_PASSENGER, false, false);
addEntity.links[i] = new EntityLink(this.getId(), this.passengers.get(i).getId(), i == 0 ? EntityLink.TYPE_RIDER : TYPE_PASSENGER, false, false, 0f);
}

return addEntity;
Expand Down
10 changes: 5 additions & 5 deletions src/main/java/cn/nukkit/network/Network.java
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public class Network {
public static final byte CHANNEL_TEXT = 7; //Chat and other text stuff
public static final byte CHANNEL_END = 31;

private Class<? extends DataPacket>[] packetPool = new Class[512];
private Class<? extends DataPacket>[] packetPool = new Class[256];

private final Server server;

Expand Down Expand Up @@ -245,8 +245,8 @@ public void processBatch(byte[] payload, Collection<DataPacket> packets, Compres
// | 2 bits | 2 bits | 10 bits |
int packetId = header & 0x3ff;

DataPacket pk = this.getPacket(packetId);

// Use internal backwards compatible IDs until pid() is rewritten
DataPacket pk = this.getPacket(packetId >= 300 ? packetId - 100 : packetId);
if (pk != null) {
pk.setBuffer(buf, buf.length - bais.available());
try {
Expand All @@ -261,7 +261,7 @@ public void processBatch(byte[] payload, Collection<DataPacket> packets, Compres

packets.add(pk);
} else {
log.debug("Received unknown packet with ID: {}", Integer.toHexString(packetId));
log.debug("Received unknown packet with vanilla ID 0x{}", Integer.toHexString(packetId));
}
}
} catch (Exception e) {
Expand Down Expand Up @@ -308,7 +308,7 @@ public void unblockAddress(InetAddress address) {
}

private void registerPackets() {
this.packetPool = new Class[512];
this.packetPool = new Class[256];

this.registerPacket(ProtocolInfo.ADD_ENTITY_PACKET, AddEntityPacket.class);
this.registerPacket(ProtocolInfo.ADD_ITEM_ENTITY_PACKET, AddItemEntityPacket.class);
Expand Down
6 changes: 6 additions & 0 deletions src/main/java/cn/nukkit/network/protocol/AddEntityPacket.java
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,12 @@ public class AddEntityPacket extends DataPacket {
.put(EntityTadpole.NETWORK_ID, "minecraft:tadpole")
.put(EntityAllay.NETWORK_ID, "minecraft:allay")
.put(138, "minecraft:camel")
.put(139, "minecraft:sniffer")
.put(140, "minecraft:breeze")
.put(141, "minecraft:breeze_wind_charge_projectile")
.put(142, "minecraft:armadillo")
.put(143, "minecraft:wind_charge_projectile")
.put(144, "minecraft:bogged")
.build();

@Override
Expand Down
3 changes: 3 additions & 0 deletions src/main/java/cn/nukkit/network/protocol/EmotePacket.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ public class EmotePacket extends DataPacket {
public String platformId;
public String emoteID;
public byte flags;
public long emoteTicks;

@Override
public byte pid() {
Expand All @@ -20,6 +21,7 @@ public byte pid() {
public void decode() {
this.runtimeId = this.getEntityRuntimeId();
this.emoteID = this.getString();
this.emoteTicks = this.getUnsignedVarInt();
this.xuid = this.getString();
this.platformId = this.getString();
this.flags = (byte) this.getByte();
Expand All @@ -30,6 +32,7 @@ public void encode() {
this.reset();
this.putEntityRuntimeId(this.runtimeId);
this.putString(this.emoteID);
this.putUnsignedVarInt(this.emoteTicks);
this.putString(this.xuid);
this.putString(this.platformId);
this.putByte(flags);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ public byte pid() {

public int inventoryId;
public Item[] slots = new Item[0];
public int dynamicContainerId;

@Override
public DataPacket clean() {
Expand All @@ -46,7 +45,9 @@ public void encode() {
for (Item slot : this.slots) {
this.putSlot(slot);
}
this.putUnsignedVarInt(this.dynamicContainerId);
this.putByte((byte) 0); // fullContainerName.id
this.putBoolean(false); // fullContainerName.optional.present
this.putUnsignedVarInt(0); // dynamicContainerSize
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ public byte pid() {
public int inventoryId;
public int slot;
public Item item;
public int dynamicContainerId;

@Override
public void decode() {
Expand All @@ -31,7 +30,9 @@ public void encode() {
this.reset();
this.putUnsignedVarInt(this.inventoryId);
this.putUnsignedVarInt(this.slot);
this.putUnsignedVarInt(this.dynamicContainerId);
this.putByte((byte) 0); // fullContainerName.id
this.putBoolean(false); // fullContainerName.optional.present
this.putUnsignedVarInt(0); // dynamicContainerSize
this.putSlot(this.item);
}
}
6 changes: 4 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("712"); // DO NOT REMOVE BOXING
int CURRENT_PROTOCOL = Integer.valueOf("729"); // DO NOT REMOVE BOXING

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

String MINECRAFT_VERSION_NETWORK = "1.21.20";
String MINECRAFT_VERSION_NETWORK = "1.21.30";
String MINECRAFT_VERSION = 'v' + MINECRAFT_VERSION_NETWORK;

byte BATCH_PACKET = (byte) 0xff;
Expand Down Expand Up @@ -235,4 +235,6 @@ public interface ProtocolInfo {
byte __INTERNAL__JIGSAW_STRUCTURE_DATA_PACKET = (byte) 213;
byte __INTERNAL__CURRENT_STRUCTURE_FEATURE_PACKET = (byte) 214;
byte __INTERNAL__SERVERBOUND_DIAGNOSTICS_PACKET = (byte) 215;
byte __INTERNAL__CAMERA_AIM_ASSIST_PACKET = (byte) 216;
byte __INTERNAL__CONTAINER_REGISTRY_CLEANUP_PACKET = (byte) 217;
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ public class ResourcePackStackPacket extends DataPacket {
public static final byte NETWORK_ID = ProtocolInfo.RESOURCE_PACK_STACK_PACKET;

public boolean mustAccept = false;
public ResourcePack[] behaviourPackStack = new ResourcePack[0];
public ResourcePack[] resourcePackStack = new ResourcePack[0];
public ResourcePack[] behaviourPackStack = ResourcePack.EMPTY_ARRAY;
public ResourcePack[] resourcePackStack = ResourcePack.EMPTY_ARRAY;
public boolean isExperimental = false;
public String gameVersion = ProtocolInfo.MINECRAFT_VERSION_NETWORK;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,11 @@ public class ResourcePacksInfoPacket extends DataPacket {

public boolean mustAccept;
public boolean scripting;
public boolean forceServerPacks;
@Deprecated
public boolean forceServerPacks; // pre 1.21.30
public boolean hasAddonPacks;
public ResourcePack[] behaviourPackEntries = new ResourcePack[0];
public ResourcePack[] resourcePackEntries = new ResourcePack[0];
public ResourcePack[] behaviourPackEntries = ResourcePack.EMPTY_ARRAY;
public ResourcePack[] resourcePackEntries = ResourcePack.EMPTY_ARRAY;
public List<CDNEntry> CDNEntries = new ObjectArrayList<>();

@Override
Expand All @@ -31,8 +32,7 @@ public void encode() {
this.putBoolean(this.mustAccept);
this.putBoolean(this.hasAddonPacks);
this.putBoolean(this.scripting);
this.putBoolean(this.forceServerPacks);
this.encodeBehaviourPacks(this.behaviourPackEntries);

this.encodeResourcePacks(this.resourcePackEntries);

this.putUnsignedVarInt(this.CDNEntries.size());
Expand All @@ -42,19 +42,6 @@ public void encode() {
});
}

private void encodeBehaviourPacks(ResourcePack[] packs) {
this.putLShort(packs.length);
for (ResourcePack entry : packs) {
this.putString(entry.getPackId().toString());
this.putString(entry.getPackVersion());
this.putLLong(entry.getPackSize());
this.putString(entry.getEncryptionKey());
this.putString(""); // sub-pack name
this.putString(!entry.getEncryptionKey().isEmpty() ? entry.getPackId().toString() : "");
this.putBoolean(false); // scripting
}
}

private void encodeResourcePacks(ResourcePack[] packs) {
this.putLShort(packs.length);
for (ResourcePack entry : packs) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ public void encode() {
this.reset();
this.putString(address);
this.putLShort(port);
this.putBoolean(false); // reloadWorld
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ public void encode() {
this.putLFloat(entry.getMinValue());
this.putLFloat(entry.getMaxValue());
this.putLFloat(entry.getValue());
this.putLFloat(entry.getMinValue()); // defaultMinValue
this.putLFloat(entry.getMaxValue()); // defaultMaxValue
this.putLFloat(entry.getDefaultValue());
this.putString(entry.getName());
this.putUnsignedVarInt(0); // Modifiers
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,23 @@ public enum AuthInputAction {
/**
* @since v685
*/
BLOCK_BREAKING_DELAY_ENABLED;
BLOCK_BREAKING_DELAY_ENABLED,
/**
* @since v729
*/
HORIZONTAL_COLLISION,
/**
* @since v729
*/
VERTICAL_COLLISION,
/**
* @since v729
*/
DOWN_LEFT,
/**
* @since v729
*/
DOWN_RIGHT;

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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ public class EntityLink {
public boolean riderInitiated;
public float vehicleAngularVelocity;

@Deprecated
public EntityLink(long fromEntityUniquieId, long toEntityUniquieId, byte type, boolean immediate, boolean riderInitiated) {
this(fromEntityUniquieId, toEntityUniquieId, type, immediate, riderInitiated, 0f);
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/creative_items.json

Large diffs are not rendered by default.

Loading
Loading