Minecraft基岩版 1.17.30.21實裝了query.block_neighbor_has_any_tag
這個函數,可查詢相鄰方塊的tag。
用法:
query.block_neighbor_has_any_tag (x, y, z , tag名)
利用這個函數,可偵測附近方塊的狀態,控制該方塊的外觀。
來看Ihategravel的例子,他做出了自動連結的柱子。
按 這裡下載他的範本包
All the blocks update automatically btw. pic.twitter.com/x6pmjasDgy
— Ihategravel (@ihategravel2) August 13, 2021
自訂柵欄方塊也變的可能。
Made working custom fences using the new molang queries in 1.17.30.21! I’ll be releasing this on @MCPEDL soon.
(you can jump over them but mobs can’t)Massive thanks to @ihategravel2 for his pillar template that got me started with the new add-on features :) pic.twitter.com/zbAXtXSNfc
— HonKit26113 (@HonKit1103) August 13, 2021
甚至還能自訂傀儡。
The new codes from the blocks can be used from more thing that make connected textures, also you can make custom golems like in this example.
This add-on will be soon in @MCPEDL pic.twitter.com/1xGv7Yd9X9— Xero (@UrielXero) August 14, 2021
Ihategravel的做法是寫好方塊狀態的property。
用tick組件隨時執行更新方塊狀態的event,使用query.block_neighbor_has_any_tag
偵測上下左右放置的方塊,再交由permutation決定方塊的geometry。
Property用法參見: