Files

49 lines
1.8 KiB
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.
# Jade.js — runProjectile() (satır 178)
[← Jade.js](index.md) · [← Master](../../wiki.md)
Parça 2/6 · [önceki](runProjectile.md) · [sonraki](runProjectile-3.md)
```javascript
hitPos = ray.getHitPosition();
}
} else if (ray.isBlock()) {
didHit = true;
hitPos = ray.getHitPosition();
}
}
if (didHit && hitPos !== null) {
var cx = Math.floor(hitPos.x);
var cy = Math.floor(hitPos.y);
var cz = Math.floor(hitPos.z);
var radius = SPELL_CONFIG.CRATER_RADIUS;
var rSq = radius * radius;
var minY = 999;
var maxY = -999;
var blocks = [];
var idMap = {};
var idList = [];
// 1. Orijinal zemin blok durumlarını kaydet (Uçan yerçekimi debrisleri kapatıldı!)
for (var dx = -radius; dx <= radius; dx++) {
for (var dy = -radius; dy <= radius; dy++) {
for (var dz = -radius; dz <= radius; dz++) {
if (dx*dx + dy*dy + dz*dz <= rSq) {
var bx = cx + dx;
var by = cy + dy;
var bz = cz + dz;
if (by >= 0 && by <= 255) {
var state = world.getBlock(bx, by, bz);
if (state !== null) {
var isAir = state.isAir() || state.getBlockId() === "minecraft:air";
if (!isAir) {
var id = state.getBlockId();
var idIdx = idMap[id];
if (idIdx === undefined) {
idIdx = idList.length;
idMap[id] = idIdx;
```