Skip to content

Instantly share code, notes, and snippets.

@nigjo
Last active June 28, 2020 09:40
Show Gist options
  • Save nigjo/c0f672fba7374f43118f1cc96748e602 to your computer and use it in GitHub Desktop.
Save nigjo/c0f672fba7374f43118f1cc96748e602 to your computer and use it in GitHub Desktop.
Vanilla Minecraft Plot Builder - A windows batch file to generate all commands for a "user build plot" on a vanilla minecraft server. Generated Commands can be pasted to the server console or send via RCON or as .mcfunction
@echo off
REM (c) 2020 by Jens Hofschröer. Use at your own risk!
REM Licence: (CC BY-SA 4.0) https://creativecommons.org/licenses/by-sa/4.0/
REM Source: https://gist.github.com/nigjo/c0f672fba7374f43118f1cc96748e602
REM
REM to create a plot relative to current player (for datapack functions)
REM run this file with parameters
REM "11+halfx" 1 "11+halfz"
REM
REM replace with regex in resultfile:
REM /^fill (-?\d+) (-?\d+) (-?\d+) (-?\d+) (-?\d+) (-?\d+) (.*)/
REM => fill ~$1 ~$2 ~$3 ~$4 ~$5 ~$6 $7
REM /^setblock (-?\d+) (-?\d+) (-?\d+) (.*)/ => setblock ~$1 ~$2 ~$3 $4
REM
REM copy to <world>\datapacks\plotmaker\data\nigjode\functions\plot<x>x<z>.mcfunction
REM
REM Run Function at location. Plot will be generated in position x and z direction.
setlocal
chcp 65001 >nul
title %~nx0
if "%~1" == "init" (
shift
set pb_printinit=true
)
set "infile=%~1"
if not defined infile set infile=~%~n0.tiles
set outmethod=type "%infile%"
if not exist "%infile%" (
if not "%~2" == "" (
set "outfile=%~n0.mcfunction"
set infile=
set outmethod=echo %1 %2 %3 %4 %5
) else (
echo --- Unable to find input file: "%infile%"
goto :eof
)
) else (
echo infile=%infile%
for %%O in ('echo "%infile%"') do set "outfile=%%~dpnO.mcfunction"
)
echo outfile=%outfile%
(
if defined pb_printinit (
echo gamerule sendCommandFeedback false
)
echo say §2--- running §a%~nx0§2 build...
echo say §2--- §7generated §3%DATE%, %TIME%
if defined pb_printinit (
echo say §2--- initialize configuration
echo gamerule doWeatherCycle false
echo gamerule doFireTick false
echo gamerule doEntityDrops false
echo gamerule doTileDrops false
echo gamerule doMobLoot false
echo gamerule keepInventory true
echo gamerule mobGriefing false
)
)>"%outfile%"
if not defined pb_autolight set pb_autolight=true
if not defined pb_light if "%pb_autolight%" == "true" (
set pb_light=redstone_lamp
) else (
set pb_light=sea_lantern
)
if not defined pb_foundation set pb_foundation=stone
if not defined pb_base set pb_base=grass_block
if not defined pb_border set pb_border=stone_bricks
if not defined pb_fence set pb_fence=oak_fence
if not defined pb_asphalt set pb_asphalt=black_wool
if not defined pb_marks set pb_marks=white_wool
if not defined pb_curb set pb_curb=light_gray_wool
if not defined pb_sidewalk set pb_sidewalk=smooth_stone_slab
if defined infile echo say §2--- §7using plots from §3"%infile%">>"%outfile%"
for /F "eol=# delims=*" %%T in ('%outmethod%') do call :buildTile %%T
echo say §2--- §7done.>>"%outfile%"
goto :eof
:buildTile
set centerx=%~1
set centery=%~2
set centerz=%~3
set halfx=%~4
set halfz=%~5
echo generate commands to build plot at %centerx% %centery% %centerz% >&2
(
echo say §2--- §7generate plot at §3%centerx% %centery% %centerz%
call :addPlain
echo say §2--- §7streets:
call :addStreet
)>>"%outfile%"
goto :eof
:koords
set /a koordx%~1=%~2
set /a koordy%~1=%~3
set /a koordz%~1=%~4
goto :eof
:addPlain
call :koords from "%centerx% - %halfx%" "%centery% - 1" "%centerz% - %halfz%"
call :koords to "%centerx% + %halfx% + 1" "%centery% - 1" "%centerz% + %halfz% + 1"
echo fill %koordxfrom% %koordyfrom% %koordzfrom% %koordxto% %koordyto% %koordzto% minecraft:%pb_border%
call :addPlainQuadrant -%halfx% -%halfz%
call :addPlainQuadrant "+%halfx% - 1" "+%halfz% -1"
call :addPlainQuadrant "+%halfx% - 1" -%halfz%
call :addPlainQuadrant -%halfx% "+%halfz% - 1"
call :addFence
goto :eof
:freeSpace
set minheight=%6
if not defined minheight set minheight=0
set /a nextheight=%5 - 10
if /i %nextheight% LSS %minheight% set nextheight=%minheight%
call :koords from %1 "%centery% + %5" %2
call :koords to %3 "%centery% + %nextheight%" %4
echo fill %koordxfrom% %koordyfrom% %koordzfrom% %koordxto% %koordyto% %koordzto% minecraft:air
if /I %nextheight% GTR %minheight% call :freeSpace %1 %2 %3 %4 %nextheight% %minheight%
goto :eof
:addPlainQuadrant
set /a addx=(%~1) / ~(%~1)
set /a addz=(%~2) / ~(%~2)
call :freeSpace "%centerx% + %addx% + 1" "%centerz% + %addz% + 1" "%centerx% + %~1 + (%addx%*2) + 2" "%centerz% + %~2 + (%addz%*2) + 2" 40
call :koords from "%centerx% + %addx% + 1" "%centery% - 1" "%centerz% + %addz% + 1"
call :koords to "%centerx% + %~1 + 1" "%centery% - 1" "%centerz% + %~2 +1"
echo fill %koordxfrom% %koordyfrom% %koordzfrom% %koordxto% %koordyto% %koordzto% minecraft:%pb_base%
call :koords from "%centerx% + %~1 + (%addx%*2) + 2" "%centery% - 2" "%centerz% + %~2 + (%addz%*2) + 2"
call :koords to "%centerx% + %addx% + 1" "%centery% - 6" "%centerz% + %addz% + 1"
echo fill %koordxfrom% %koordyfrom% %koordzfrom% %koordxto% %koordyto% %koordzto% minecraft:%pb_foundation%
goto :eof
:addFence
call :koords from "%centerx% - %halfx%" "%centery%" "%centerz% - %halfz%"
call :koords to "%centerx% + %halfx% + 1" "%centery%" "%centerz% + %halfz% + 1"
echo fill %koordxfrom% %koordyfrom% %koordzfrom% %koordxto% %koordyto% %koordzto% minecraft:%pb_fence%
call :koords from "%centerx% - %halfx% + 1" "%centery%" "%centerz% - %halfz% + 1"
call :koords to "%centerx% + %halfx%" "%centery%" "%centerz% + %halfz%"
echo fill %koordxfrom% %koordyfrom% %koordzfrom% %koordxto% %koordyto% %koordzto% minecraft:air
goto :eof
:addStreet
echo say §2--- §7- junctions
call :addStreetCorner - %halfx% - %halfz%
call :addStreetCorner - %halfx% + "%halfz% + 1"
call :addStreetCorner + "%halfx% + 1" - %halfz%
call :addStreetCorner + "%halfx% + 1" + "%halfz% + 1"
echo say §2--- §7- street nord
call :addStreetZ - %halfz%
echo say §2--- §7- street east
call :addStreetX + "%halfx% + 1"
echo say §2--- §7- street south
call :addStreetZ + "%halfz% + 1"
echo say §2--- §7- street west
call :addStreetX - %halfx%
goto :eof
:addStreetCorner
REM echo say §2--- §7Ecke %1%halfx% %3%halfz%
rem call :freeSpace "%centerx% %~1 %~2 %~1 1" "%centerz% %~3 %~4 %~3 1"
call :koords from "%centerx% %~1 %~2 %~1 1" "%centery% - 1" "%centerz% %~3 %~4 %~3 1"
call :koords to "%centerx% %~1 %~2 %~1 11" "%centery% + 30" "%centerz% %~3 %~4 %~3 11"
echo fill %koordxfrom% %koordyfrom% %koordzfrom% %koordxto% %koordyto% %koordzto% minecraft:air
call :koords from "%centerx% %~1 %~2 %~1 1" "%centery% - 2" "%centerz% %~3 %~4 %~3 1"
call :koords to "%centerx% %~1 %~2 %~1 11" "%centery% -2" "%centerz% %~3 %~4 %~3 11"
echo fill %koordxfrom% %koordyfrom% %koordzfrom% %koordxto% %koordyto% %koordzto% minecraft:%pb_curb%
call :koords from "%centerx% %~1 %~2 %~1 1" "%centery% - 3" "%centerz% %~3 %~4 %~3 1"
call :koords to "%centerx% %~1 %~2 %~1 11" "%centery% - 6" "%centerz% %~3 %~4 %~3 11"
echo fill %koordxfrom% %koordyfrom% %koordzfrom% %koordxto% %koordyto% %koordzto% minecraft:%pb_foundation%
call :koords from "%centerx% %~1 %~2 %~1 4" "%centery% - 2" "%centerz% %~3 %~4 %~3 1"
call :koords to "%centerx% %~1 %~2 %~1 8" "%centery% -2" "%centerz% %~3 %~4 %~3 11"
echo fill %koordxfrom% %koordyfrom% %koordzfrom% %koordxto% %koordyto% %koordzto% minecraft:%pb_asphalt%
call :koords from "%centerx% %~1 %~2 %~1 1" "%centery% - 2" "%centerz% %~3 %~4 %~3 4"
call :koords to "%centerx% %~1 %~2 %~1 11" "%centery% -2" "%centerz% %~3 %~4 %~3 8"
echo fill %koordxfrom% %koordyfrom% %koordzfrom% %koordxto% %koordyto% %koordzto% minecraft:%pb_asphalt%
call :koords from "%centerx% %~1 %~2 %~1 1" "%centery% - 1" "%centerz% %~3 %~4 %~3 1"
call :koords to "%centerx% %~1 %~2 %~1 2" "%centery% -1" "%centerz% %~3 %~4 %~3 2"
echo fill %koordxfrom% %koordyfrom% %koordzfrom% %koordxto% %koordyto% %koordzto% minecraft:%pb_sidewalk%
call :koords from "%centerx% %~1 %~2 %~1 1" "%centery% - 1" "%centerz% %~3 %~4 %~3 10"
call :koords to "%centerx% %~1 %~2 %~1 2" "%centery% -1" "%centerz% %~3 %~4 %~3 11"
echo fill %koordxfrom% %koordyfrom% %koordzfrom% %koordxto% %koordyto% %koordzto% minecraft:%pb_sidewalk%
call :koords from "%centerx% %~1 %~2 %~1 10" "%centery% - 1" "%centerz% %~3 %~4 %~3 1"
call :koords to "%centerx% %~1 %~2 %~1 11" "%centery% -1" "%centerz% %~3 %~4 %~3 2"
echo fill %koordxfrom% %koordyfrom% %koordzfrom% %koordxto% %koordyto% %koordzto% minecraft:%pb_sidewalk%
call :koords from "%centerx% %~1 %~2 %~1 10" "%centery% - 1" "%centerz% %~3 %~4 %~3 10"
call :koords to "%centerx% %~1 %~2 %~1 11" "%centery% -1" "%centerz% %~3 %~4 %~3 11"
echo fill %koordxfrom% %koordyfrom% %koordzfrom% %koordxto% %koordyto% %koordzto% minecraft:%pb_sidewalk%
goto :eof
:addStreetZ
REM echo say §2--- §7Bulldozer
call :freeSpace "%centerx% - %halfx%" "%centerz% %~1 %~2 %~1 11" "%centerx% + %halfx% + 1" "%centerz% %~1 %~2 %~1 1" 30 -2
call :koords from "%centerx% - %halfx% - 11" "%centery% - 1" "%centerz% %~1 %~2 %~1 12"
call :koords to "%centerx% + %halfx% + 1 + 11" "%centery% + 30" "%centerz% %~1 %~2 %~1 12"
echo fill %koordxfrom% %koordyfrom% %koordzfrom% %koordxto% %koordyto% %koordzto% minecraft:glass replace minecraft:water
echo fill %koordxfrom% %koordyfrom% %koordzfrom% %koordxto% %koordyto% %koordzto% minecraft:air replace #minecraft:logs
REM echo say §2--- §7Asphalt
call :koords from "%centerx% - %halfx%" "%centery% - 2" "%centerz% %~1 %~2 %~1 11"
call :koords to "%centerx% + %halfx% + 1" "%centery% - 6" "%centerz% %~1 %~2 %~1 1"
echo fill %koordxfrom% %koordyfrom% %koordzfrom% %koordxto% %koordyto% %koordzto% minecraft:%pb_foundation%
call :koords from "%centerx% - %halfx%" "%centery% - 2" "%centerz% %~1 %~2 %~1 8"
call :koords to "%centerx% + %halfx% + 1" "%centery% - 2" "%centerz% %~1 %~2 %~1 4"
echo fill %koordxfrom% %koordyfrom% %koordzfrom% %koordxto% %koordyto% %koordzto% minecraft:%pb_asphalt%
REM echo say §2--- §7Bürgersteige
call :koords from "%centerx% - %halfx%" "%centery% - 1" "%centerz% %~1 %~2 %~1 2"
call :koords to "%centerx% + %halfx% + 1" "%centery% - 1" "%centerz% %~1 %~2 %~1 1"
echo fill %koordxfrom% %koordyfrom% %koordzfrom% %koordxto% %koordyto% %koordzto% minecraft:%pb_sidewalk%
call :koords from "%centerx% - %halfx%" "%centery% - 1" "%centerz% %~1 %~2 %~1 11"
call :koords to "%centerx% + %halfx% + 1" "%centery% - 1" "%centerz% %~1 %~2 %~1 10"
echo fill %koordxfrom% %koordyfrom% %koordzfrom% %koordxto% %koordyto% %koordzto% minecraft:%pb_sidewalk%
REM echo say §2--- §7Randstreifen
call :koords from "%centerx% - %halfx%" "%centery% - 2" "%centerz% %~1 %~2 %~1 3"
call :koords to "%centerx% + %halfx% + 1" "%centery% - 2" "%centerz% %~1 %~2 %~1 3"
rem replace !minecraft:sea_lantern
echo fill %koordxfrom% %koordyfrom% %koordzfrom% %koordxto% %koordyto% %koordzto% minecraft:%pb_curb%
call :koords from "%centerx% - %halfx%" "%centery% - 2" "%centerz% %~1 %~2 %~1 9"
call :koords to "%centerx% + %halfx% + 1" "%centery% - 2" "%centerz% %~1 %~2 %~1 9"
rem replace !minecraft:sea_lantern
echo fill %koordxfrom% %koordyfrom% %koordzfrom% %koordxto% %koordyto% %koordzto% minecraft:%pb_curb%
REM echo say §2--- §7Mittelstreifen
call :koords from "%centerx% - %halfx%" "%centery% - 2" "%centerz% %~1 %~2 %~1 6"
call :koords to "%centerx% + %halfx% + 1" "%centery% - 2" "%centerz% %~1 %~2 %~1 6"
echo fill %koordxfrom% %koordyfrom% %koordzfrom% %koordxto% %koordyto% %koordzto% minecraft:%pb_marks%
call :koords from "%centerx% + %halfx% + 1" "%centery% - 2" "%centerz% %~1 %~2 %~1 6"
call :koords to "%centerx% + %halfx% + 1" "%centery% - 2" "%centerz% %~1 %~2 %~1 6 + 2"
echo fill %koordxfrom% %koordyfrom% %koordzfrom% %koordxto% %koordyto% %koordzto% minecraft:%pb_marks%
call :koords from "%centerx% - %halfx%" "%centery% - 2" "%centerz% %~1 %~2 %~1 6"
call :koords to "%centerx% - %halfx%" "%centery% - 2" "%centerz% %~1 %~2 %~1 6 - 2"
echo fill %koordxfrom% %koordyfrom% %koordzfrom% %koordxto% %koordyto% %koordzto% minecraft:%pb_marks%
call :koords from "%centerx% - %halfx% + 4" "%centery% - 2" "%centerz% %~1 %~2 %~1 6"
for /L %%X in (%koordxfrom%, 4, %centerx%) do (
echo setblock %%X %koordyfrom% %koordzfrom% minecraft:%pb_asphalt%
)
call :koords from "%centerx% + %halfx% + 1 - 4" "%centery% - 2" "%centerz% %~1 %~2 %~1 6"
for /L %%X in (%koordxfrom%, -4, %centerx%) do (
echo setblock %%X %koordyfrom% %koordzfrom% minecraft:%pb_asphalt%
)
REM echo say §2--- §7Lampen
set /a "otherside=%centerz% %~1 %~2 %~1 9"
if "%pb_autolight%" == "true" goto :generateLampsWithRedstoneZ
call :koords from "%centerx% - %halfx% " "%centery% - 2" "%centerz% %~1 %~2 %~1 3"
for /L %%X in (%koordxfrom%, 8, %centerx%) do (
echo setblock %%X %koordyfrom% %koordzfrom% minecraft:%pb_light%
echo setblock %%X %koordyfrom% %otherside% minecraft:%pb_light%
)
call :koords from "%centerx% + %halfx% + 1" "%centery% - 2" "%centerz% %~1 %~2 %~1 3"
for /L %%X in (%koordxfrom%, -8, %centerx%) do (
echo setblock %%X %koordyfrom% %koordzfrom% minecraft:%pb_light%
echo setblock %%X %koordyfrom% %otherside% minecraft:%pb_light%
)
goto :eof
:addStreetX
REM echo say §2--- §7Bulldozer
call :freeSpace "%centerx% %~1 %~2 %~1 11" "%centerz% - %halfz%" "%centerx% %~1 %~2 %~1 1" "%centerz% + %halfz% + 1" 30 -2
call :koords from "%centerx% %~1 %~2 %~1 12" "%centery% - 1" "%centerz% - %halfz% - 11"
call :koords to "%centerx% %~1 %~2 %~1 12" "%centery% + 30" "%centerz% + %halfz% + 1 + 11"
echo fill %koordxfrom% %koordyfrom% %koordzfrom% %koordxto% %koordyto% %koordzto% minecraft:glass replace minecraft:water
echo fill %koordxfrom% %koordyfrom% %koordzfrom% %koordxto% %koordyto% %koordzto% minecraft:air replace #minecraft:logs
REM echo say §2--- §7Asphalt
call :koords from "%centerx% %~1 %~2 %~1 11" "%centery% - 2" "%centerz% - %halfz%"
call :koords to "%centerx% %~1 %~2 %~1 1" "%centery% - 6" "%centerz% + %halfz% + 1"
echo fill %koordxfrom% %koordyfrom% %koordzfrom% %koordxto% %koordyto% %koordzto% minecraft:%pb_foundation%
call :koords from "%centerx% %~1 %~2 %~1 8" "%centery% - 2" "%centerz% - %halfz%"
call :koords to "%centerx% %~1 %~2 %~1 4" "%centery% - 2" "%centerz% + %halfz% + 1"
echo fill %koordxfrom% %koordyfrom% %koordzfrom% %koordxto% %koordyto% %koordzto% minecraft:%pb_asphalt%
REM echo say §2--- §7Bürgersteige
call :koords from "%centerx% %~1 %~2 %~1 2" "%centery% - 1" "%centerz% - %halfz%"
call :koords to "%centerx% %~1 %~2 %~1 1" "%centery% - 1" "%centerz% + %halfz% + 1"
echo fill %koordxfrom% %koordyfrom% %koordzfrom% %koordxto% %koordyto% %koordzto% minecraft:%pb_sidewalk%
call :koords from "%centerx% %~1 %~2 %~1 11" "%centery% - 1" "%centerz% - %halfz%"
call :koords to "%centerx% %~1 %~2 %~1 10" "%centery% - 1" "%centerz% + %halfz% + 1"
echo fill %koordxfrom% %koordyfrom% %koordzfrom% %koordxto% %koordyto% %koordzto% minecraft:%pb_sidewalk%
REM echo say §2--- §7Randstreifen
call :koords from "%centerx% %~1 %~2 %~1 3" "%centery% - 2" "%centerz% - %halfz%"
call :koords to "%centerx% %~1 %~2 %~1 3" "%centery% - 2" "%centerz% + %halfz% + 1"
echo fill %koordxfrom% %koordyfrom% %koordzfrom% %koordxto% %koordyto% %koordzto% minecraft:%pb_curb%
call :koords from "%centerx% %~1 %~2 %~1 9" "%centery% - 2" "%centerz% - %halfz%"
call :koords to "%centerx% %~1 %~2 %~1 9" "%centery% - 2" "%centerz% + %halfz% + 1"
echo fill %koordxfrom% %koordyfrom% %koordzfrom% %koordxto% %koordyto% %koordzto% minecraft:%pb_curb%
REM echo say §2--- §7Mittelstreifen
call :koords from "%centerx% %~1 %~2 %~1 6" "%centery% - 2" "%centerz% - %halfz%"
call :koords to "%centerx% %~1 %~2 %~1 6" "%centery% - 2" "%centerz% + %halfz% + 1"
echo fill %koordxfrom% %koordyfrom% %koordzfrom% %koordxto% %koordyto% %koordzto% minecraft:%pb_marks%
call :koords from "%centerx% %~1 %~2 %~1 6" "%centery% - 2" "%centerz% + %halfz% + 1"
call :koords to "%centerx% %~1 %~2 %~1 6 - 2" "%centery% - 2" "%centerz% + %halfz% + 1"
echo fill %koordxfrom% %koordyfrom% %koordzfrom% %koordxto% %koordyto% %koordzto% minecraft:%pb_marks%
call :koords from "%centerx% %~1 %~2 %~1 6" "%centery% - 2" "%centerz% -%halfz%"
call :koords to "%centerx% %~1 %~2 %~1 6 + 2" "%centery% - 2" "%centerz% -%halfz%"
echo fill %koordxfrom% %koordyfrom% %koordzfrom% %koordxto% %koordyto% %koordzto% minecraft:%pb_marks%
call :koords from "%centerx% %~1 %~2 %~1 6" "%centery% - 2" "%centerz% - %halfz% + 4"
for /L %%Z in (%koordzfrom%, 4, %centerz%) do (
echo setblock %koordxfrom% %koordyfrom% %%Z minecraft:%pb_asphalt%
)
call :koords from "%centerx% %~1 %~2 %~1 6" "%centery% - 2" "%centerz% + %halfz% + 1 - 4"
for /L %%Z in (%koordzfrom%, -4, %centerz%) do (
echo setblock %koordxfrom% %koordyfrom% %%Z minecraft:%pb_asphalt%
)
REM echo say §2--- §7Lampen
set /a "otherside=%centerx% %~1 %~2 %~1 9"
if "%pb_autolight%" == "true" goto :generateLampsWithRedstoneX
call :koords from "%centerx% %~1 %~2 %~1 3" "%centery% - 2" "%centerz% -%halfz%"
for /L %%Z in (%koordzfrom%, 8, %centerz%) do (
echo setblock %koordxfrom% %koordyfrom% %%Z minecraft:%pb_light%
echo setblock %otherside% %koordyfrom% %%Z minecraft:%pb_light%
)
call :koords from "%centerx% %~1 %~2 %~1 3" "%centery% - 2" "%centerz% + %halfz% + 1"
for /L %%Z in (%koordzfrom%, -8, %centerz%) do (
echo setblock %koordxfrom% %koordyfrom% %%Z minecraft:%pb_light%
echo setblock %otherside% %koordyfrom% %%Z minecraft:%pb_light%
)
goto :eof
:generateLampsWithRedstoneX
REM Readstoneleitungen
call :koords strom1 "%centerx% %~1 %~2 %~1 2" "%centery% - 2" "%centerz% - %halfz%"
call :koords to "%centerx% %~1 %~2 %~1 2" "%centery% - 2" "%centerz% + %halfz% + 1"
echo fill %koordxstrom1% %koordystrom1% %koordzstrom1% %koordxto% %koordyto% %koordzto% minecraft:redstone_wire
call :koords strom2 "%centerx% %~1 %~2 %~1 10" "%centery% - 2" "%centerz% - %halfz%"
call :koords to "%centerx% %~1 %~2 %~1 10" "%centery% - 2" "%centerz% + %halfz% + 1"
echo fill %koordxstrom2% %koordystrom2% %koordzstrom2% %koordxto% %koordyto% %koordzto% minecraft:redstone_wire
REM Lampen und Steine
call :koords from "%centerx% %~1 %~2 %~1 3" "%centery% - 2" "%centerz% -%halfz%"
set /a "compstart=%centerz% -%halfz%"
for /L %%Z in (%compstart%, 8, %centerz%) do (
echo setblock %koordxfrom% %koordyfrom% %%Z minecraft:%pb_light%
echo setblock %koordxstrom1% %koordyfrom% %%Z minecraft:%pb_foundation%
echo setblock %otherside% %koordyfrom% %%Z minecraft:%pb_light%
echo setblock %koordxstrom2% %koordyfrom% %%Z minecraft:%pb_foundation%
)
set /a "compstart=%centerz% -%halfz% - 1 + 8"
for /L %%Z in (%compstart%, 8, %centerz%) do (
echo setblock %koordxstrom1% %koordyfrom% %%Z minecraft:repeater[facing=north,delay=2]
echo setblock %koordxstrom2% %koordyfrom% %%Z minecraft:repeater[facing=north,delay=2]
)
set /a "compstart=%centerz% + %halfz% + 1"
for /L %%Z in (%compstart%, -8, %centerz%) do (
echo setblock %koordxfrom% %koordyfrom% %%Z minecraft:%pb_light%
echo setblock %koordxstrom1% %koordyfrom% %%Z minecraft:%pb_foundation%
echo setblock %otherside% %koordyfrom% %%Z minecraft:%pb_light%
echo setblock %koordxstrom2% %koordyfrom% %%Z minecraft:%pb_foundation%
)
set /a "compstart=%centerz% + %halfz% + 2 - 8"
for /L %%Z in (%compstart%, -8, %centerz%) do (
echo setblock %koordxstrom1% %koordyfrom% %%Z minecraft:repeater[facing=south,delay=2]
echo setblock %koordxstrom2% %koordyfrom% %%Z minecraft:repeater[facing=south,delay=2]
)
REM Sensoren
call :koords sensor "0" "%centery% -1" "%centerz% + %halfz% - 2"
echo setblock %koordxstrom1% %koordysensor% %koordzsensor% minecraft:daylight_detector[inverted=true]
echo setblock %koordxstrom2% %koordysensor% %koordzsensor% minecraft:daylight_detector[inverted=true]
call :koords sensor "0" "%centery% -1" "%centerz% - %halfz% + 3"
echo setblock %koordxstrom1% %koordysensor% %koordzsensor% minecraft:daylight_detector[inverted=true]
echo setblock %koordxstrom2% %koordysensor% %koordzsensor% minecraft:daylight_detector[inverted=true]
goto :eof
:generateLampsWithRedstoneZ
REM Readstoneleitungen
call :koords strom1 "%centerx% - %halfx%" "%centery% - 2" "%centerz% %~1 %~2 %~1 2"
call :koords to "%centerx% + %halfx% + 1" "%centery% - 2" "%centerz% %~1 %~2 %~1 2"
echo fill %koordxstrom1% %koordystrom1% %koordzstrom1% %koordxto% %koordyto% %koordzto% minecraft:redstone_wire
call :koords strom2 "%centerx% - %halfx%" "%centery% - 2" "%centerz% %~1 %~2 %~1 10"
call :koords to "%centerx% + %halfx% + 1" "%centery% - 2" "%centerz% %~1 %~2 %~1 10"
echo fill %koordxstrom2% %koordystrom2% %koordzstrom2% %koordxto% %koordyto% %koordzto% minecraft:redstone_wire
REM Lampen und Steine
call :koords from "%centerx% - %halfx% " "%centery% - 2" "%centerz% %~1 %~2 %~1 3"
set /a "compstart=%centerx% - %halfx%"
for /L %%X in (%compstart%, 8, %centerx%) do (
echo setblock %%X %koordyfrom% %koordzfrom% minecraft:%pb_light%
echo setblock %%X %koordyfrom% %koordzstrom1% minecraft:%pb_foundation%
echo setblock %%X %koordyfrom% %otherside% minecraft:%pb_light%
echo setblock %%X %koordyfrom% %koordzstrom2% minecraft:%pb_foundation%
)
set /a "compstart=%centerx% - %halfx% - 1 + 8"
for /L %%X in (%compstart%, 8, %centerx%) do (
echo setblock %%X %koordyfrom% %koordzstrom1% minecraft:repeater[facing=west,delay=2]
echo setblock %%X %koordyfrom% %koordzstrom2% minecraft:repeater[facing=west,delay=2]
)
call :koords from "%centerx% - %halfx% " "%centery% - 2" "%centerz% %~1 %~2 %~1 3"
set /a "compstart=%centerx% + %halfx% + 1"
for /L %%X in (%compstart%, -8, %centerx%) do (
echo setblock %%X %koordyfrom% %koordzfrom% minecraft:%pb_light%
echo setblock %%X %koordyfrom% %koordzstrom1% minecraft:%pb_foundation%
echo setblock %%X %koordyfrom% %otherside% minecraft:%pb_light%
echo setblock %%X %koordyfrom% %koordzstrom2% minecraft:%pb_foundation%
)
set /a "compstart=%centerx% + %halfx% + 2 - 8"
for /L %%X in (%compstart%, -8, %centerx%) do (
echo setblock %%X %koordyfrom% %koordzstrom1% minecraft:repeater[facing=east,delay=2]
echo setblock %%X %koordyfrom% %koordzstrom2% minecraft:repeater[facing=east,delay=2]
)
REM Sensoren
call :koords sensor "%centerx% + %halfx% - 2" "%centery% -1" 0
echo setblock %koordxsensor% %koordysensor% %koordzstrom1% minecraft:daylight_detector[inverted=true]
echo setblock %koordxsensor% %koordysensor% %koordzstrom2% minecraft:daylight_detector[inverted=true]
call :koords sensor "%centerx% - %halfx% + 3" "%centery% -1" 0
echo setblock %koordxsensor% %koordysensor% %koordzstrom1% minecraft:daylight_detector[inverted=true]
echo setblock %koordxsensor% %koordysensor% %koordzstrom2% minecraft:daylight_detector[inverted=true]
goto :eof
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment