本文整理了Java中net.minecraft.util.math.MathHelper.absMax()
方法的一些代码示例,展示了MathHelper.absMax()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。MathHelper.absMax()
方法的具体详情如下:
包路径:net.minecraft.util.math.MathHelper
类名称:MathHelper
方法名:absMax
暂无
代码示例来源:origin: P3pp3rF1y/AncientWarfare2
@Override
public void applyEntityCollision(Entity entity) {
if (entity != getControllingPassenger() && !(entity instanceof NpcBase))//skip if it if it is the rider
{
double xDiff = entity.posX - this.posX;
double zDiff = entity.posZ - this.posZ;
double entityDistance = MathHelper.absMax(xDiff, zDiff);
if (entityDistance >= 0.009999999776482582D) {
entityDistance = Math.sqrt(entityDistance);
xDiff /= entityDistance;
zDiff /= entityDistance;
double normalizeToDistance = 1.0D / entityDistance;
if (normalizeToDistance > 1.0D) {
normalizeToDistance = 1.0D;
}
xDiff *= normalizeToDistance;
zDiff *= normalizeToDistance;
xDiff *= 0.05000000074505806D;//wtf..normalize to ticks?
zDiff *= 0.05000000074505806D;
xDiff *= (double) (1.0F - this.entityCollisionReduction);
zDiff *= (double) (1.0F - this.entityCollisionReduction);
this.addVelocity(-xDiff, 0.0D, -zDiff);
entity.addVelocity(xDiff, 0.0D, zDiff);
}
}
}
代码示例来源:origin: OpenModularTurretsTeam/OpenModularTurrets
boolean chebyshevDistance(Entity target) {
Vec3d targetPos = new Vec3d(target.posX, target.posY, target.posZ);
/*if (ModCompatibility.ValkyrienWarfareLoaded) {
Entity shipEntity = ValkyrienWarfareHelper.getShipManagingBlock(this.getWorld(), this.getPos());
if (shipEntity != null) {
//The turret is on a Ship, time to convert the coordinates; converting the target positions to local ship space
targetPos = ValkyrienWarfareHelper.getVec3InShipSpaceFromWorldSpace(shipEntity, targetPos);
}
} */
if (this.base == null) {
return false;
}
return MathHelper.absMax(MathHelper.absMax(targetPos.x - this.getPos().getX(), targetPos.y - this.getPos().getY()),
targetPos.z - this.getPos().getZ()) > (this.base.getCurrentMaxRange());
}
代码示例来源:origin: OpenModularTurretsTeam/OpenModularTurrets
if ((traced.getBlockPos().equals(turret.getPos())) || (!hitBlock.getMaterial().isSolid() && MathHelper.absMax(
MathHelper.absMax(traceStart.x - traceEnd.x, traceStart.y - traceEnd.y),
traceStart.z - traceEnd.z) > 1)) {
内容来源于网络,如有侵权,请联系作者删除!