java就是一种游戏性。getPosition在1.16版本的Forge中
我正在尝试制作一双靴子,允许用户在熔岩上行走。我的代码:
if (world.getFluidState(player.getPosition().down()).getFluid() == Fluids.LAVA) { // Check if lava is below the player
Vector3d motion = player.getMotion();
if (motion.y < 0)
motion = motion.mul(1, 0, 1); // Stop the player from falling into the lava
player.setMotion(motion);
}
然而,函数.getPosition
似乎被弃用了。Forge的1.16版本中是否有此功能的等效版本?.getPositionVec
返回一个向量,但我不确定如何在函数中使用它
# 1 楼答案
如果您的
player
实现了ICommandSender
,那么您应该能够使用以下之后,您可以访问
coords.posX
/coords.posY
/coords.posZ
有关更多信息,请查看this source