前言
这几天黄老板在主城发物资,但不知道是不是我人品问题几乎没拿到什么东西。
于是我想研究一下Minecraft物品拾取的机制.顺便练习使用Markdown
正文
当一个物品离一个物品栏不满的玩家距离较短时,它就会无视其间的任何方块而快速地飞向这名玩家。
如果玩家挖掘一个方块,0.5秒后玩家能捡起它。如果此物品是玩家丢掉的,2秒后才能再次捡起它
背包不满和距离较短我想应该是众所周知的。
在掉落物的数据标签中有一个Thrower标签,用于记录丢出者。
而标签PickupDelay对于所有玩家都是10ticks,在这10ticks过后看谁的距离短谁就能捡起来
似乎还差了些什么。
Items are picked up when they collide with a player. Player collisions are being checked by using the bounding box of the player (0.8x1.8x0.8), expanding it by 1x0.5x1 and then checking for any entity in that area. Your pickup radius will result to a 2.8x2.8x2.8 cube centered around the middle of the player (0.8 + 12 = 2.8 and 1.8 + 0.52 = 2.8). Please note that while riding another entity , the two bounding boxes will be joined before expanding them (also note that the expansion will be 1x0x1 then), so the sphere can get bigger then.
When picking up an item diagonal from your position (also 0.5 blocks under you),you can pickup from rootOf(1.41.42+0.5*0.5) = 2.04 distance.
他也给出了相应代码片段(Source: )
AxisAlignedBB axisalignedbb;
if (this.isRiding() && !this.getRidingEntity().isDead)
{
axisalignedbb = this.getEntityBoundingBox().union(this.getRidingEntity().getEntityBoundingBox()).expand(1.0D, 0.0D, 1.0D);
}
else
{
axisalignedbb = this.getEntityBoundingBox().expand(1.0D, 0.5D, 1.0D);
}
List<Entity> list = this.world.getEntitiesWithinAABBExcludingEntity(this, axisalignedbb);
for (int i = 0; i < list.size(); ++i)
{
Entity entity = list.get(i);
if (!entity.isDead)
{
this.collideWithPlayer(entity);
}
}
也就是说在我没有骑生物的时候,我将会有以我为中心2.8*2.8*2.8(XYZ)的立方体来吸取物品,加成为1x0.5x1。
但是我骑了动物,这个范围将会加上骑着的生物的碰撞箱体积,同时加成变为1x0x1
数据
参演人员碰撞箱数据
引用文中的宽度数据是0.8,但是经查阅现在变为了0.6,接下来将会按照0.6进行计算 (XZY)
_Rimo 0.6*0.6*1.8 吸取半径r1.60 h1.4
一只猪 0.9*0.9*0.9 吸取半径1.75 h1.35 //高度不再额外补加
一匹马 1.4*1.4*1.6 吸取半径2.00 h1.7 //高度不再额外补加
实验在世界 0.500 4.~ 0.500 进行 生物加上NoAI:1标签
原来我在这个世界身高1.85m //算上额外像素
实践




在同一水平高度也做了测试,结果和上面的结果相似.
结论
近者优先
无论是从数据还是实践来看,骑着生物会提升一定量的半径捡拾距离,但是高度就不一定了
后记
以上所有实验均在理想情况下进行,现实因素诸如延迟差异,你的碰撞箱和别人相比更迟开始判定之类的将会导致结果不同
要数碰撞箱的话,末影龙应该是原版生物里面碰撞箱最大的了。但是原版能骑的生物马半径最大
我查完资料才发现还有这种判定规则。或许还有更多的等待发现
所以为什么骑着马手会变长呢