Files

22 lines
563 B
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# 3NPC.js — findValidPosition() (satır 451)
[← 3NPC.js](index.md) · [← Master](../../wiki.md)
```javascript
function findValidPosition(world, x, y, z)
{
var yi = Math.floor(y);
for (var dy = 2; dy >= -3; dy--)
{
var cy = yi + dy;
try {
var b1 = world.getBlock(x, cy, z);
var b2 = world.getBlock(x, cy+1, z);
var b3 = world.getBlock(x, cy+2, z);
if (!b1.isAir() && b2.isAir() && b3.isAir()) return cy + 1;
} catch(e) {}
}
return y;
}
```