-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/master'
- Loading branch information
Showing
4 changed files
with
128 additions
and
2 deletions.
There are no files selected for viewing
88 changes: 88 additions & 0 deletions
88
.../protocol_research/server_auth_block_breaking/block_breaking_network_packets.md
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,88 @@ | ||
--- | ||
comments: true | ||
--- | ||
|
||
Game version: 1.20.81 | ||
|
||
System: Windows | ||
|
||
## Creative Mode | ||
|
||
### Single Left Click | ||
|
||
Packet Details: | ||
|
||
```text | ||
[00:14:07:261] [SERVER BOUND] - PlayerActionPacket(runtimeEntityId=1, action=DIMENSION_CHANGE_REQUEST_OR_CREATIVE_DESTROY_BLOCK, blockPosition=(15, -61, 1), resultPosition=(0, 0, 0), face=2) | ||
[00:14:07:275] [SERVER BOUND] - PlayerAuthInputPacket(rotation=(27.348877, 3.0321198, 3.0321198), position=(15.550625, -58.37999, -3.3560686), motion=(0.0, 0.0), inputData=[PERFORM_BLOCK_ACTIONS], inputMode=MOUSE, playMode=SCREEN, vrGazeDirection=null, tick=5765, delta=(-0.0, -0.0784, 0.0), itemUseTransaction=null, itemStackRequest=null, playerActions=[PlayerBlockActionData(action=START_BREAK, blockPosition=(15, -61, 1), face=2), PlayerBlockActionData(action=BLOCK_PREDICT_DESTROY, blockPosition=(15, -61, 1), face=2)], inputInteractionModel=TOUCH, analogMoveVector=(0.0, 0.0), predictedVehicle=0, vehicleRotation=null) | ||
[00:14:07:368] [CLIENT BOUND] - LevelEventPacket(type=PARTICLE_DESTROY_BLOCK, position=(15.5, -60.5, 1.5), data=10598) | ||
[00:14:07:398] [CLIENT BOUND] - UpdateBlockPacket(flags=[NEIGHBORS, NETWORK], blockPosition=(15, -61, 1), definition=UnknownDefinition[runtimeId=11881], dataLayer=0) | ||
``` | ||
|
||
When destroying blocks in creative mode, the server | ||
receives `PlayerActionPacket(runtimeEntityId=16, action=DIMENSION_CHANGE_REQUEST_OR_CREATIVE_DESTROY_BLOCK, ...)`. | ||
|
||
The `data` field in `LevelEventPacket(type=PARTICLE_DESTROY_BLOCK, position=(3.5, -60.5, -1.5), data=10598)` actually | ||
refers to the block but uses the old network ID (it's unclear why the new BlockStateHash is not used). | ||
`PARTICLE_DESTROY_BLOCK` refers to the particles and sound when a block is completely destroyed (drops). | ||
Sending this `LevelEvent` to the client will trigger particles and sound. | ||
|
||
Note: 50342246 and 10598 are the BlockStateHash and the old network ID of `minecraft:grass_block` respectively. | ||
|
||
## Survival Mode | ||
|
||
### Hold and Destroy a Block | ||
|
||
Packet Details: | ||
|
||
```text | ||
[00:09:33:083] [SERVER BOUND] - PlayerAuthInputPacket(rotation=(20.417938, 4.530777, 4.530777), position=(15.700001, -58.37999, -6.589204), motion=(0.0, 0.0), inputData=[PERFORM_BLOCK_ACTIONS], inputMode=MOUSE, playMode=SCREEN, vrGazeDirection=null, tick=281, delta=(0.0, -0.0784, 0.0), itemUseTransaction=null, itemStackRequest=null, playerActions=[PlayerBlockActionData(action=START_BREAK, blockPosition=(15, -60, -4), face=2)], inputInteractionModel=TOUCH, analogMoveVector=(0.0, 0.0), predictedVehicle=0, vehicleRotation=null) | ||
[00:09:33:176] [CLIENT BOUND] - LevelEventPacket(type=BLOCK_START_BREAK, position=(15.0, -60.0, -4.0), data=4369) | ||
[00:09:33:176] [CLIENT BOUND] - LevelEventPacket(type=PARTICLE_CRACK_BLOCK, position=(15.5, -59.5, -3.5), data=33561418) | ||
[00:09:33:176] [CLIENT BOUND] - LevelEventPacket(type=BLOCK_UPDATE_BREAK, position=(15.0, -60.0, -4.0), data=4369) | ||
[00:09:33:224] [CLIENT BOUND] - LevelEventPacket(type=PARTICLE_CRACK_BLOCK, position=(15.5, -59.5, -3.5), data=33561418) | ||
[00:09:33:224] [CLIENT BOUND] - LevelEventPacket(type=BLOCK_UPDATE_BREAK, position=(15.0, -60.0, -4.0), data=4369) | ||
[00:09:33:270] [CLIENT BOUND] - LevelEventPacket(type=PARTICLE_CRACK_BLOCK, position=(15.5, -59.5, -3.5), data=33561418) | ||
[00:09:33:270] [CLIENT BOUND] - LevelEventPacket(type=BLOCK_UPDATE_BREAK, position=(15.0, -60.0, -4.0), data=4369) | ||
[00:09:33:317] [CLIENT BOUND] - LevelEventPacket(type=PARTICLE_CRACK_BLOCK, position=(15.5, -59.5, -3.5), data=33561418) | ||
[00:09:33:317] [CLIENT BOUND] - LevelEventPacket(type=BLOCK_UPDATE_BREAK, position=(15.0, -60.0, -4.0), data=4369) | ||
[00:09:33:379] [CLIENT BOUND] - LevelEventPacket(type=PARTICLE_CRACK_BLOCK, position=(15.5, -59.5, -3.5), data=33561418) | ||
[00:09:33:379] [CLIENT BOUND] - LevelEventPacket(type=BLOCK_UPDATE_BREAK, position=(15.0, -60.0, -4.0), data=4369) | ||
[00:09:33:425] [CLIENT BOUND] - LevelEventPacket(type=PARTICLE_CRACK_BLOCK, position=(15.5, -59.5, -3.5), data=33561418) | ||
[00:09:33:425] [CLIENT BOUND] - LevelEventPacket(type=BLOCK_UPDATE_BREAK, position=(15.0, -60.0, -4.0), data=4369) | ||
[00:09:33:472] [CLIENT BOUND] - LevelEventPacket(type=PARTICLE_CRACK_BLOCK, position=(15.5, -59.5, -3.5), data=33561418) | ||
[00:09:33:472] [CLIENT BOUND] - LevelEventPacket(type=BLOCK_UPDATE_BREAK, position=(15.0, -60.0, -4.0), data=4369) | ||
[00:09:33:519] [CLIENT BOUND] - LevelEventPacket(type=PARTICLE_CRACK_BLOCK, position=(15.5, -59.5, -3.5), data=33561418) | ||
[00:09:33:519] [CLIENT BOUND] - LevelEventPacket(type=BLOCK_UPDATE_BREAK, position=(15.0, -60.0, -4.0), data=4369) | ||
[00:09:33:551] [CLIENT BOUND] - LevelEventPacket(type=PARTICLE_CRACK_BLOCK, position=(15.5, -59.5, -3.5), data=33561418) | ||
[00:09:33:551] [CLIENT BOUND] - LevelEventPacket(type=BLOCK_UPDATE_BREAK, position=(15.0, -60.0, -4.0), data=4369) | ||
[00:09:33:629] [CLIENT BOUND] - LevelEventPacket(type=PARTICLE_CRACK_BLOCK, position=(15.5, -59.5, -3.5), data=33561418) | ||
[00:09:33:629] [CLIENT BOUND] - LevelEventPacket(type=BLOCK_UPDATE_BREAK, position=(15.0, -60.0, -4.0), data=4369) | ||
[00:09:33:674] [CLIENT BOUND] - LevelEventPacket(type=PARTICLE_CRACK_BLOCK, position=(15.5, -59.5, -3.5), data=33561418) | ||
[00:09:33:674] [CLIENT BOUND] - LevelEventPacket(type=BLOCK_UPDATE_BREAK, position=(15.0, -60.0, -4.0), data=4369) | ||
[00:09:33:722] [CLIENT BOUND] - LevelEventPacket(type=PARTICLE_CRACK_BLOCK, position=(15.5, -59.5, -3.5), data=33561418) | ||
[00:09:33:722] [CLIENT BOUND] - LevelEventPacket(type=BLOCK_UPDATE_BREAK, position=(15.0, -60.0, -4.0), data=4369) | ||
[00:09:33:768] [CLIENT BOUND] - LevelEventPacket(type=PARTICLE_CRACK_BLOCK, position=(15.5, -59.5, -3.5), data=33561418) | ||
[00:09:33:768] [CLIENT BOUND] - LevelEventPacket(type=BLOCK_UPDATE_BREAK, position=(15.0, -60.0, -4.0), data=4369) | ||
[00:09:33:784] [SERVER BOUND] - PlayerAuthInputPacket(rotation=(20.417938, 4.530777, 4.530777), position=(15.700001, -58.37999, -6.589204), motion=(0.0, 0.0), inputData=[PERFORM_BLOCK_ACTIONS], inputMode=MOUSE, playMode=SCREEN, vrGazeDirection=null, tick=295, delta=(0.0, -0.0784, 0.0), itemUseTransaction=null, itemStackRequest=null, playerActions=[PlayerBlockActionData(action=BLOCK_CONTINUE_DESTROY, blockPosition=(15, -60, -4), face=2), PlayerBlockActionData(action=BLOCK_PREDICT_DESTROY, blockPosition=(15, -60, -4), face=2)], inputInteractionModel=TOUCH, analogMoveVector=(0.0, 0.0), predictedVehicle=0, vehicleRotation=null) | ||
[00:09:33:832] [CLIENT BOUND] - LevelEventPacket(type=PARTICLE_CRACK_BLOCK, position=(15.5, -59.5, -3.5), data=33561418) | ||
[00:09:33:832] [CLIENT BOUND] - LevelEventPacket(type=BLOCK_UPDATE_BREAK, position=(15.0, -60.0, -4.0), data=4369) | ||
[00:09:33:878] [CLIENT BOUND] - LevelEventPacket(type=BLOCK_STOP_BREAK, position=(15.0, -60.0, -4.0), data=0) | ||
[00:09:33:878] [CLIENT BOUND] - LevelEventPacket(type=BLOCK_START_BREAK, position=(15.0, -60.0, -4.0), data=4369) | ||
[00:09:33:878] [CLIENT BOUND] - LevelEventPacket(type=PARTICLE_DESTROY_BLOCK, position=(15.5, -59.5, -3.5), data=6986) | ||
[00:09:33:971] [SERVER BOUND] - PlayerAuthInputPacket(rotation=(20.417938, 4.530777, 4.530777), position=(15.700001, -58.37999, -6.589204), motion=(0.0, 0.0), inputData=[PERFORM_BLOCK_ACTIONS], inputMode=MOUSE, playMode=SCREEN, vrGazeDirection=null, tick=299, delta=(0.0, -0.0784, 0.0), itemUseTransaction=null, itemStackRequest=null, playerActions=[PlayerBlockActionData(action=ABORT_BREAK, blockPosition=(15, -60, -4), face=0)], inputInteractionModel=TOUCH, analogMoveVector=(0.0, 0.0), predictedVehicle=0, vehicleRotation=null) | ||
[00:09:34:078] [CLIENT BOUND] - LevelEventPacket(type=BLOCK_STOP_BREAK, position=(15.0, -60.0, -4.0), data=0) | ||
``` | ||
|
||
The `data` field in `LevelEventPacket(type=BLOCK_UPDATE_BREAK, position=(15.0, -61.0, -8.0), data=3640)` indicates the | ||
time required to mine. | ||
The formula is | ||
|
||
```math | ||
time = \frac{6553.5}{\text{required mining seconds}} | ||
``` | ||
|
||
The data field in `LevelEventPacket(type=PARTICLE_CRACK_BLOCK, position=(3.5, -60.5, -1.5), data=50342246)` indicates | ||
the block's BlockStateHash. | ||
`PARTICLE_CRACK_BLOCK` refers to the particles coming off the block surface during breaking. |
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 |
---|---|---|
|
@@ -3,6 +3,7 @@ comments: true | |
--- | ||
|
||
Game version: 1.20.81 | ||
|
||
System: Windows | ||
|
||
## 创造模式 | ||
|
37 changes: 37 additions & 0 deletions
37
docs/protocol_research/server_auth_block_placing/block_placing_network_packets.md
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,37 @@ | ||
--- | ||
comments: true | ||
--- | ||
|
||
Game version: 1.20.81 | ||
|
||
System: Windows | ||
|
||
## Placing Block | ||
|
||
Packet Details: | ||
|
||
```text | ||
[00:17:28:130] [SERVER BOUND] - PlayerActionPacket(runtimeEntityId=1, action=START_ITEM_USE_ON, blockPosition=(10, -61, -6), resultPosition=(10, -60, -6), face=1) | ||
[00:17:28:130] [SERVER BOUND] - InventoryTransactionPacket(legacyRequestId=-8, legacySlots=[LegacySetItemSlotData(containerId=29, slots=[2])], actions=[InventoryActionData(source=InventorySource(type=CONTAINER, containerId=0, flag=NONE), slot=2, fromItem=BaseItemData(definition=SimpleItemDefinition(identifier=minecraft:oak_planks, runtimeId=5, componentBased=false), damage=0, count=56, tag=null, canPlace=[], canBreak=[], blockingTicks=0, blockDefinition=UnknownDefinition[runtimeId=13246], usingNetId=false, netId=0), toItem=BaseItemData(definition=SimpleItemDefinition(identifier=minecraft:oak_planks, runtimeId=5, componentBased=false), damage=0, count=55, tag=null, canPlace=[], canBreak=[], blockingTicks=0, blockDefinition=UnknownDefinition[runtimeId=13246], usingNetId=false, netId=0), stackNetworkId=0)], transactionType=ITEM_USE, actionType=0, runtimeEntityId=0, blockPosition=(10, -61, -6), blockFace=1, hotbarSlot=2, itemInHand=BaseItemData(definition=SimpleItemDefinition(identifier=minecraft:oak_planks, runtimeId=5, componentBased=false), damage=0, count=56, tag=null, canPlace=[], canBreak=[], blockingTicks=0, blockDefinition=UnknownDefinition[runtimeId=13246], usingNetId=false, netId=0), playerPosition=(11.526499, -58.37999, -8.002016), clickPosition=(0.6335783, 1.0, 0.29898548), headPosition=null, usingNetIds=false, blockDefinition=UnknownDefinition[runtimeId=10598]) | ||
[00:17:28:130] [SERVER BOUND] - InventoryTransactionPacket(legacyRequestId=0, legacySlots=[], actions=[], transactionType=ITEM_USE, actionType=1, runtimeEntityId=0, blockPosition=(0, 0, 0), blockFace=255, hotbarSlot=2, itemInHand=BaseItemData(definition=SimpleItemDefinition(identifier=minecraft:oak_planks, runtimeId=5, componentBased=false), damage=0, count=55, tag=null, canPlace=[], canBreak=[], blockingTicks=0, blockDefinition=UnknownDefinition[runtimeId=13246], usingNetId=false, netId=0), playerPosition=(11.526499, -58.37999, -8.002016), clickPosition=(0.0, 0.0, 0.0), headPosition=null, usingNetIds=false, blockDefinition=UnknownDefinition[runtimeId=0]) | ||
[00:17:28:145] [SERVER BOUND] - MobEquipmentPacket(runtimeEntityId=1, item=BaseItemData(definition=SimpleItemDefinition(identifier=minecraft:oak_planks, runtimeId=5, componentBased=false), damage=0, count=55, tag=null, canPlace=[], canBreak=[], blockingTicks=0, blockDefinition=UnknownDefinition[runtimeId=13246], usingNetId=false, netId=0), inventorySlot=2, hotbarSlot=2, containerId=0) | ||
[00:17:28:207] [CLIENT BOUND] - LevelSoundEvent2Packet(sound=PLACE, position=(10.5, -59.5, -5.5), extraData=13246, identifier=, babySound=false, relativeVolumeDisabled=false) | ||
[00:17:28:207] [CLIENT BOUND] - UpdateAttributesPacket(runtimeEntityId=1, attributes=[AttributeData(name=minecraft:luck, minimum=-1024.0, maximum=1024.0, value=0.0, defaultValue=0.0, modifiers=[]), AttributeData(name=minecraft:health, minimum=0.0, maximum=20.0, value=20.0, defaultValue=20.0, modifiers=[]), AttributeData(name=minecraft:absorption, minimum=0.0, maximum=16.0, value=0.0, defaultValue=0.0, modifiers=[]), AttributeData(name=minecraft:movement, minimum=0.0, maximum=3.4028235E38, value=0.1, defaultValue=0.1, modifiers=[]), AttributeData(name=minecraft:underwater_movement, minimum=0.0, maximum=3.4028235E38, value=0.02, defaultValue=0.02, modifiers=[]), AttributeData(name=minecraft:lava_movement, minimum=0.0, maximum=3.4028235E38, value=0.02, defaultValue=0.02, modifiers=[]), AttributeData(name=minecraft:player.hunger, minimum=0.0, maximum=20.0, value=20.0, defaultValue=20.0, modifiers=[]), AttributeData(name=minecraft:player.exhaustion, minimum=0.0, maximum=20.0, value=3.7418156, defaultValue=0.0, modifiers=[]), AttributeData(name=minecraft:player.saturation, minimum=0.0, maximum=20.0, value=3.0, defaultValue=5.0, modifiers=[]), AttributeData(name=minecraft:player.level, minimum=0.0, maximum=24791.0, value=0.0, defaultValue=0.0, modifiers=[]), AttributeData(name=minecraft:player.experience, minimum=0.0, maximum=1.0, value=0.0, defaultValue=0.0, modifiers=[])], tick=0) | ||
[00:17:28:207] [CLIENT BOUND] - SetEntityDataPacket(metadata={FLAGS=[CAN_CLIMB, BREATHING, HAS_COLLISION, HAS_GRAVITY, HIDDEN_WHEN_INVISIBLE, PUSH_TOWARDS_CLOSEST_SPACE], STRUCTURAL_INTEGRITY=1i, VARIANT=0i, BLOCK=UnknownDefinition[runtimeId=0], COLOR=0b, NAME="daoge cmd", OWNER_EID=-1l, TARGET_EID=0l, AIR_SUPPLY=300s, EFFECT_COLOR=0i, EFFECT_AMBIENCE=0b, JUMP_DURATION=0b, CHARGE_AMOUNT=0b, PLAYER_FLAGS=0b, PLAYER_INDEX=1i, BED_POSITION=(0, 0, 0), LEASH_HOLDER=-1l, SCALE=1.0f, HAS_NPC=false, AIR_SUPPLY_MAX=300s, MARK_VARIANT=0i, CONTAINER_TYPE=0b, CONTAINER_SIZE=0i, CONTAINER_STRENGTH_MODIFIER=0i, WIDTH=0.6f, HEIGHT=1.8f, SEAT_OFFSET=(0.0, 0.0, 0.0), SEAT_LOCK_RIDER_ROTATION=false, SEAT_LOCK_RIDER_ROTATION_DEGREES=0.0f, SEAT_HAS_ROTATION=false, SEAT_ROTATION_OFFSET_DEGREES=0.0f, COMMAND_BLOCK_ENABLED=false, COMMAND_BLOCK_NAME="", COMMAND_BLOCK_LAST_OUTPUT="", COMMAND_BLOCK_TRACK_OUTPUT=true, STRENGTH=0i, STRENGTH_MAX=0i, EVOKER_SPELL_CASTING_COLOR=0i, DATA_LIFETIME_TICKS=-1i, NAMETAG_ALWAYS_SHOW=1b, COLOR_2=0b, SCORE="", AGENT_EID=-1l, EATING_COUNTER=0i, INTERACT_TEXT="", TRADE_TIER=0i, MAX_TRADE_TIER=0i, TRADE_EXPERIENCE=0i, SKIN_ID=0i, COMMAND_BLOCK_TICK_DELAY=3i, COMMAND_BLOCK_EXECUTE_ON_FIRST_TICK=true, AMBIENT_SOUND_INTERVAL=8.0f, AMBIENT_SOUND_INTERVAL_RANGE=16.0f, AMBIENT_SOUND_EVENT_NAME="ambient", FALL_DAMAGE_MULTIPLIER=1.0f, CAN_RIDE_TARGET=false, LOW_TIER_CURED_TRADE_DISCOUNT=0i, HIGH_TIER_CURED_TRADE_DISCOUNT=0i, NEARBY_CURED_TRADE_DISCOUNT=0i, NEARBY_CURED_DISCOUNT_TIME_STAMP=0i, HITBOX={}, IS_BUOYANT=false, FREEZING_EFFECT_STRENGTH=0.0f, MOVEMENT_SOUND_DISTANCE_OFFSET=1.0f, HEARTBEAT_INTERVAL_TICKS=20i, HEARTBEAT_SOUND_EVENT=521i, PLAYER_LAST_DEATH_POS=(0, 0, 0), PLAYER_LAST_DEATH_DIMENSION=0i, PLAYER_HAS_DIED=false, COLLISION_BOX=(0.6, 1.8, 0.0)}, runtimeEntityId=1, tick=0, properties=EntityProperties(intProperties=[], floatProperties=[])) | ||
[00:17:28:255] [SERVER BOUND] - PlayerActionPacket(runtimeEntityId=1, action=STOP_ITEM_USE_ON, blockPosition=(10, -60, -6), resultPosition=(0, 0, 0), face=0) | ||
[00:17:28:255] [CLIENT BOUND] - UpdateBlockPacket(flags=[NEIGHBORS, NETWORK], blockPosition=(10, -60, -6), definition=UnknownDefinition[runtimeId=13246], dataLayer=0) | ||
``` | ||
|
||
The `START_ITEM_USE_ON` and `STOP_ITEM_USE_ON` actions in the `PlayerActionPacket` are used to mark whether the player | ||
is in the "block interaction state" | ||
|
||
When the player right-clicks, if the item in their hand can interact with the block they are pointing at in a "valid | ||
interaction" the player will enter the "block interaction state" and can only exit this state by releasing the right | ||
mouse button. | ||
A "valid interaction" includes actions like placing a block or placing an item in a display frame. | ||
|
||
While in the "block interaction" state, the client will notify the server of a successful interaction by sending | ||
an `InventoryTransactionPacket` of `ITEM_USE(action=0)`. | ||
|
||
When the player is not in the "block interaction" state, `ITEM_USE` in the `InventoryTransactionPacket` has other | ||
meanings. |
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