Skip to content

Commit

Permalink
Merge pull request #72 from OmniacDev/proto_rework
Browse files Browse the repository at this point in the history
impl types for v662
  • Loading branch information
theaddonn authored Nov 28, 2024
2 parents 3e258f1 + 8c17327 commit 6f16b0d
Show file tree
Hide file tree
Showing 100 changed files with 1,500 additions and 476 deletions.
2 changes: 2 additions & 0 deletions crates/proto/src/version/v662/enums/animation_mode.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
use bedrockrs_macros::ProtoCodec;

#[derive(ProtoCodec)]
#[enum_repr(i8)]
#[repr(i8)]
pub enum AnimationMode {
None = 0,
Layers = 1,
Expand Down
2 changes: 2 additions & 0 deletions crates/proto/src/version/v662/enums/chat_restriction_level.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
use bedrockrs_macros::ProtoCodec;

#[derive(ProtoCodec)]
#[enum_repr(i8)]
#[repr(i8)]
pub enum ChatRestrictionLevel {
None = 0,
Dropped = 1,
Expand Down
9 changes: 7 additions & 2 deletions crates/proto/src/version/v662/enums/command_origin_type.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
use bedrockrs_macros::ProtoCodec;

#[derive(ProtoCodec)]
#[enum_repr(u32)]
#[enum_endianness(var)]
#[repr(u32)]
pub enum CommandOriginType {
Player = 0,
CommandBlock = 1,
MinecartCommandBlock = 2,
DevConsole = 3,
Test = 4,
#[endianness(var)]
DevConsole(i64) = 3,
#[endianness(var)]
Test(i64) = 4,
AutomationPlayer = 5,
ClientAutomation = 6,
DedicatedServer = 7,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
use bedrockrs_macros::ProtoCodec;

#[derive(ProtoCodec)]
#[enum_repr(i8)]
#[repr(i8)]
pub enum CommandPermissionLevel {
Any = 0,
GameDirectors = 1,
Expand Down
70 changes: 59 additions & 11 deletions crates/proto/src/version/v662/enums/crafting_data_entry_type.rs
Original file line number Diff line number Diff line change
@@ -1,16 +1,64 @@
use uuid::Uuid;
use bedrockrs_macros::ProtoCodec;
use crate::version::v662::types::{NetworkItemInstanceDescriptor, ShapedChemistryRecipe, ShapedRecipe, ShapelessRecipe, ShulkerBoxRecipe, SmithingTransformRecipe, SmithingTrimRecipe};

#[derive(ProtoCodec)]
#[enum_repr(i32)]
#[enum_endianness(var)]
#[repr(i32)]
pub enum CraftingDataEntryType {
ShapelessRecipe = 0,
ShapedRecipe = 1,
FurnaceRecipe = 2,
FurnaceAuxRecipe = 3,
MultiRecipe = 4,
ShulkerBoxRecipe = 5,
ShapelessChemistryRecipe = 6,
ShapedChemistryRecipe = 7,
SmithingTransformRecipe = 8,
SmithingTrimRecipe = 9,
Count = 10,
ShapelessRecipe {
shapeless_recipe: ShapelessRecipe,
#[endianness(var)]
net_id: i32,
} = 0,
ShapedRecipe {
shaped_recipe: ShapedRecipe,
#[endianness(var)]
net_id: i32,
} = 1,
FurnaceRecipe {
#[endianness(var)]
item_data: i32,
result_item: NetworkItemInstanceDescriptor,
recipe_tag: String,
} = 2,
FurnaceAuxRecipe {
#[endianness(var)]
item_data: i32,
#[endianness(var)]
auxiliary_item_data: i32,
result_item: NetworkItemInstanceDescriptor,
recipe_tag: String,
} = 3,
MultiRecipe {
multi_recipe: Uuid,
#[endianness(var)]
net_id: i32,
} = 4,
ShulkerBoxRecipe {
shulker_box_recipe: ShulkerBoxRecipe,
#[endianness(var)]
net_id: i32,
} = 5,
ShapelessChemistryRecipe {
shapeless_chemistry_recipe: ShapelessRecipe,
#[endianness(var)]
net_id: i32,
} = 6,
ShapedChemistryRecipe {
shaped_chemistry_recipe: ShapedChemistryRecipe,
#[endianness(var)]
net_id: i32,
} = 7,
SmithingTransformRecipe {
smithing_transform_recipe: SmithingTransformRecipe,
#[endianness(var)]
net_id: i32
} = 8,
SmithingTrimRecipe {
smithing_trim_recipe: SmithingTrimRecipe,
#[endianness(var)]
net_id: i32
} = 9,
}
26 changes: 16 additions & 10 deletions crates/proto/src/version/v662/enums/data_item_type.rs
Original file line number Diff line number Diff line change
@@ -1,15 +1,21 @@
use bedrockrs_macros::ProtoCodec;
use crate::version::v662::types::{BlockPos, CompoundTag, Vec3};

#[derive(ProtoCodec)]
#[enum_repr(i8)]
#[repr(i8)]
pub enum DataItemType {
Byte = 0,
Short = 1,
Int = 2,
Float = 3,
String = 4,
CompoundTag = 5,
Pos = 6,
Int64 = 7,
Vec3 = 8,
Unknown = 9,
Byte(i8) = 0,
#[endianness(le)]
Short(i16) = 1,
#[endianness(var)]
Int(i32) = 2,
#[endianness(le)]
Float(f32) = 3,
String(String) = 4,
CompoundTag(CompoundTag) = 5,
Pos(BlockPos) = 6,
#[endianness(var)]
Int64(i64) = 7,
Vec3(Vec3) = 8,
}
3 changes: 3 additions & 0 deletions crates/proto/src/version/v662/enums/difficulty.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
use bedrockrs_macros::ProtoCodec;

#[derive(ProtoCodec)]
#[enum_repr(i32)]
#[enum_endianness(var)]
#[repr(i32)]
pub enum Difficulty {
Peaceful = 0,
Easy = 1,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
use bedrockrs_macros::ProtoCodec;

#[derive(ProtoCodec)]
#[enum_repr(i32)]
#[enum_endianness(var)]
#[repr(i32)]
pub enum EducationEditionOffer {
None = 0,
RestOfWorld = 1,
Expand Down
3 changes: 3 additions & 0 deletions crates/proto/src/version/v662/enums/game_type.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
use bedrockrs_macros::ProtoCodec;

#[derive(ProtoCodec)]
#[enum_repr(i32)]
#[enum_endianness(var)]
#[repr(i32)]
pub enum GameType {
Undefined = -1,
Survival = 0,
Expand Down
3 changes: 3 additions & 0 deletions crates/proto/src/version/v662/enums/generator_type.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
use bedrockrs_macros::ProtoCodec;

#[derive(ProtoCodec)]
#[enum_repr(i32)]
#[enum_endianness(var)]
#[repr(i32)]
pub enum GeneratorType {
Legacy = 0,
Overworld = 1,
Expand Down
11 changes: 8 additions & 3 deletions crates/proto/src/version/v662/enums/inventory_source_type.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
use bedrockrs_macros::ProtoCodec;
use crate::version::v662::enums::ContainerID;

#[derive(ProtoCodec)]
#[enum_repr(u32)]
#[enum_endianness(var)]
#[repr(u32)]
pub enum InventorySourceType {
InvalidInventory = i32::MAX as isize,
ContainerInventory = 0,
InvalidInventory = u32::MAX,
ContainerInventory(ContainerID) = 0,
GlobalInventory = 1,
WorldInteraction = 2,
#[endianness(var)]
WorldInteraction(u32) = 2,
CreativeInventory = 3,
NonImplementedFeatureTODO = 99999,
}
2 changes: 2 additions & 0 deletions crates/proto/src/version/v662/enums/item_descriptor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ pub mod ItemDescriptor {
use bedrockrs_macros::ProtoCodec;

#[derive(ProtoCodec)]
#[enum_repr(i8)]
#[repr(i8)]
pub enum InternalType {
Invalid = 0,
Default = 1,
Expand Down
7 changes: 6 additions & 1 deletion crates/proto/src/version/v662/enums/item_stack_net_result.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
use bedrockrs_macros::ProtoCodec;
use crate::version::v662::types::ItemStackResponseContainerInfo;

#[derive(ProtoCodec)]
#[enum_repr(i8)]
#[repr(i8)]
pub enum ItemStackNetResult {
Success = 0,
#[vec_repr(u32)]
#[vec_endianness(var)]
Success(Vec<ItemStackResponseContainerInfo>) = 0,
Error = 1,
InvalidRequestActionType = 2,
ActionRequestNotAllowed = 3,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ pub mod ItemUseInventoryTransaction {
use bedrockrs_macros::ProtoCodec;

#[derive(ProtoCodec)]
#[enum_repr(u32)]
#[enum_endianness(var)]
#[repr(u32)]
pub enum ActionType {
Place = 0,
Use = 1,
Expand Down
2 changes: 2 additions & 0 deletions crates/proto/src/version/v662/enums/mirror.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
use bedrockrs_macros::ProtoCodec;

#[derive(ProtoCodec)]
#[enum_repr(i8)]
#[repr(i8)]
pub enum Mirror {
None = 0,
X = 1,
Expand Down
8 changes: 7 additions & 1 deletion crates/proto/src/version/v662/enums/persona.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
pub mod persona {
pub mod Persona {
use bedrockrs_macros::ProtoCodec;

#[derive(ProtoCodec)]
#[enum_repr(u32)]
#[enum_endianness(le)]
#[repr(u32)]
pub enum AnimatedTextureType {
None = 0,
Face = 1,
Expand All @@ -10,6 +13,9 @@ pub mod persona {
}

#[derive(ProtoCodec)]
#[enum_repr(u32)]
#[enum_endianness(le)]
#[repr(u32)]
pub enum AnimationExpression {
Linear = 0,
Blinking = 1,
Expand Down
40 changes: 34 additions & 6 deletions crates/proto/src/version/v662/enums/player_action_type.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,27 @@
use bedrockrs_macros::ProtoCodec;
use crate::version::v662::types::BlockPos;

#[derive(ProtoCodec)]
#[enum_repr(i32)]
#[enum_endianness(var)]
#[repr(i32)]
pub enum PlayerActionType {
Unknown = -1,
StartDestroyBlock = 0,
AbortDestroyBlock = 1,
StopDestroyBlock = 2,
StartDestroyBlock {
position: BlockPos,
#[endianness(var)]
facing: i32,
} = 0,
AbortDestroyBlock {
position: BlockPos,
#[endianness(var)]
facing: i32,
} = 1,
StopDestroyBlock {
position: BlockPos,
#[endianness(var)]
facing: i32,
} = 2,
GetUpdatedBlock = 3,
DropItem = 4,
StartSleeping = 5,
Expand All @@ -21,16 +37,28 @@ pub enum PlayerActionType {
StartGliding = 15,
StopGliding = 16,
DenyDestroyBlock = 17,
CrackBlock = 18,
CrackBlock {
position: BlockPos,
#[endianness(var)]
facing: i32,
} = 18,
ChangeSkin = 19,
DeprecatedUpdatedEnchantingSeed = 20,
StartSwimming = 21,
StopSwimming = 22,
StartSpinAttack = 23,
StopSpinAttack = 24,
InteractWithBlock = 25,
PredictDestroyBlock = 26,
ContinueDestroyBlock = 27,
PredictDestroyBlock {
position: BlockPos,
#[endianness(var)]
facing: i32,
} = 26,
ContinueDestroyBlock {
position: BlockPos,
#[endianness(var)]
facing: i32,
} = 27,
StartItemUseOn = 28,
StopItemUseOn = 29,
HandledTeleport = 30,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
use bedrockrs_macros::ProtoCodec;

#[derive(ProtoCodec)]
#[enum_repr(i8)]
#[repr(i8)]
pub enum PlayerPermissionLevel {
Visitor = 0,
Member = 1,
Expand Down
2 changes: 2 additions & 0 deletions crates/proto/src/version/v662/enums/rotation.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
use bedrockrs_macros::ProtoCodec;

#[derive(ProtoCodec)]
#[enum_repr(i8)]
#[repr(i8)]
pub enum Rotation {
None = 0,
Rotate90 = 1,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
use bedrockrs_macros::ProtoCodec;

#[derive(ProtoCodec)]
#[enum_repr(i8)]
#[repr(i8)]
pub enum ServerAuthMovementMode {
ClientAuthoritative = 0,
ServerAuthoritative = 1,
Expand Down
3 changes: 3 additions & 0 deletions crates/proto/src/version/v662/enums/social.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ pub mod Social {
use bedrockrs_macros::ProtoCodec;

#[derive(ProtoCodec)]
#[enum_repr(i32)]
#[enum_endianness(var)]
#[repr(i32)]
pub enum GamePublishSetting {
NoMultiPlay = 0,
InviteOnly = 1,
Expand Down
3 changes: 3 additions & 0 deletions crates/proto/src/version/v662/enums/spawn_biome_type.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
use bedrockrs_macros::ProtoCodec;

#[derive(ProtoCodec)]
#[enum_repr(i16)]
#[enum_endianness(le)]
#[repr(i16)]
pub enum SpawnBiomeType {
Default = 0,
UserDefined = 1,
Expand Down
Loading

0 comments on commit 6f16b0d

Please sign in to comment.