-
Notifications
You must be signed in to change notification settings - Fork 94
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Start working on MCBE 1.20.50 support
- Loading branch information
Showing
22 changed files
with
394 additions
and
5 deletions.
There are no files selected for viewing
70 changes: 70 additions & 0 deletions
70
bedrock-codec/src/main/java/org/cloudburstmc/protocol/bedrock/codec/v630/Bedrock_v630.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
package org.cloudburstmc.protocol.bedrock.codec.v630; | ||
|
||
import org.cloudburstmc.protocol.bedrock.codec.BedrockCodec; | ||
import org.cloudburstmc.protocol.bedrock.codec.v291.serializer.LevelEventSerializer_v291; | ||
import org.cloudburstmc.protocol.bedrock.codec.v291.serializer.LevelSoundEvent1Serializer_v291; | ||
import org.cloudburstmc.protocol.bedrock.codec.v313.serializer.LevelSoundEvent2Serializer_v313; | ||
import org.cloudburstmc.protocol.bedrock.codec.v332.serializer.LevelSoundEventSerializer_v332; | ||
import org.cloudburstmc.protocol.bedrock.codec.v361.serializer.LevelEventGenericSerializer_v361; | ||
import org.cloudburstmc.protocol.bedrock.codec.v575.BedrockCodecHelper_v575; | ||
import org.cloudburstmc.protocol.bedrock.codec.v622.Bedrock_v622; | ||
import org.cloudburstmc.protocol.bedrock.codec.v630.serializer.ServerPostMovePositionSerializer_v630; | ||
import org.cloudburstmc.protocol.bedrock.codec.v630.serializer.SetPlayerInventoryOptionsSerializer_v360; | ||
import org.cloudburstmc.protocol.bedrock.codec.v630.serializer.ShowStoreOfferSerializer_v630; | ||
import org.cloudburstmc.protocol.bedrock.codec.v630.serializer.ToggleCrafterSlotRequestSerializer_v630; | ||
import org.cloudburstmc.protocol.bedrock.data.LevelEvent; | ||
import org.cloudburstmc.protocol.bedrock.data.LevelEventType; | ||
import org.cloudburstmc.protocol.bedrock.data.ParticleType; | ||
import org.cloudburstmc.protocol.bedrock.data.SoundEvent; | ||
import org.cloudburstmc.protocol.bedrock.data.inventory.ContainerSlotType; | ||
import org.cloudburstmc.protocol.bedrock.packet.*; | ||
import org.cloudburstmc.protocol.common.util.TypeMap; | ||
|
||
public class Bedrock_v630 extends Bedrock_v622 { | ||
|
||
protected static final TypeMap<ParticleType> PARTICLE_TYPES = Bedrock_v622.PARTICLE_TYPES | ||
.toBuilder() | ||
.insert(87, ParticleType.DUST_PLUME) | ||
.insert(88, ParticleType.WHITE_SMOKE) | ||
.build(); | ||
|
||
protected static final TypeMap<LevelEventType> LEVEL_EVENTS = Bedrock_v622.LEVEL_EVENTS.toBuilder() | ||
.insert(LEVEL_EVENT_PARTICLE + 40, LevelEvent.DUST_PLUME) | ||
.replace(LEVEL_EVENT_BLOCK + 109, LevelEvent.PARTICLE_SHOOT_WHITE_SMOKE) | ||
.insert(LEVEL_EVENT_BLOCK + 110, LevelEvent.ALL_PLAYERS_SLEEPING) | ||
.insert(LEVEL_EVENT_PARTICLE_TYPE, PARTICLE_TYPES) | ||
.build(); | ||
|
||
protected static final TypeMap<ContainerSlotType> CONTAINER_SLOT_TYPES = Bedrock_v622.CONTAINER_SLOT_TYPES.toBuilder() | ||
.insert(62, ContainerSlotType.CRAFTER_BLOCK_CONTAINER) | ||
.build(); | ||
|
||
protected static final TypeMap<SoundEvent> SOUND_EVENTS = Bedrock_v622.SOUND_EVENTS | ||
.toBuilder() | ||
.replace(479, SoundEvent.CRAFTER_CRAFT) | ||
.insert(480, SoundEvent.CRAFTER_FAILED) | ||
.insert(481, SoundEvent.DECORATED_POT_INSERT) | ||
.insert(482, SoundEvent.DECORATED_POT_INSERT_FAILED) | ||
.insert(483, SoundEvent.CRAFTER_DISABLE_SLOT) | ||
.insert(490, SoundEvent.COPPER_BULB_ON) | ||
.insert(491, SoundEvent.COPPER_BULB_OFF) | ||
.insert(492, SoundEvent.UNDEFINED) | ||
.build(); | ||
|
||
|
||
public static final BedrockCodec CODEC = Bedrock_v622.CODEC.toBuilder() | ||
.raknetProtocolVersion(11) | ||
.protocolVersion(630) | ||
.minecraftVersion("1.20.50") | ||
.helper(() -> new BedrockCodecHelper_v575(ENTITY_DATA, GAME_RULE_TYPES, ITEM_STACK_REQUEST_TYPES, CONTAINER_SLOT_TYPES, PLAYER_ABILITIES, TEXT_PROCESSING_ORIGINS)) | ||
.updateSerializer(LevelEventPacket.class, new LevelEventSerializer_v291(LEVEL_EVENTS)) | ||
.updateSerializer(LevelEventGenericPacket.class, new LevelEventGenericSerializer_v361(LEVEL_EVENTS)) | ||
.updateSerializer(LevelSoundEvent1Packet.class, new LevelSoundEvent1Serializer_v291(SOUND_EVENTS)) | ||
.updateSerializer(LevelSoundEvent2Packet.class, new LevelSoundEvent2Serializer_v313(SOUND_EVENTS)) | ||
.updateSerializer(LevelSoundEventPacket.class, new LevelSoundEventSerializer_v332(SOUND_EVENTS)) | ||
.updateSerializer(ShowStoreOfferPacket.class, ShowStoreOfferSerializer_v630.INSTANCE) | ||
.registerPacket(ServerPostMovePositionPacket::new, new ServerPostMovePositionSerializer_v630(), 16) | ||
.registerPacket(ToggleCrafterSlotRequestPacket::new, new ToggleCrafterSlotRequestSerializer_v630(), 306) | ||
.registerPacket(SetPlayerInventoryOptionsPacket::new, new SetPlayerInventoryOptionsSerializer_v360(), 307) | ||
.build(); | ||
} |
19 changes: 19 additions & 0 deletions
19
...burstmc/protocol/bedrock/codec/v630/serializer/ServerPostMovePositionSerializer_v630.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package org.cloudburstmc.protocol.bedrock.codec.v630.serializer; | ||
|
||
import io.netty.buffer.ByteBuf; | ||
import org.cloudburstmc.protocol.bedrock.codec.BedrockCodecHelper; | ||
import org.cloudburstmc.protocol.bedrock.codec.BedrockPacketSerializer; | ||
import org.cloudburstmc.protocol.bedrock.packet.ServerPostMovePositionPacket; | ||
|
||
public class ServerPostMovePositionSerializer_v630 implements BedrockPacketSerializer<ServerPostMovePositionPacket> { | ||
|
||
@Override | ||
public void serialize(ByteBuf buffer, BedrockCodecHelper helper, ServerPostMovePositionPacket packet) { | ||
helper.writeVector3f(buffer, packet.getPosition()); | ||
} | ||
|
||
@Override | ||
public void deserialize(ByteBuf buffer, BedrockCodecHelper helper, ServerPostMovePositionPacket packet) { | ||
packet.setPosition(helper.readVector3f(buffer)); | ||
} | ||
} |
31 changes: 31 additions & 0 deletions
31
...stmc/protocol/bedrock/codec/v630/serializer/SetPlayerInventoryOptionsSerializer_v360.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package org.cloudburstmc.protocol.bedrock.codec.v630.serializer; | ||
|
||
import io.netty.buffer.ByteBuf; | ||
import org.cloudburstmc.protocol.bedrock.codec.BedrockCodecHelper; | ||
import org.cloudburstmc.protocol.bedrock.codec.BedrockPacketSerializer; | ||
import org.cloudburstmc.protocol.bedrock.data.inventory.InventoryLayout; | ||
import org.cloudburstmc.protocol.bedrock.data.inventory.InventoryTabLeft; | ||
import org.cloudburstmc.protocol.bedrock.data.inventory.InventoryTabRight; | ||
import org.cloudburstmc.protocol.bedrock.packet.SetPlayerInventoryOptionsPacket; | ||
import org.cloudburstmc.protocol.common.util.VarInts; | ||
|
||
public class SetPlayerInventoryOptionsSerializer_v360 implements BedrockPacketSerializer<SetPlayerInventoryOptionsPacket> { | ||
|
||
@Override | ||
public void serialize(ByteBuf buffer, BedrockCodecHelper helper, SetPlayerInventoryOptionsPacket packet) { | ||
VarInts.writeInt(buffer, packet.getLeftTab().ordinal()); | ||
VarInts.writeInt(buffer, packet.getRightTab().ordinal()); | ||
buffer.writeBoolean(packet.isFiltering()); | ||
VarInts.writeInt(buffer, packet.getLayout().ordinal()); | ||
VarInts.writeInt(buffer, packet.getCraftingLayout().ordinal()); | ||
} | ||
|
||
@Override | ||
public void deserialize(ByteBuf buffer, BedrockCodecHelper helper, SetPlayerInventoryOptionsPacket packet) { | ||
packet.setLeftTab(InventoryTabLeft.VALUES[VarInts.readInt(buffer)]); | ||
packet.setRightTab(InventoryTabRight.VALUES[VarInts.readInt(buffer)]); | ||
packet.setFiltering(buffer.readBoolean()); | ||
packet.setLayout(InventoryLayout.VALUES[VarInts.readInt(buffer)]); | ||
packet.setCraftingLayout(InventoryLayout.VALUES[VarInts.readInt(buffer)]); | ||
} | ||
} |
23 changes: 23 additions & 0 deletions
23
...rg/cloudburstmc/protocol/bedrock/codec/v630/serializer/ShowStoreOfferSerializer_v630.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package org.cloudburstmc.protocol.bedrock.codec.v630.serializer; | ||
|
||
import io.netty.buffer.ByteBuf; | ||
import org.cloudburstmc.protocol.bedrock.codec.BedrockCodecHelper; | ||
import org.cloudburstmc.protocol.bedrock.codec.v291.serializer.ShowStoreOfferSerializer_v291; | ||
import org.cloudburstmc.protocol.bedrock.data.StoreOfferRedirectType; | ||
import org.cloudburstmc.protocol.bedrock.packet.ShowStoreOfferPacket; | ||
|
||
public class ShowStoreOfferSerializer_v630 extends ShowStoreOfferSerializer_v291 { | ||
public static final ShowStoreOfferSerializer_v630 INSTANCE = new ShowStoreOfferSerializer_v630(); | ||
|
||
@Override | ||
public void serialize(ByteBuf buffer, BedrockCodecHelper helper, ShowStoreOfferPacket packet) { | ||
helper.writeString(buffer, packet.getOfferId()); | ||
buffer.writeByte(packet.getRedirectType().ordinal()); | ||
} | ||
|
||
@Override | ||
public void deserialize(ByteBuf buffer, BedrockCodecHelper helper, ShowStoreOfferPacket packet) { | ||
packet.setOfferId(helper.readString(buffer)); | ||
packet.setRedirectType(StoreOfferRedirectType.values()[buffer.readUnsignedByte()]); | ||
} | ||
} |
29 changes: 29 additions & 0 deletions
29
...rstmc/protocol/bedrock/codec/v630/serializer/ToggleCrafterSlotRequestSerializer_v630.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package org.cloudburstmc.protocol.bedrock.codec.v630.serializer; | ||
|
||
import io.netty.buffer.ByteBuf; | ||
import org.cloudburstmc.math.vector.Vector3i; | ||
import org.cloudburstmc.protocol.bedrock.codec.BedrockCodecHelper; | ||
import org.cloudburstmc.protocol.bedrock.codec.BedrockPacketSerializer; | ||
import org.cloudburstmc.protocol.bedrock.packet.ToggleCrafterSlotRequestPacket; | ||
|
||
public class ToggleCrafterSlotRequestSerializer_v630 implements BedrockPacketSerializer<ToggleCrafterSlotRequestPacket> { | ||
|
||
@Override | ||
public void serialize(ByteBuf buffer, BedrockCodecHelper helper, ToggleCrafterSlotRequestPacket packet) { | ||
buffer.writeIntLE(packet.getBlockPosition().getX()); | ||
buffer.writeIntLE(packet.getBlockPosition().getY()); | ||
buffer.writeIntLE(packet.getBlockPosition().getZ()); | ||
buffer.writeByte(packet.getSlot()); | ||
buffer.writeBoolean(packet.isDisabled()); | ||
} | ||
|
||
@Override | ||
public void deserialize(ByteBuf buffer, BedrockCodecHelper helper, ToggleCrafterSlotRequestPacket packet) { | ||
int x = buffer.readIntLE(); | ||
int y = buffer.readIntLE(); | ||
int z = buffer.readIntLE(); | ||
packet.setBlockPosition(Vector3i.from(x, y, z)); | ||
packet.setSlot(buffer.readByte()); | ||
packet.setDisabled(buffer.readBoolean()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 7 additions & 0 deletions
7
...ck-codec/src/main/java/org/cloudburstmc/protocol/bedrock/data/StoreOfferRedirectType.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package org.cloudburstmc.protocol.bedrock.data; | ||
|
||
public enum StoreOfferRedirectType { | ||
MARKETPLACE, | ||
DRESSING_ROOM, | ||
THIRD_PARTY_SERVER_PAGE | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 10 additions & 0 deletions
10
...codec/src/main/java/org/cloudburstmc/protocol/bedrock/data/inventory/InventoryLayout.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package org.cloudburstmc.protocol.bedrock.data.inventory; | ||
|
||
public enum InventoryLayout { | ||
NONE, | ||
SURVIVAL, | ||
RECIPE_BOOK, | ||
CREATIVE; | ||
|
||
public static final InventoryLayout[] VALUES = values(); | ||
} |
13 changes: 13 additions & 0 deletions
13
...odec/src/main/java/org/cloudburstmc/protocol/bedrock/data/inventory/InventoryTabLeft.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package org.cloudburstmc.protocol.bedrock.data.inventory; | ||
|
||
public enum InventoryTabLeft { | ||
NONE, | ||
RECIPE_CONSTRUCTION, | ||
RECIPE_EQUIPMENT, | ||
RECIPE_ITEMS, | ||
RECIPE_NATURE, | ||
RECIPE_SEARCH, | ||
SURVIVAL; | ||
|
||
public static final InventoryTabLeft[] VALUES = values(); | ||
} |
10 changes: 10 additions & 0 deletions
10
...dec/src/main/java/org/cloudburstmc/protocol/bedrock/data/inventory/InventoryTabRight.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package org.cloudburstmc.protocol.bedrock.data.inventory; | ||
|
||
public enum InventoryTabRight { | ||
NONE, | ||
FULL_SCREEN, | ||
CRAFTING, | ||
ARMOR; | ||
|
||
public static final InventoryTabRight[] VALUES = values(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.