问题拆分成四个小问题(第四个已解决)
①如何做“长按右键计时”以及检测“松开鼠标事件”?(似乎Bukkit不能检测空手右键?)
②已经查到破坏方块是breakNaturally(),但是怎样设置这种行为破坏的方块不掉落物品(其它行为正常掉落)?
③如何向玩家朝向抛出方块(关键是这个掉落沙的速度矢量该怎么给出)
④已经查到getLineOfSight()、 getTargetBlock(), getTargetBlockExact()...可以显示视野方块
①如何做“长按右键计时”以及检测“松开鼠标事件”?(似乎Bukkit不能检测空手右键?)
②已经查到破坏方块是breakNaturally(),但是怎样设置这种行为破坏的方块不掉落物品(其它行为正常掉落)?
③如何向玩家朝向抛出方块(关键是这个掉落沙的速度矢量该怎么给出)
④已经查到getLineOfSight()、 getTargetBlock(), getTargetBlockExact()...可以显示视野方块
1. Bukkit只是检测不到空手对空气右键,因为空手对空气右键客户端不会发包,对方块空手右键可以检测
2. https://wiki.vg/Protocol#Block_Break_Animation
用发包播放方块破损动画,并将该方块替换为空气
3. 重力方块都有实体形式,API:https://hub.spigotmc.org/javadoc ... bukkit.util.Vector-
2. https://wiki.vg/Protocol#Block_Break_Animation
用发包播放方块破损动画,并将该方块替换为空气
3. 重力方块都有实体形式,API:https://hub.spigotmc.org/javadoc ... bukkit.util.Vector-
疾风暗影 发表于 2020-6-30 09:55
1. Bukkit只是检测不到空手对空气右键,因为空手对空气右键客户端不会发包,对方块空手右键可以检测
2. http ...
1.检测是用PlayerInteractEvent?
2.怎么做到检测“连续长按右键”?
3.getLocation()得到玩家的朝向后,怎么根据玩家朝向给出掉落沙的速度矢量?
4.Protocol没用过……
aa0307bb 发表于 2020-6-30 15:20
1.检测是用PlayerInteractEvent?
2.怎么做到检测“连续长按右键”?
3.getLocation()得到玩家的朝向后, ...
1. PlayerInteractEvent
2. 每tick检测事件有无触发(实际需要latch逻辑判断是否中途断开)
3. setVelocity接受的是vector,也就是向量,其xyz值代表了速度和方向
速度值:sqrt(x^2+y^2+z^2)
4. 请自行阅读protocolLib的文档库
疾风暗影 发表于 2020-6-30 15:26
1. PlayerInteractEvent
2. 每tick检测事件有无触发(实际需要latch逻辑判断是否中途断开)
3. setVeloci ...
2.latch逻辑该如何实现?
3.谢谢提供思路,但是算完敲代码时误打误撞才发现
public Vector getDirection()
获取本位置所面向的方向的单位向量.
这是有API的 :)
4.
Block Break Animation
0–9 are the displayable destroy stages and each other number means that there is no animation on this coordinate.
Block break animations can still be applied on air; the animation will remain visible although there is no block being broken. However, if this is applied to a transparent block, odd graphical effects may happen, including water losing its transparency. (An effect similar to this can be seen in normal gameplay when breaking ice blocks)
If you need to display several break animations at the same time you have to give each of them a unique Entity ID. The entity ID does not need to correspond to an actual entity on the client. It is valid to use a randomly generated number.
Packet ID State Bound To Field Name Field Type Notes
0x09 Play Client Entity ID VarInt Entity ID of the entity breaking the block
Location Position Block Position
Destroy Stage Byte 0–9 to set it, any other value to remove it
文档这么大,我该从哪看 有了这些信息之后怎样写成代码