Skip to content

Commit

Permalink
get compiling
Browse files Browse the repository at this point in the history
  • Loading branch information
theaddonn committed Nov 3, 2024
1 parent 9b238d9 commit bc94180
Show file tree
Hide file tree
Showing 2 changed files with 283 additions and 4 deletions.
4 changes: 2 additions & 2 deletions crates/proto/src/version/v662/packets/add_player.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use bedrockrs_core::{Vec2, Vec3};
use bedrockrs_macros::{gamepacket, ProtoCodec};
use bedrockrs_shared::actor_runtime_id::ActorRuntimeID;
use bedrockrs_shared::world::gamemode::Gamemode;
use crate::version::v662::types::{ActorMetaData, ItemStackDescriptor};
use crate::version::v662::types::{ItemStackDescriptor};

#[gamepacket(id = 9)]
#[derive(ProtoCodec, Debug, Clone)]
Expand All @@ -22,5 +22,5 @@ pub struct AddPlayerPacket {
pub head_yaw: f32,
pub carried_item: ItemStackDescriptor,
pub gamemode: Gamemode,
pub actor_meta_data: ActorMetaData,
//pub actor_meta_data: ActorMetaData,
}
283 changes: 281 additions & 2 deletions crates/proto/src/version/v662/types/actor_metadata.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,285 @@
use std::io::Cursor;
use std::iter::Map;
use varint_rs::VarintWriter;
use bedrockrs_macros::ProtoCodec;
use bedrockrs_proto_core::error::ProtoCodecError;
use bedrockrs_proto_core::{ProtoCodec, ProtoCodecVAR};

#[derive(Debug, Clone)]
pub struct ActorData(pub Map<ActorDataKey, ActorDataField>);

#[derive(ProtoCodec, Debug, Clone)]
// TODO find out correct repr
#[enum_repr(u8)]
pub enum ActorDataKey {
Flags = 0,
StructuralIntegrity = 1,
Variant = 2,
ColorIndex = 3,
Name = 4,
Owner = 5,
Target = 6,
AirSupply = 7,
EffectColor = 8,
EffectAmbience = 9,
JumpDuration = 10,
Hurt = 11,
HurtDirection = 12,
RowTimeLeft = 13,
RowTimeRight = 14,
Value = 15,
DisplayTileRuntimeID = 16,
DisplayOffset = 17,
CustomDisplay = 18,
Swell = 19,
OldSwell = 20,
SwellDirection = 21,
ChargeAmount = 22,
CarryBlockRuntimeID = 23,
ClientEvent = 24,
UsingItem = 25,
PlayerFlags = 26,
PlayerIndex = 27,
BedPosition = 28,
PowerX = 29,
PowerY = 30,
PowerZ = 31,
AuxPower = 32,
FishX = 33,
FishZ = 34,
FishAngle = 35,
AuxValueData = 36,
LeashHolder = 37,
Scale = 38,
HasNPC = 39,
NPCData = 40,
Actions = 41,
AirSupplyMax = 42,
MarkVariant = 43,
ContainerType = 44,
ContainerSize = 45,
ContainerStrengthModifier = 46,
BlockTarget = 47,
Inventory = 48,
TargetA = 49,
TargetB = 50,
TargetC = 51,
AerialAttack = 52,
Width = 53,
Height = 54,
FuseTime = 55,
SeatOffset = 56,
SeatLockPassengerRotation = 57,
SeatLockPassengerRotationDegrees = 58,
SeatRotationOffset = 59,
SeatRotationOffsetDegrees = 60,
DataRadius = 61,
DataWaiting = 62,
DataParticle = 63,
PeekID = 64,
AttachFace = 65,
Attached = 66,
AttachedPosition = 67,
TradeTarget = 68,
Career = 69,
HasCommandBlock = 70,
CommandName = 71,
LastCommandOutput = 72,
TrackCommandOutput = 73,
ControllingSeatIndex = 74,
Strength = 75,
StrengthMax = 76,
DataSpellCastingColor = 77,
DataLifetimeTicks = 78,
PoseIndex = 79,
DataTickOffset = 80,
AlwaysShowNameTag = 81,
ColorTwoIndex = 82,
NameAuthor = 83,
Score = 84,
BalloonAnchor = 85,
PuffedState = 86,
BubbleTime = 87,
Agent = 88,
SittingAmount = 89,
SittingAmountPrevious = 90,
EatingCounter = 91,
FlagsTwo = 92,
LayingAmount = 93,
LayingAmountPrevious = 94,
DataDuration = 95,
DataSpawnTime = 96,
DataChangeRate = 97,
DataChangeOnPickup = 98,
DataPickupCount = 99,
InteractText = 100,
TradeTier = 101,
MaxTradeTier = 102,
TradeExperience = 103,
SkinID = 104,
SpawningFrames = 105,
CommandBlockTickDelay = 106,
CommandBlockExecuteOnFirstTick = 107,
AmbientSoundInterval = 108,
AmbientSoundIntervalRange = 109,
AmbientSoundEventName = 110,
FallDamageMultiplier = 111,
NameRawText = 112,
CanRideTarget = 113,
LowTierCuredTradeDiscount = 114,
HighTierCuredTradeDiscount = 115,
NearbyCuredTradeDiscount = 116,
NearbyCuredDiscountTimeStamp = 117,
HitBox = 118,
IsBuoyant = 119,
FreezingEffectStrength = 120,
BuoyancyData = 121,
GoatHornCount = 122,
BaseRuntimeID = 123,
MovementSoundDistanceOffset = 124,
HeartbeatIntervalTicks = 125,
HeartbeatSoundEvent = 126,
PlayerLastDeathPosition = 127,
PlayerLastDeathDimension = 128,
PlayerHasDied = 129,
CollisionBox = 130,
}

#[derive(ProtoCodec, Debug, Clone)]
pub struct ActorMetaData {

#[enum_repr(i8)]
#[repr(i8)]
pub enum ActorDataField {
I8(i8) = 0,
I16(#[endianness(le)] i16) = 1,
I32(#[endianness(var)] i32) = 2,
F32(#[endianness(le)] f32) = 3,
String(String) = 4,
CompoundTag(#[nbt] nbtx::Value) = 5,
Pos() = 6,
I64 = 7,
Vec3() = 8,
}

#[derive(ProtoCodec, Debug, Clone)]
// TODO find out correct repr
#[enum_repr(i8)]
pub enum ActorDataFlag {
OnFire = 0,
Sneaking = 1,
Riding = 2,
Sprinting = 3,
UsingItem = 4,
Invisible = 5,
Tempted = 6,
InLove = 7,
Saddled = 8,
Powered = 9,
Ignited = 10,
Baby = 11,
Converting = 12,
Critical = 13,
ShowName = 14,
AlwaysShowName = 15,
NoAI = 16,
Silent = 17,
WallClimbing = 18,
Climb = 19,
Swim = 20,
Fly = 21,
Walk = 22,
Resting = 23,
Sitting = 24,
Angry = 25,
Interested = 26,
Charged = 27,
Tamed = 28,
Orphaned = 29,
Leashed = 30,
Sheared = 31,
Gliding = 32,
Elder = 33,
Moving = 34,
Breathing = 35,
Chested = 36,
Stackable = 37,
ShowBottom = 38,
Standing = 39,
Shaking = 40,
Idling = 41,
Casting = 42,
Charging = 43,
KeyboardControlled = 44,
PowerJump = 45,
Dash = 46,
Lingering = 47,
HasCollision = 48,
HasGravity = 49,
FireImmune = 50,
Dancing = 51,
Enchanted = 52,
ReturnTrident = 53,
ContainerPrivate = 54,
Transforming = 55,
DamageNearbyMobs = 56,
Swimming = 57,
Bribed = 58,
Pregnant = 59,
LayingEgg = 60,
PassengerCanPick = 61,
TransitionSitting = 62,
Eating = 63,
LayingDown = 64,
Sneezing = 65,
Trusting = 66,
Rolling = 67,
Scared = 68,
InScaffolding = 69,
OverScaffolding = 70,
DescendThroughBlock = 71,
Blocking = 72,
TransitionBlocking = 73,
BlockedUsingShield = 74,
BlockedUsingDamagedShield = 75,
Sleeping = 76,
WantsToWake = 77,
TradeInterest = 78,
DoorBreaker = 79,
BreakingObstruction = 80,
DoorOpener = 81,
Captain = 82,
Stunned = 83,
Roaring = 84,
DelayedAttack = 85,
AvoidingMobs = 86,
AvoidingBlock = 87,
FacingTargetToRangeAttack = 88,
HiddenWhenInvisible = 89,
InUI = 90,
Stalking = 91,
Emoting = 92,
Celebrating = 93,
Admiring = 94,
CelebratingSpecial = 95,
OutOfControl = 96,
RamAttack = 97,
PlayingDead = 98,
InAscendingBlock = 99,
OverDescendingBlock = 100,
Croaking = 101,
DigestMob = 102,
JumpGoal = 103,
Emerging = 104,
Sniffing = 105,
Digging = 106,
SonicBoom = 107,
HasDashTimeout = 108,
PushTowardsClosestSpace = 109,
Scenting = 110,
Rising = 111,
FeelingHappy = 112,
Searching = 113,
Crawling = 114,
TimerFlag1 = 115,
TimerFlag2 = 116,
TimerFlag3 = 117,
}

0 comments on commit bc94180

Please sign in to comment.