Files

27 lines
858 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.
# chroma_trail.js — putBack() (satır 235)
[← chroma_trail.js](index.md) · [← Master](../../wiki.md)
```javascript
function putBack(w, x, y, z, id, meta, placed, strict) {
if (!w) return -1;
var orig = makeState(id, meta);
if (!orig) return 0;
var loaded = loadChunk(w, x, z);
var cur = w.getBlock(x, y, z);
if (!cur) return -1;
if (cur.isAir() && !loaded) return -1; // yuklu degilse AIR "bilinmiyor" demek
var cid = String(cur.getBlockId());
if (cid === "minecraft:piston_head" || cid === "minecraft:piston_extension") return -1;
var ours = placed && cur.isSame(placed);
var broken = cur.isAir() && !strict;
if (!ours && !broken) return 0;
w.setBlock(orig, x, y, z);
var after = w.getBlock(x, y, z);
return (after && after.isSame(orig)) ? 1 : -1;
}
```