在这里我只做了雪球的强制偏移——同样适用于鸡蛋、末影珍珠,但是不适用于其他抛射型实体。
效果:
原理:
主要部分——强制偏移
首先需要了解Mc中实体的运动公式:
http://www.mcbbs.net/thread-478493-1-1.html
(此贴中的第二面阐明了公式)
所以在实际游戏中的运动是上面那样的
通过枚举,得出以下高度值:(从97.52000000327826到64.18336154219014)
- 97.52000000327826
- 97.50379648424558
- 97.45775500091926
- 97.38217393265768
- 97.27734867502846
- 97.14357166964640
- 96.98113243371292
- 96.79031758926017
- 96.57141089210276
- 96.21469326049981
- 96.05044280353057
- 95.74893484918611
- 95.42044197218024
- 85.06523402148224
- 94.68357814757424
- 94.27573882943612
- 93.84197790126048
- 93.38255457890047
- 92.89772548605322
- 92.38774468018130
- 91.85286367817510
- 91.29331481758490
- 90.70939460264047
- 90.10129708741533
- 89.46728054221374
- 88.81357415710733
- 88.13444473026932
- 87.43209669189348
- 86.70677212787382
- 85.95870080324768
- 85.18811018540420
- 84.39522546706077
- 83.58026758900979
- 82.74346326263785
- 81.88502499221977
- 81.00517109698973
- 80.10411573299159
- 79.18207091471085
- 78.23924653649017
- 77.27585039373078
- 76.29208820388187
- 75.28816362722011
- 74.26427828742136
- 73.22063179192660
- 72.15742175210437
- 71.07484380321135
- 69.97309162415354
- 68.85235695704974
- 67.71282962659936
- 66.55469755925667
- 65.37814680221314
- 64.18336154219014
通过进一步简化,得到以下偏移指令:
复制代码
- /execute @e[type=Snowball] ~ ~ ~ scoreboard players add @e[type=Snowball,c=1] flyingt 1
- /execute @e[type=Snowball,score_flyingt_min=2] ~ ~ ~ tp @e[type=Snowball,c=1] ~ ~0.09 ~
- /execute @e[type=Snowball,score_flyingt_min=5] ~ ~ ~ tp @e[type=Snowball,c=1] ~ ~0.07 ~
- /execute @e[type=Snowball,score_flyingt_min=8] ~ ~ ~ tp @e[type=Snowball,c=1] ~ ~0.06 ~
- /execute @e[type=Snowball,score_flyingt_min=12] ~ ~ ~ tp @e[type=Snowball,c=1] ~ ~0.06 ~
- /execute @e[type=Snowball,score_flyingt_min=15] ~ ~ ~ tp @e[type=Snowball,c=1] ~ ~0.07 ~
- /execute @e[type=Snowball,score_flyingt_min=19] ~ ~ ~ tp @e[type=Snowball,c=1] ~ ~0.09 ~
- /execute @e[type=Snowball,score_flyingt_min=22] ~ ~ ~ tp @e[type=Snowball,c=1] ~ ~0.11 ~
- /execute @e[type=Snowball,score_flyingt_min=26] ~ ~ ~ tp @e[type=Snowball,c=1] ~ ~0.13 ~
- /execute @e[type=Snowball,score_flyingt_min=28] ~ ~ ~ tp @e[type=Snowball,c=1] ~ ~0.15 ~
再来解释为什么斜抛下抛也是直线:
无论是什么路线,公式都是那个帖子中的计算公式,距离只与t(运动时间)/m(重力常数)(雪球/鸡蛋/末影珍珠都是0.03)有关。
次要部分——伤害
很简单
- /execute @e[type=Snowball] ~ ~-0.5 ~ effect @e[type=亡灵生物,r=2] minecraft:instant_health 等级 0
复制代码
- /execute @e[type=Snowball] ~ ~-0.5 ~ effect @e[type=非亡灵生物,r=2] minecraft:instant_damage 等级 0
把玩存档
[groupid=546]Command Block Logic[/groupid]