Skip to content

Instantly share code, notes, and snippets.

@Vazkii
Last active January 12, 2016 17:55
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save Vazkii/e8c3f0aa189d28d209c6 to your computer and use it in GitHub Desktop.
Save Vazkii/e8c3f0aa189d28d209c6 to your computer and use it in GitHub Desktop.
1.8 JSON Model/Blockstate autogenerators
@echo off
:: Vazkii's JSON creator for blocks
:: Put in your /resources/assets/%modid%/models/block
:: Makes basic block JSON files as well as the acossiated item and simple blockstate
:: Can make multiple blocks at once
::
:: Usage:
:: _makeb (block name 1) (block name 2) (block name x)
::
:: Change this to your mod's ID
set modid=psi
setlocal enabledelayedexpansion
for %%x in (%*) do (
echo Making %%x.json block
(
echo {
echo "parent": "block/cube_all",
echo "textures": {
echo "all": "%modid%:blocks/%%x"
echo }
echo }
) > %%x.json
echo Making %%x.json item
(
echo {
echo "parent": "%modid%:block/%%x",
echo "display": {
echo "thirdperson": {
echo "rotation": [ 10, -45, 170 ],
echo "translation": [ 0, 1.5, -2.75 ],
echo "scale": [ 0.375, 0.375, 0.375 ]
echo }
echo }
echo }
) > ../item/%%x.json
echo Making %%x.json blockstate
(
echo {
echo "forge_marker": 1,
echo "defaults": {
echo "model": "%modid%:%%x"
echo },
echo "variants": {
echo "normal": [{}],
echo "inventory": [{}]
echo }
echo }
) > ../../blockstates/%%x.json
)
@echo off
:: Vazkii's JSON creator for items
:: Put in your /resources/assets/%modid%/models/item
:: Makes basic item JSON files
:: Requires a _standard_item.json to be present for parenting
:: Can make multiple items at once
::
:: Usage:
:: _makei (item name 1) (item name 2) (item name x)
::
:: Change this to your mod's ID
set modid=psi
setlocal enabledelayedexpansion
for %%x in (%*) do (
echo Making %%x.json
(
echo {
echo "parent": "%modid%:item/_standard_item",
echo "textures": {
echo "layer0": "%modid%:items/%%x"
echo }
echo }
) > %%x.json
)
{
"parent": "builtin/generated",
"display": {
"thirdperson": {
"rotation": [ -90, 0, 0 ],
"translation": [ 0, 1, -3 ],
"scale": [ 0.55, 0.55, 0.55 ]
},
"firstperson": {
"rotation": [ 0, -135, 25 ],
"translation": [ 0, 4, 2 ],
"scale": [ 1.7, 1.7, 1.7 ]
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment