Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @echo off
- :: Simplification of json creation for slabs and stairs, from either an all sided block, pillar block, or different sided block (Sand stone example)
- :: Standard Blockstate for slabs, stairs, Pillars, & blocks
- :: Basic & functional Loot table for each block (suggestion to make it robust to your after creation)
- :: Uses blockname_top, blockname_side, blockname_bottom for blocks with different textures
- :: Uses blockname_top, blockname_side for pillar blocks. (texture)
- :: Set for Blocks
- :: *edit, overlooked control for UVLOCK.. may not have mattered, but fix anyways.
- goto Start
- :RE2
- echo Next Name or exit?
- set /p T= "Next (N)"
- if %T%==n (goto Top)
- if %T%==N (goto Top)
- :End
- exit
- :Start
- set BLOCKS=.\blockstate\
- set BLOCK=.\models\block\
- set SLAB=%BLOCK%slab\
- set STAIR=%BLOCK%stair\
- set PILLA=%BLOCK%pillar\
- set ITEM=.\models\item\
- set DROP=.\loot_tables\blocks\
- set MOD=vanilla_reclaim
- if EXIST %BLOCKS% (
- echo Blockstate folder
- ) else (
- mkdir %BLOCKS%
- echo Blockstate folder
- )
- if EXIST %BLOCK% (
- echo Blocks folder
- ) else (
- mkdir %BLOCK%
- echo Block folder
- )
- if EXIST %SLAB% (
- echo Slabs folder
- ) else (
- mkdir %SLAB%
- echo Slabs folder
- )
- if EXIST %STAIR% (
- echo Stairs folder
- ) else (
- mkdir %STAIR%
- echo Stairs folder
- )
- if EXIST %ITEM% (
- echo Items folder
- ) else (
- mkdir %ITEM%
- echo Items folder
- )
- if EXIST %DROP% (
- echo Blocks Loot tables folder
- ) else (
- mkdir %DROP%
- echo Blocks Loot tables folder
- )
- set FACE[0]=east
- set FACE[1]=north
- set FACE[2]=south
- set FACE[3]=west
- set HALF[0]=bottom
- set HALF[1]=top
- set SHAPE[0]=inner_left
- set SHAPE[1]=inner_right
- set SHAPE[2]=outer_left
- set SHAPE[3]=outer_right
- set SHAPE[4]=straight
- set /a OUTER=0
- set /a MID=0
- set /a INNER=0
- :Top
- set /p NAM= "Base Block Name: "
- :Sid
- echo Enter ( A ) if block uses the same texture on all sides
- echo Enter ( S ) if it uses a Top, side, & bottom texture that are different
- echo Enter ( P ) for Pillars. Logs & Basalt are pillar blocks
- echo Enter ( E ) to exit.
- echo Provides Basic loot table only. (It breaks, it drops. nothing more)
- set /p ALLSIDED= "Type of block: "
- if %ALLSIDED%==A ( goto Setallsided )
- if %ALLSIDED%==a ( goto Setallsided )
- if %ALLSIDED%==S ( goto Topped )
- if %ALLSIDED%==s ( goto Topped )
- if %ALLSIDED%==P ( goto Pillar )
- if %ALLSIDED%==p ( goto Pillar )
- if %ALLSIDED%==E ( goto End )
- if %ALLSIDED%==e ( goto End )
- echo "Valid Entries are ( A, a, S, s, E, e ), or Exit (E)"
- goto Sid
- :Setallsided
- set ALLSIDED=ALL
- goto Blockstate
- :Pillar
- set ALLSIDED=PILL
- set AXIS=x
- goto Blockstate
- :Topped
- set ALLSIDED=TOPP
- :Blockstate
- ::Blockstates
- ::Base Block
- echo { > %BLOCKS%%NAM%.json
- echo "variants": { >> %BLOCKS%%NAM%.json
- if %ALLSIDED%==PILL ( goto Blockstatepill )
- echo "": { >> %BLOCKS%%NAM%.json
- echo "model": "%MOD%:block/%NAM%" >> %BLOCKS%%NAM%.json
- echo } >> %BLOCKS%%NAM%.json
- goto Axisout
- :Blockstatepill
- echo "axis=%AXIS%": { >> %BLOCKS%%NAM%.json
- echo "model": "%MOD%:block/pillar/%NAM%" >> %BLOCKS%%NAM%.json
- if %AXIS%==x ( echo "x": 90, >> %BLOCKS%%NAM%.json )
- if %AXIS%==z ( echo "x": 90 >> %BLOCKS%%NAM%.json )
- if %AXIS%==x ( echo "y": 90 >> %BLOCKS%%NAM%.json )
- if %AXIS%==z ( echo } >> %BLOCKS%%NAM%.json && goto Axisout ) else ( echo }, >> %BLOCKS%%NAM%.json )
- if %AXIS%==x ( set AXIS=y ) else ( set AXIS=z )
- goto Blockstatepill
- :Axisout
- echo } >> %BLOCKS%%NAM%.json
- echo } >> %BLOCKS%%NAM%.json
- :: Slab version
- echo { > %BLOCKS%%NAM%_slab.json
- set AXIS=bottom
- echo "variants": { >> %BLOCKS%%NAM%_slab.json
- :Slabvar
- echo "type=%AXIS%": { >> %BLOCKS%%NAM%_slab.json
- if %AXIS%==bottom ( echo "model": "%MOD%:block/slab/%NAM%" >> %BLOCKS%%NAM%_slab.json ) else ( echo "model": "%MOD%:block/slab/%NAM%_%AXIS%" >> %BLOCKS%%NAM%_slab.json )
- if %AXIS%==top ( echo } >> %BLOCKS%%NAM%_slab.json && goto Slabout ) else ( echo }, >> %BLOCKS%%NAM%_slab.json )
- if %AXIS%==bottom ( set AXIS=double ) else ( set AXIS=top )
- goto Slabvar
- :Slabout
- echo } >> %BLOCKS%%NAM%_slab.json
- echo } >> %BLOCKS%%NAM%_slab.json
- :: Stair blocks
- echo { > %BLOCKS%%NAM%_stair.json
- echo "variants": { >> %BLOCKS%%NAM%_stair.json
- goto Stairloop
- :Stairloop
- set /a YY=0
- set uv=no
- :: checking using Shape array
- :: Inner Left
- if %INNER% EQU 0 (
- if %MID% EQU 0 (
- if %OUTER% EQU 0 ( set /a YY=270 )
- if %OUTER% EQU 1 ( set /a YY=180 )
- if %OUTER% EQU 3 ( set /a YY=90 )
- ) else (
- if %OUTER% EQU 1 ( set /a YY=270 )
- if %OUTER% EQU 2 ( set /a YY=90 )
- if %OUTER% EQU 3 ( set /a YY=180 )
- )
- )
- ::Inner Right
- if %INNER% EQU 1 (
- if %MID% EQU 0 (
- if %OUTER% EQU 1 ( set /a YY=270 )
- if %OUTER% EQU 2 ( set /a YY=90 )
- if %OUTER% EQU 3 ( set /a YY=180 )
- ) else (
- if %OUTER% EQU 0 ( set /a YY=90 )
- if %OUTER% EQU 2 ( set /a YY=180 )
- if %OUTER% EQU 3 ( set /a YY=270 )
- )
- )
- ::Outer Left
- if %INNER% EQU 2 (
- if %MID% EQU 0 (
- if %OUTER% EQU 0 ( set /a YY=270 )
- if %OUTER% EQU 1 ( set /a YY=180 )
- if %OUTER% EQU 3 ( set /a YY=90 )
- ) else (
- if %OUTER% EQU 1 ( set /a YY=270 )
- if %OUTER% EQU 2 ( set /a YY=90 )
- if %OUTER% EQU 3 ( set /a YY=180 )
- )
- )
- ::Outer Right
- if %INNER% EQU 3 (
- if %MID% EQU 0 (
- if %OUTER% EQU 1 ( set /a YY=270 )
- if %OUTER% EQU 2 ( set /a YY=90 )
- if %OUTER% EQU 3 ( set /a YY=180 )
- ) else (
- if %OUTER% EQU 0 ( set /a YY=90 )
- if %OUTER% EQU 2 ( set /a YY=180 )
- if %OUTER% EQU 3 ( set /a YY=270 )
- )
- )
- if %INNER% EQU 4 (
- if %OUTER% EQU 1 ( set /a YY=270 )
- if %OUTER% EQU 2 ( set /a YY=90 )
- if %OUTER% EQU 3 ( set /a YY=180 )
- )
- echo "facing=%%FACE[%OUTER%]%%,half=%%HALF[%MID%]%%,shame=%%SHAPE[%INNER%]%%": { >> %BLOCKS%%NAM%_stair.json
- if %INNER% LSS 2 (
- echo "model": "%MOD%:block/stair/%NAM%_stair_inner", >> %BLOCKS%%NAM%_stair.json
- ) else (
- if %INNER% LSS 4 (
- echo "model": "%MOD%:block/stair/%NAM%_stair_outer", >> %BLOCKS%%NAM%_stair.json
- ) else (
- echo "model": "%MOD%:block/stair/%NAM%_stair", >> %BLOCKS%%NAM%_stair.json
- )
- )
- if %MID% EQU 1 (
- echo "x": 180, >> %BLOCKS%%NAM%_stair.json
- set uv=yes
- )
- if %YY% GTR 10 (
- echo "y": %YY%, >> %BLOCKS%%NAM%_stair.json
- set uv=yes
- )
- if %uv%==yes ( echo "uvlock": true >> %BLOCKS%%NAM%_stair.json )
- if /a %OUTER% + %MID% + %INNER% EQU 8 (
- echo } >> %BLOCKS%%NAM%_stair.json
- ) else (
- echo }, >> %BLOCKS%%NAM%_stair.json
- if %INNER% LSS 4 (
- set /a INNER=%INNER% + 1
- ) else (
- set /a INNER=0
- if %MID% EQU 0 (
- set /a MID=1
- ) else (
- set /a MID=0
- if %OUTER% LSS 3 (
- set /a OUTER=%OUTER% + 1
- ) else (
- echo Failure in logic, this error shouldn't show up.
- pause
- )
- )
- )
- goto Stairloop
- )
- ::Block models
- :: Check for Pillar first
- if %ALLSIDED%==PILL ( goto Pilstart ) else ( goto CubeStart )
- :Pilstart
- echo { > %PILLA%%NAM%.json
- echo "parent": "minecraft:block/cube_column", >> %PILLA%%NAM%.json
- echo "textures": { >> %PILLA%%NAM%.json
- echo "end": "%MOD%:block/%NAM%_top", >> %PILLA%%NAM%.json
- echo "side": "%MOD%:block/%NAM%_side" >> %PILLA%%NAM%.json
- echo } >> %PILLA%%NAM%.json
- echo } >> %PILLA%%NAM%.json
- goto Slabstart
- ::Cubes
- :CubeStart
- echo { > %BLOCK%%NAM%.json
- if %ALLSIDED%==ALL ( echo "parent": "minecraft:block/cube_all", >> %BLOCK%%NAM%.json ) else ( echo "parent": "minecraft:block/cube_bottom_top", >> %BLOCK%%NAM%.json )
- echo "textures": { >> %BLOCK%%NAM%.json
- if %ALLSIDED%==ALL (
- echo "all": "%MOD%:block/%NAM%" >> %BLOCK%%NAM%.json
- ) else (
- echo "top": "%MOD%:block/%NAM%_top", >> %BLOCK%%NAM%.json
- echo "bottom": "%MOD%:block/%NAM%_bottom", >> %BLOCK%%NAM%.json
- echo "side": "%MOD%:block/%NAM%_side" >> %BLOCK%%NAM%.json
- )
- echo } >> %BLOCK%%NAM%.json
- echo } >> %BLOCK%%NAM%.json
- ::Slabs
- :Slabstart
- call :Slabfiles {
- echo "parent": "minecraft:block/slab", >> %SLAB%%NAM%_slab.json
- echo "parent": "minecraft:block/cube_column", >> %SLAB%%NAM%_double.json
- echo "parent": "minecraft:block/slab_top", >> %SLAB%%NAM%_top.json
- call :Slabfiles " "textures": {"
- echo "bottom": "%MOD%:block/%NAM%_top", >> %SLAB%%NAM%_slab.json
- echo "end": "%MOD%:block/%NAM%_top", >> %SLAB%%NAM%_double.json
- echo "bottom": "%MOD%:block/%NAM%_top", >> %SLAB%%NAM%_top.json
- echo "top": "%MOD%:block/%NAM%_top", >> %SLAB%%NAM%_slab.json
- call :Slabfiles " "side": "%MOD%:block/%NAM%_side""
- echo "top": "%MOD%:block/%NAM%_top", >> %SLAB%%NAM%_top.json
- call :Slabfiles " }"
- call :Slabfiles }
- goto Stairs
- :Slabfiles
- set Bark=%~1
- echo %Bark% >> %SLAB%%NAM%_slab.json
- echo %Bark% >> %SLAB%%NAM%_double.json
- echo %Bark% >> %SLAB%%NAM%_top.json
- exit /b
- :Stairs
- set BOTT=%NAM%
- set TTOPP=%NAM%
- set TSIDE=%NAM%
- if %ALLSIDED%==TOPP (
- set BOTT=%BOTT%_bottom
- set TTOPP=%TTOPP%_top
- set TSIDE=%TSIDE%_side
- )
- if %ALLSIDED%==PILL (
- set BOTT=%BOTT%_top
- set TTOPP=%TTOPP%_top
- set TSIDE=%TSIDE%_side
- )
- call :Stairfiles {
- call :Stairfiles block
- call :Stairfiles " "textures": {"
- call :Stairfiles " "bottom": "%MOD%:block/%BOTT%","
- call :Stairfiles " "top": "%MOD%:block/%TTOPP%","
- call :Stairfiles " "side": "%MOD%:block/%TSIDE%""
- call :Stairfiles " }"
- call :Stairfiles }
- goto Bitem
- :Stairfiles
- set PARE=%~1
- if %PARE%==block (
- echo "parent": "minecraft:block/stairs", >> %STAIR%%NAM%_stair.json
- echo "parent": "minecraft:block/inner_stairs", >> %STAIR%%NAM%_stair_inner.json
- echo "parent": "minecraft:block/outer_stairs", >> %STAIR%%NAM%_stair_outer.json
- ) else (
- echo %PARE% >> %STAIR%%NAM%_stair.json
- echo %PARE% >> %STAIR%%NAM%_stair_inner.json
- echo %PARE% >> %STAIR%%NAM%_stair_outer.json
- )
- exit /b
- :: Item versions of the blocks
- :Bitem
- echo { > %ITEM%%NAM%.json
- if %ALLSIDED%==PILL (
- echo "parent": "%MOD%:block/pillar/%NAM%" >> %ITEM%%NAM%.json
- ) else (
- echo "parent":"%MOD%:block/%NAM%" >> %ITEM%%NAM%.json
- )
- echo } >> %ITEM%%NAM%.json
- ::Slabitem
- echo { > %ITEM%%NAM%_slab.json
- echo "parent": "%MOD%:block/slab/%NAM%_slab" >> %ITEM%%NAM%_slab.json
- echo } >> %ITEM%%NAM%_slab.json
- ::Stairitem
- echo { > %ITEM%%NAM%_stair.json
- echo "parent": "%MOD%:block/stair/%NAM%_stair" >> %ITEM%%NAM%_stair.json
- echo } >> %ITEM%%NAM%_stair.json
- ::blockloot
- echo { > %DROP%%NAM%.json
- echo { > %DROP%%NAM%_stair.json
- echo "type": "minecraft:block", >> %DROP%%NAM%.json
- echo "type": "minecraft:block", >> %DROP%%NAM%_stair.json
- echo "name": "%MOD%:%NAM%" >> %DROP%%NAM%.json
- echo "name": "%MOD%:%NAM%" >> %DROP%%NAM%_stair.json
- echo } >> %DROP%%NAM%.json
- echo } >> %DROP%%NAM%_stair.json
- call :Slabloot {
- call :Slabloot " "type": "minecraft:block","
- call :Slabloot " "pools": ["
- call :Slabloot " {"
- call :Slabloot " "rolls":1,"
- call :Slabloot " "entries": ["
- call :Slabloot " {"
- call :Slabloot " "type": "minecraft:item","
- call :Slabloot " "function": "minecraft:set_count","
- call :Slabloot " "conditions": ["
- call :Slabloot " {"
- call :Slabloot " "condition": "minecraft:block_state_property","
- call :Slabloot " "block": "%MOD%:%NAM%_slab","
- call :Slabloot " "properties": {"
- call :Slabloot " "type": "double""
- call :Slabloot " }"
- call :Slabloot " }"
- call :Slabloot " ],"
- call :Slabloot " "count":2"
- call :Slabloot " },"
- call :Slabloot " {"
- call :Slabloot " "function": "minecraft:explosion_decay""
- call :Slabloot " }"
- call :Slabloot " ],"
- call :Slabloot " "name": "%MOD%:%NAM%_slab","
- call :Slabloot " }"
- call :Slabloot " ]"
- call :Slabloot " }"
- call :Slabloot " ]"
- call :Slabloot }
- goto RE2
- :Slabloot
- echo %~1 >> %DROP%%NAM%_slab.json
- exit /b
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement