armswingのパケット送信がわからない

2.5.3 1.12.2 のpaperです skript-packetをつかってswing armのパケットを送ろうとしていろいろやってます
function armswing_(p: player):
set {_packet} to new play_client_arm_animation packet
set field 0 of {_packet} to "MAIN_HAND"
set field 1 of {_packet} to 0
send {_p} packet {_packet}

packet event play_client_arm_animation:
set {_packet} to event-packet
broadcast "%{_packet}%"
broadcast "field 0: %field 0 of {_packet}%"
broadcast "field 1: %field 1 of {_packet}%"


on cs shoot:
getItemID(player's tool) is set
armswing_(player)
function armswing_(p: player):
set {_packet} to new play_client_arm_animation packet
set field 0 of {_packet} to "MAIN_HAND"
set field 1 of {_packet} to 0
send {_p} packet {_packet}

packet event play_client_arm_animation:
set {_packet} to event-packet
broadcast "%{_packet}%"
broadcast "field 0: %field 0 of {_packet}%"
broadcast "field 1: %field 1 of {_packet}%"


on cs shoot:
getItemID(player's tool) is set
armswing_(player)
No description
No description
22 Replies
月猫ch(月雲)
(質問追記中)
月猫ch(月雲)
field 0とか1をbroadcastすると
none
none
でした protocolibのwikiを見てる限りでは 0はplayerID?、1はanimationの種類 だと思っていたので いよいよfieldに何を入れればいいかわからなくなりました どなたかprotocolib wikiのfieldと 実際にbroadcastした時の値の違いについて教えてもらえないでしょうか
No description
月猫ch(月雲)
function armswing_(p: player):
set {_packet} to new play_client_arm_animation packet
set field 0 of {_packet} to "MAIN_HAND"
set field 1 of {_packet} to 0
send {_p} packet {_packet}
function armswing_(p: player):
set {_packet} to new play_client_arm_animation packet
set field 0 of {_packet} to "MAIN_HAND"
set field 1 of {_packet} to 0
send {_p} packet {_packet}
⇧はbroadcastの結果とwikiのfieldから見様見真似でfieldの値を設定したりしてみたやつです エラーはないのですが、当然動きませんでした 可能であればこれが動かなかった理由も教えてほしいです
unnnnnnnnnnn
unnnnnnnnnnn2y ago
解決策あるわけじゃないけど、
packet event play_client_arm_animation:
set {_packet} to event-packet
broadcast "%{_packet}%"
broadcast "%all fields of event-packet%"
packet event play_client_arm_animation:
set {_packet} to event-packet
broadcast "%{_packet}%"
broadcast "%all fields of event-packet%"
動かして普通に腕ふったときにどんな感じでfieldが使われてるかみてみたい
unnnnnnnnnnn
unnnnnnnnnnn2y ago
Skript Hub - Documentation
Packet Fields (Expression) - skript-packet
Get all packet fields, can't be set
月猫ch(月雲)
おおむね、最初の画像の二枚目と同じでした ※カラー分けしてます
月猫ch(月雲)
wikiでは最低でも2つfieldが設定されているようですが 結果としてMAIN_HANDのみでした
unnnnnnnnnnn
unnnnnnnnnnn2y ago
Skript Hub - Documentation
Packet Fields Classes (Expression) - skript-packet
Get all fields's classes of a packet. This is not intended to be use on your final code, it's only to help you to know what is inside a packet
unnnnnnnnnnn
unnnnnnnnnnn2y ago
これはどう
月猫ch(月雲)
field 1を無理に設定しているのが悪影響なのかと、消してみましたが それでも動きませんでした…
function armswing_(p: player):
set {_packet} to new play_client_arm_animation packet
set field 0 of {_packet} to "MAIN_HAND"
send {_p} packet {_packet}
function armswing_(p: player):
set {_packet} to new play_client_arm_animation packet
set field 0 of {_packet} to "MAIN_HAND"
send {_p} packet {_packet}
classの結果はこんな感じです
No description
unnnnnnnnnnn
unnnnnnnnnnn2y ago
play_client_arm_animationってこっちだったりしない? play_server_animation使わないといけない気がする play_client....がクライアントからサーバーへのパケット(bound to server)で play_server...がサーバーからクライアントへのパケット(bound to client)だと思う 今回チェックしたり送ろうとしたりしてたのはこのパケットで、だから1つしかフィールドがなかったのでは
unnnnnnnnnnn
unnnnnnnnnnn2y ago
実際exampleでも送ってるのはplay_server...だから https://skripthub.net/docs/?id=5337
Skript Hub - Documentation
Send Packet (Effect) - skript-packet
Sends the specified packet(s) to the specified player(s).
月猫ch(月雲)
あ”~ これって play_client_arm_animation こういうのの一覧ってどこで見ればいいかわからないです…
unnnnnnnnnnn
unnnnnnnnnnn2y ago
Skript Hub - Documentation
Packettypes (Expression) - skript-packet
Return all available ProtocolLib packettypes
unnnnnnnnnnn
unnnnnnnnnnn2y ago
これ使えばリスト出せると思う send "%all packettypes%"
月猫ch(月雲)
ありがとうございます(´;ω;`) @unnnnnnnnnnn メンションすみません Entity IDって何を入れればいいのでしょうか…
unnnnnnnnnnn
unnnnnnnnnnn2y ago
NotesにPlayer IDって書いてあるからIDを入れればいいんだろうけど、そういうときはpacke eventでsend "%all fields%"やって実際にどんな値が入ってるか確認したほうがいい
月猫ch(月雲)
id of player でいけました どうやらそのままだったみたいです…
unnnnnnnnnnn
unnnnnnnnnnn2y ago
解決?
月猫ch(月雲)
解決しました!! 腕を振る(swing arm)できました 解決結果置いときます
function armswing_(p: player):
set {_packet} to new play_server_animation packet
set field 0 of {_packet} to id of {_p}
set field 1 of {_packet} to 0
send {_p} packet {_packet}

command /packet.list:
permission: op
trigger:
loop all packettypes:
send "%loop-value%" if "%loop-value%" start with "play_client"
function armswing_(p: player):
set {_packet} to new play_server_animation packet
set field 0 of {_packet} to id of {_p}
set field 1 of {_packet} to 0
send {_p} packet {_packet}

command /packet.list:
permission: op
trigger:
loop all packettypes:
send "%loop-value%" if "%loop-value%" start with "play_client"
今回でパケットを最低限理解できました これで俺もようやくpacket使いの仲間入り(?) (パケットなんもわからん使い方だけ教えろ民はDMくれれば反応します)

Did you find this page helpful?