Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- モニターゲット
- local mon = peripheral.wrap("left")
- -- CommandComputerの位置をゲット
- local cx,cy,cz = commands.getBlockPosition()
- function buildFrame(x,y,z,block_name)
- for i=-1,1 do
- commands.setBlock(x+i,y,z+1,block_name)
- end
- for i=-1,1 do
- commands.setBlock(x+i,y,z-1,block_name)
- end
- for i=-1,1,2 do
- commands.setBlock(x+i,y,z,block_name)
- end
- end
- -- 村人カウンター作成(Closure使用、実行するたびカウントアップ)
- function makeCounter(_count)
- local count = _count or 0
- return function()
- count = count + 1
- print(count)
- mon.setCursorPos(1,1)
- mon.write("Summon:")
- mon.setCursorPos(1,2)
- mon.write(" "..tostring(count))
- end
- end
- -- ######################################
- -- メイン
- -- モニター初期化
- mon.clear()
- mon.setTextScale(1)
- -- カウンター作成
- local counter = makeCounter(0)
- -- 施設建設
- buildFrame(cx,cy+1,cz, "minecraft:iron_bars")
- commands.setBlock(cx,cy+1,cz,"minecraft:flowing_lava")
- -- 村人さんかわいそす
- while true do
- commands.playsound("mob.endermen.portal","@a")
- commands.summon("Villager", cx,cy+4,cz)
- counter()
- os.sleep(3)
- end
Advertisement
Add Comment
Please, Sign In to add comment