Advertisement
DePhoegon

Stairs / Slabs / Walls / Fence / Fence Gates - JSON aid

Aug 6th, 2022 (edited)
1,130
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
JavaScript 40.93 KB | None
  1. // NodeJS
  2. // Intended for Support mods making Slabs, Stairs, Walls, Fences, fence gates, from a singular block from either MC, or another mod.
  3. // Creates Blockstates, Model files, Item files
  4. // ver. 2.0 (fixed minor problems, and one overlooked variable that was missing)
  5. // ver. 2.5 (fixed accidental missing '/' & accidental included '/', fixed & addreseed cases where one or two textures are used.)
  6. // ver. 3.0 - Fixed all the outputs to be what was expected.  (and supply template files to go with this if asked)
  7. var fs = require('fs');
  8. const { resolve } = require('path');
  9. const path = require('path');
  10.  
  11. var baseDrive = 'G:/' // Set This block of variables as needed
  12. var baseFolder = baseDrive+'MC_JSONS';
  13. var bridgeModID = 'delbridgebop'; // ModID of the mod intended be the namespace of the model jsons
  14. var baseModID = 'minecraft';
  15. var leftModID = 'delbase'; //ModID of one of the Mods the Bridge connects
  16. var rightModID = 'biomesoplenty'; //ModID of the other Mod the bridge connects
  17. var customModModelTemplateID = 'delbase'; // ModID of the custom Templates
  18.  
  19. var blockState = '/assets/blockstates'; // Local file structure,
  20. var models = '/assets/models';
  21. var baseModelFiles = '/block';
  22. var fenceModelFiles = baseModelFiles+'/fence';
  23. var fenceGateModelFiles = baseModelFiles+'/fence_gate';
  24. var slabModelFiles = baseModelFiles+'/slab';
  25. var wallModelFiles = baseModelFiles+'/wall';
  26. var stairModelFiles = baseModelFiles+'/stair';
  27. var itemModelFiles = models+'/item';
  28. var lootTableFiles = '/loot_tables/blocks';
  29.  
  30. var useCustomTemplate = false; // Boolean section
  31. var useCustomModelFolders = false;
  32. var useWoodCycle = false;
  33. var useWallTwist = false; // Setup to be used, but not triggerable
  34. var useColumnStair = false; // Setup to be used, but not triggerable.  woodlikes will use columnStairs (and default to the top/bottom texture if not provided)
  35.  
  36. var templateFencePost = 'block/fence_post'; // Minecraft Locations for model Templates (defaults)
  37. var templateFenceSide = 'block/fence_side';
  38. var templateFenceInventory = 'block/fence_inventory';
  39. var templateFenceGate = 'block/template_fence_gate';
  40. var templateFenceGateOpen = 'block/template_fence_gate_open';
  41. var templateFenceGateWall = 'block/template_fence_gate_wall';
  42. var templateFenceGateWallOpen = 'block/template_fence_gate_wall_open';
  43. var templateWallInventory = 'block/wall_inventory'
  44. var templateWallWallPost = 'block/template_wall_post';
  45. var templateWallSide = 'block/template_wall_side';
  46. var templateWallSideTall = 'block/template_wall_side_tall';
  47. var templateStair = 'block/stairs';
  48. var templateInnerStair = 'block/inner_stairs';
  49. var templateOuterStair = 'block/outer_stairs';
  50. var templateSlab = 'block/slab';
  51. var templateSlabTop = 'block/slab_top';
  52. var templateWholeBlock = 'block/cube_bottom_top'; // typical cubes
  53. var templateSlabDouble = templateWholeBlock;
  54.  
  55. var customFencePost = 'block/template/fence_post'; // Custom template section, need to already be made
  56. var customFenceSide = 'block/template/fence_side';
  57. var customFenceGate = 'block/template/fence_gate';
  58. var customFenceGateOpen = 'block/template/fence_gate_open';
  59. var customFenceGateWall = 'block/template/fence_gate_wall';
  60. var customFenceGateWallOpen = 'block/template/fence_gate_wall_open';
  61. var customFenceInventory = 'block/template/fence_inventory';
  62. var customFenceSideWoodTweak = 'block/template/fence_side_wood_tweak'; // No plans to use yet
  63. var customStairs = 'block/template/stairs';
  64. var customStairsColumn = 'block/template/stairs_column'; // Column uses a seperate (from the horizontal) texture from the vertical inside bits
  65. var customInnerStair = 'block/template/inner_stairs';
  66. var customInnerStairColumn = 'block/template/inner_stairs_column';// Column uses a seperate (from the horizontal) texture from the vertical inside bits
  67. var customouterStairs = 'block/template/outer_stairs';
  68. var customouterStairsColumn = 'block/template/outer_stairs_column';// Column uses a seperate (from the horizontal) texture from the vertical inside bits
  69. var customWallPost = 'block/template/wall_post';
  70. var customWallSide = 'block/template/wall_side';
  71. var customWallSideTwist = 'block/template/wall_side_twist'; // Turns texture 90' on side
  72. var customWallSideTall = 'block/template/wall_side_tall';
  73. var customWallSideTallTwist = 'block/template/wall_side_tall_twist';// Turns texture 90' on side
  74. var customWallInventory = 'block/template/wall_inventory';
  75. var baseTextureTag = 'texture'; // fences only
  76. var customTextureUpDownTag = baseTextureTag; // fences only
  77. var customTextureSideTag = 'postside'; // fences only
  78.  
  79. var blockName; // On Call Variables
  80. var textureOne; // Top/bottom
  81. var textureTwo; // Sides(outsides)
  82. var textureThree; // Insides - Sides (Stairs, Column use only) [currently only woodlikes use this]
  83. var textureModID; // assigned in code & called to write in files.
  84. var textureUseCount;
  85.  
  86. const myArgs = process.argv.slice(2);
  87. keystart(myArgs);
  88. async function setVariables(Args) {
  89.     let rawName;
  90.     let typeName;
  91.     rawName = Args[0];
  92.     typeName = Args[1];
  93.     if (rawName == 'help') {
  94.         errorout('Input as node fivemodeltypes \'name of block\' \'Use Custom template (0 - false/1 - true)\' \'Use Custom Model File Location(0 - false/1 - true)\' \'texture count(1-3)\' \'ModID of the textures location (0 - Minecraft/1 - Bridge ModID/2 - Left ModID/3 - Right ModID)[set inside file]\' \'texture name 1\' \'texture name 2(optional)\' \'texture name 3(optional)\'\nExample\nnode ./fiveModelTypes base_block_name 1 1 3 2 texture_log_top log_texture_side log_texture_inside_side\n\nUse of Custom Templates requires prior setup. can easily be used without custom templates\n\n Use 0 on texture 2 & 3 to default it to texture 1\nExample\nnode ./fiveModelTypes base_block_name 1 1 3 2 texutre_name 0 0')
  95.     }
  96.     blockName = rawName;
  97.     if (typeName != 0) {
  98.         if (typeName == 'woodtype') {
  99.             useWoodCycle = true;
  100.         } else { blockName = blockName + '_' + typeName; }
  101.     }
  102.     if (Args[2] == 0 || Args[2] == 1) {
  103.         if (Args[2] == 0) { useCustomTemplate = false; } else { useCustomTemplate = true; }
  104.     } else {
  105.         errorout('wrong selection of custom or built in templates for model files.')
  106.     }
  107.     // Use Custom Model File Location (0 = false//1 = true)
  108.     if (Args[3] == 0 || Args[3] == 1) {
  109.         if (Args[3] == 0) { useCustomModelFolders = false; } else { useCustomModelFolders = true; }
  110.     } else {
  111.         errorout('Invalid selection of custom or built in(For Minecraft) folder structure')
  112.     }
  113.     textureUseCount = Args[4];
  114.     if (textureUseCount < 1) { errorout('number of textures claimed less than 1') }
  115.     var num = Args[5];
  116.     if (num == 0) { textureModID = baseModID; }
  117.     if (num == 1) { textureModID = bridgeModID; }
  118.     if (num == 2) { textureModID = leftModID; }
  119.     if (num == 3) { textureModID = rightModID; }
  120.     if (num < 0 || num > 3) {errorout('missing/invalid selection for texture modID');}
  121.     if (Args[6] != null){
  122.         textureOne = Args[6];
  123.         textureTwo = textureOne;
  124.         textureThree = textureOne;
  125.     } else { errorout('no valid texture given') }
  126.     if (Args[7] != 0) { if (textureUseCount > 1) { textureTwo = Args[7] } }
  127.     if (Args[8] != 0) { if (textureUseCount > 2) { textureThree = Args[8] } }
  128. }
  129. function errorout(extmsg) {
  130.     console.log(extmsg);
  131.     process.exit();
  132. }
  133. function fileOut(fileOut, message, newfile) {
  134.     if (newfile) { fs.openSync(fileOut, 'w'); }
  135.     fs.appendFileSync(fileOut, message+'\n');
  136. }
  137. function keystart(argums){
  138.     setVariables(argums).then(blockStates(useCustomModelFolders)).then(fenceModels(useCustomTemplate, useCustomModelFolders)).then(slabModels(useCustomModelFolders)).then(wallModels(useCustomTemplate, useCustomModelFolders)).then(stairModels(useCustomTemplate, useCustomModelFolders)).then(lootTable());
  139. }
  140. function blockStates(useCustomtmpath) {
  141.     let blockPath;
  142.     let foldPath = path.join(baseFolder, blockState);
  143.     fs.mkdirSync(foldPath, { recursive: true });
  144.     blockPath = 'block/';
  145.     if (useWoodCycle) {
  146.         bsAid(foldPath, blockName+'_wood', useCustomtmpath, blockPath);
  147.         bsAid(foldPath, blockName+'_log', useCustomtmpath, blockPath);
  148.         bsAid(foldPath, 'stripped_'+blockName+'_wood', useCustomtmpath, blockPath);
  149.         bsAid(foldPath, 'stripped_'+blockName+'_log', useCustomtmpath, blockPath);
  150.     } else { bsAid(foldPath, blockName, useCustomtmpath, blockPath); }
  151. }
  152. function bsAid(folderPath, bName, usePathCustom, bPath) {
  153.     let bPathTmp = bPath;
  154.     if (useCustomModelFolders) { bPathTmp = slabModelFiles.slice(1); }
  155.     bsSlab(path.join(folderPath, bName+'_slab.json'), bPathTmp, bName)
  156.     if (usePathCustom) { bPathTmp = fenceModelFiles.slice(1); }
  157.     bsFence(path.join(folderPath, bName+'_fence.json'), bPathTmp, bName)
  158.     if (usePathCustom) { bPathTmp = fenceGateModelFiles.slice(1); }
  159.     bsFenceGate(path.join(folderPath, bName+'_fence_gate.json'), bPathTmp, bName)
  160.     if (usePathCustom) { bPathTmp = wallModelFiles.slice(1); }
  161.     bsWall(path.join(folderPath, bName+'_wall.json'), bPathTmp, bName)
  162.     if (usePathCustom) { bPathTmp = stairModelFiles.slice(1); }
  163.     bsStairStart(path.join(folderPath, bName+'_stair.json'), bPathTmp, bName)
  164. }
  165. function bsFence(fileLocation, filePath, bName) {
  166.     let post = filePath+'/'+bName+'_fence_post';
  167.     let side = filePath+'/'+bName+'_fence_side';
  168.     let uvlock = '\"uvlock\": true';
  169.     fileOut(fileLocation, '{', true);
  170.     fileOut(fileLocation, '\"multipart\": [', false);
  171.     fileOut(fileLocation, '{', false);
  172.     fileOut(fileLocation, '\"apply\": {', false);
  173.     fileOut(fileLocation, '\"model\": \"'+bridgeModID+':'+post+'\"', false);
  174.     fileOut(fileLocation, '}', false);
  175.     fileOut(fileLocation, '},', false);
  176.     bsFenceAid(fileLocation, bridgeModID, side, 'north', uvlock, 0, false);
  177.     bsFenceAid(fileLocation, bridgeModID, side, 'east', uvlock, 90, false);
  178.     bsFenceAid(fileLocation, bridgeModID, side, 'south', uvlock, 180, false);
  179.     bsFenceAid(fileLocation, bridgeModID, side, 'west', uvlock, 270, true);
  180.     fileOut(fileLocation, ']', false);
  181.     fileOut(fileLocation, '}', false);
  182. }
  183. function bsFenceAid(fLocation, modID, model, direct, uv, y, last) {
  184.     let bracket;
  185.     if(last) { bracket = '}' } else { bracket = '},' }
  186.     fileOut(fLocation, '{', false);
  187.     fileOut(fLocation, '\"when\": {', false);
  188.     fileOut(fLocation, '\"'+direct+'\": \"true\"', false);
  189.     fileOut(fLocation, '},', false);
  190.     fileOut(fLocation, '\"apply\": {', false);
  191.     fileOut(fLocation, '\"model\": \"'+modID+':'+model+'\",', false);
  192.     if(y != 0) { fileOut(fLocation, '\"y\": '+y+',', false); }
  193.     fileOut(fLocation, uv, false);
  194.     fileOut(fLocation, '}', false);
  195.     fileOut(fLocation, bracket, false);
  196. }
  197. function bsFenceGate(fileLocation, filePath, bName) {
  198.     let gate = filePath+'/'+bName+'_fence_gate';
  199.     let gateOpen = gate+'_open';
  200.     let gateWall = gate+'_wall';
  201.     let gateWallOpen = gateWall+'_open';
  202.     let fEast = 'facing=east';
  203.     let fWest = 'facing=west';
  204.     let fNorth = 'facing=north';
  205.     let fSouth = 'facing=south';
  206.     let iWall = 'in_wall=true';
  207.     let oWall = 'in_wall=false';
  208.     let wOpen = 'open=true';
  209.     let wClose = 'open=false';
  210.     let uvlock = '\"uvlock\": true,';
  211.     fileOut(fileLocation, '{', true);
  212.     fileOut(fileLocation, '\"variants\": {', false);
  213.     fileOut(fileLocation, '\"'+fEast+','+oWall+','+wClose+'\": {', false);
  214.     bsFenceGateAid(fileLocation, bridgeModID, gate, uvlock, 270, false);
  215.     fileOut(fileLocation, '\"'+fEast+','+oWall+','+wOpen+'\": {', false);
  216.     bsFenceGateAid(fileLocation, bridgeModID, gateOpen, uvlock, 270, false);
  217.     fileOut(fileLocation, '\"'+fEast+','+iWall+','+wClose+'\": {', false);
  218.     bsFenceGateAid(fileLocation, bridgeModID, gateWall, uvlock, 270, false);
  219.     fileOut(fileLocation, '\"'+fEast+','+iWall+','+wOpen+'\": {', false);
  220.     bsFenceGateAid(fileLocation, bridgeModID, gateWallOpen, uvlock, 270, false);
  221.     fileOut(fileLocation, '\"'+fNorth+','+oWall+','+wClose+'\": {', false);
  222.     bsFenceGateAid(fileLocation, bridgeModID, gate, uvlock, 180, false);
  223.     fileOut(fileLocation, '\"'+fNorth+','+oWall+','+wOpen+'\": {', false);
  224.     bsFenceGateAid(fileLocation, bridgeModID, gateOpen, uvlock, 180, false);
  225.     fileOut(fileLocation, '\"'+fNorth+','+iWall+','+wClose+'\": {', false);
  226.     bsFenceGateAid(fileLocation, bridgeModID, gateWall, uvlock, 180, false);
  227.     fileOut(fileLocation, '\"'+fNorth+','+iWall+','+wOpen+'\": {', false);
  228.     bsFenceGateAid(fileLocation, bridgeModID, gateWallOpen, uvlock, 180, false);
  229.     fileOut(fileLocation, '\"'+fSouth+','+oWall+','+wClose+'\": {', false);
  230.     bsFenceGateAid(fileLocation, bridgeModID, gate, uvlock, 0, false);
  231.     fileOut(fileLocation, '\"'+fSouth+','+oWall+','+wOpen+'\": {', false);
  232.     bsFenceGateAid(fileLocation, bridgeModID, gateOpen, uvlock, 0, false);
  233.     fileOut(fileLocation, '\"'+fSouth+','+iWall+','+wClose+'\": {', false);
  234.     bsFenceGateAid(fileLocation, bridgeModID, gateWall, uvlock, 0, false);
  235.     fileOut(fileLocation, '\"'+fSouth+','+iWall+','+wOpen+'\": {', false);
  236.     bsFenceGateAid(fileLocation, bridgeModID, gateWallOpen, uvlock, 0, false);
  237.     fileOut(fileLocation, '\"'+fWest+','+oWall+','+wClose+'\": {', false);
  238.     bsFenceGateAid(fileLocation, bridgeModID, gate, uvlock, 90, false);
  239.     fileOut(fileLocation, '\"'+fWest+','+oWall+','+wOpen+'\": {', false);
  240.     bsFenceGateAid(fileLocation, bridgeModID, gateOpen, uvlock, 90, false);
  241.     fileOut(fileLocation, '\"'+fWest+','+iWall+','+wClose+'\": {', false);
  242.     bsFenceGateAid(fileLocation, bridgeModID, gateWall, uvlock, 90, false);
  243.     fileOut(fileLocation, '\"'+fWest+','+iWall+','+wOpen+'\": {', false);
  244.     bsFenceGateAid(fileLocation, bridgeModID, gateWallOpen, uvlock, 90, true);
  245.     fileOut(fileLocation, '}', false);
  246.     fileOut(fileLocation, '}', false);
  247. }
  248. function bsFenceGateAid(fLocation, modID, model, uv, y, last) {
  249.     let bracket;
  250.     if (last) { bracket = '}' } else { bracket = '},'  }
  251.     fileOut(fLocation, uv, false);
  252.     if (y != 0) { fileOut(fLocation, '\"y\": '+y+',', false); }
  253.     fileOut(fLocation, '\"model\": \"'+modID+':'+model+'\"', false);
  254.     fileOut(fLocation, bracket, false);
  255. }
  256. function bsWall(fileLocation, filePath, bName) {
  257.     let uvlock = '\"uvlock\": true';
  258.     let fmodel = filePath+'/'+bName;
  259.     fileOut(fileLocation, '{', true);
  260.     fileOut(fileLocation, '\"multipart\": [', false);
  261.     bsWallAid(fileLocation, bridgeModID, 'up', 'true', fmodel+'_wall_post', uvlock, 0, false, false);
  262.     bsWallAid(fileLocation, bridgeModID, 'north', 'low', fmodel+'_wall_side', uvlock, 0, false, true);
  263.     bsWallAid(fileLocation, bridgeModID, 'east', 'low', fmodel+'_wall_side', uvlock, 90, false, true);
  264.     bsWallAid(fileLocation, bridgeModID, 'south', 'low', fmodel+'_wall_side', uvlock, 180, false, true);
  265.     bsWallAid(fileLocation, bridgeModID, 'west', 'low', fmodel+'_wall_side', uvlock, 270, false, true);
  266.     bsWallAid(fileLocation, bridgeModID, 'north', 'tall', fmodel+'_wall_side_tall', uvlock, 0, false, true);
  267.     bsWallAid(fileLocation, bridgeModID, 'east', 'tall', fmodel+'_wall_side_tall', uvlock, 90, false, true);
  268.     bsWallAid(fileLocation, bridgeModID, 'south', 'tall', fmodel+'_wall_side_tall', uvlock, 180, false, true);
  269.     bsWallAid(fileLocation, bridgeModID, 'west', 'tall', fmodel+'_wall_side_tall', uvlock, 270, true, true);
  270. }
  271. function bsWallAid(fLocation, ModID, fkey, fvalue, model, uv, y, last, useUV){
  272.     let close;
  273.     if (last) { close = '\n}\n}\n]\n}' } else { close = '\n}\n},' }
  274.     fileOut(fLocation, '{', false);
  275.     fileOut(fLocation, '\"when\": {', false);
  276.     fileOut(fLocation, '\"'+fkey+'\": \"'+fvalue+'\"\n},', false);
  277.     fileOut(fLocation, '\"apply\": {', false);
  278.     if (useUV) {
  279.         fileOut(fLocation, '\"model\": \"'+ModID+':'+model+'\",', false);
  280.         if (y > 0) { fileOut(fLocation, '\"y\": '+y+','); }
  281.         fileOut(fLocation, uv+close, false);
  282.     } else { fileOut(fLocation, '\"model\": \"'+ModID+':'+model+'\"'+close, false); }
  283. }
  284. function bsSlab(fileLocation, filePath, bName) {
  285.     let psName = filePath+'/'+bName+'_slab';
  286.     let pdName = filePath+'/'+bName+'_slab_double';
  287.     let ptName = filePath+'/'+bName+'_slab_top';
  288.     fileOut(fileLocation, '{', true);
  289.     fileOut(fileLocation, '\"variants\": {', false);
  290.     fileOut(fileLocation, '\"type=bottom\": {', false);
  291.     fileOut(fileLocation, '\"model\": \"'+bridgeModID+':'+psName+'\"\n},', false);
  292.     fileOut(fileLocation, '\"type=double\": {', false);
  293.     fileOut(fileLocation, '\"model\": \"'+bridgeModID+':'+pdName+'\"\n},', false);
  294.     fileOut(fileLocation, '\"type=top\": {', false);
  295.     fileOut(fileLocation, '\"model\": \"'+bridgeModID+':'+ptName+'\"\n}\n}\n}', false);
  296. }
  297. function bsStairStart(fileLocation, filePath, bName) {
  298.     fileOut(fileLocation, '{', true);
  299.     fileOut(fileLocation, '\"variants\": {');
  300.     bsStairAidSplitOne(fileLocation, bridgeModID, filePath+'/', bName);
  301. }
  302. function bsStairAidSplitOne(fLocation, ModID, filePath, bName) {
  303.     bsStairAidSplitTwo(fLocation, ModID, 'east', filePath, bName);
  304.     bsStairAidSplitTwo(fLocation, ModID, 'north', filePath, bName);
  305.     bsStairAidSplitTwo(fLocation, ModID, 'south', filePath, bName);
  306.     bsStairAidSplitTwo(fLocation, ModID, 'west', filePath, bName);
  307. }
  308. function bsStairAidSplitTwo(fLocation, ModID, face, filePath, bName) {
  309.     bsStairAidSPlitThree(fLocation, ModID, face, 'bottom', filePath, bName);
  310.     bsStairAidSPlitThree(fLocation, ModID, face, 'top', filePath, bName);
  311. }
  312. function bsStairAidSPlitThree(fLocation, ModID, face, half, filePath, bName) {
  313.     bsStairAid(fLocation, ModID, face, half, 'inner_left', filePath, bName);
  314.     bsStairAid(fLocation, ModID, face, half, 'inner_right', filePath, bName);
  315.     bsStairAid(fLocation, ModID, face, half, 'outer_left', filePath, bName);
  316.     bsStairAid(fLocation, ModID, face, half, 'outer_right', filePath, bName);
  317.     bsStairAid(fLocation, ModID, face, half, 'straight', filePath, bName);
  318. }
  319. function bsStairAid(fLocation, ModID, face, half, shape, filePath, bName) {
  320.     let modBName;
  321.     if (shape == 'straight') { modBName = bName+'_stair' } else { modBName = bName+'_stair_'+shape.slice(0,5); }
  322.     let more = true;
  323.     fileOut(fLocation, '\"facing='+face+',half='+half+',shape='+shape+'\": {', false);
  324.     if (face == 'east') {
  325.         if (shape == 'inner_right' || shape == 'outer_right' || shape == 'straight') {
  326.             if (half == 'bottom') {
  327.                 fileOut(fLocation, '\"model\": \"'+ModID+':'+filePath+modBName+'\"\n},', false);
  328.                 more = false;
  329.             }
  330.         }
  331.         if (more) {
  332.             fileOut(fLocation, '\"model\": \"'+ModID+':'+filePath+modBName+'\",', false);
  333.             if (half == 'top') {
  334.                 fileOut(fLocation, '\"x\": 180,', false);
  335.                 if (shape == 'inner_right' || shape == 'outer_right') { fileOut(fLocation, '\"y\": 90,', false); }
  336.             } else {
  337.                 if (shape == 'inner_left' || shape == 'outer_left') { fileOut(fLocation, '\"y\": 270,', false); }
  338.             }
  339.             fileOut(fLocation, '\"uvlock\": true\n},')
  340.         }
  341.     }
  342.     if (face == 'north') {
  343.         fileOut(fLocation, '\"model\": \"'+ModID+':'+filePath+modBName+'\",', false);
  344.         if (half == 'top') {
  345.             fileOut(fLocation, '\"x\": 180,', false);
  346.             if (shape == 'inner_left' || shape == 'outer_left' || shape == 'straight') { fileOut(fLocation, '\"y\": 270,', false); }
  347.         } else {
  348.             if (shape == 'outer_left' || shape == 'inner_left') { fileOut(fLocation, '\"y\": 180,', false); } else { fileOut(fLocation, '\"y\": 270,', false); }
  349.         }
  350.         fileOut(fLocation, '\"uvlock\": true\n},')
  351.     }
  352.     if (face == 'south') {
  353.         if (half == 'bottom') {
  354.             if (shape == 'outer_left' || shape == 'inner_left') {
  355.                 fileOut(fLocation, '\"model\": \"'+ModID+':'+filePath+modBName+'\"\n},', false);
  356.                 more = false;
  357.             }
  358.         }
  359.         if (more){
  360.             fileOut(fLocation, '\"model\": \"'+ModID+':'+filePath+modBName+'\",', false);
  361.             if (half == 'top') {
  362.                 fileOut(fLocation, '\"x\": 180,', false);
  363.                 if (shape == 'outer_left' || shape == 'inner_left') { fileOut(fLocation, '\"y\": 90,', false); } else { fileOut(fLocation, '\"y\": 180,', false); }
  364.             } else { fileOut(fLocation, '\"y\": 90,', false); }
  365.             fileOut(fLocation, '\"uvlock\": true\n},')
  366.         }
  367.     }
  368.     if (face == 'west') {
  369.         fileOut(fLocation, '\"model\": \"'+ModID+':'+filePath+modBName+'\",', false);
  370.         if (half == 'bottom') {
  371.             if (shape == 'outer_left' || shape == 'inner_left') { fileOut(fLocation, '\"y\": 90,', false); } else { fileOut(fLocation, '\"y\": 180,', false); }
  372.         } else {
  373.             fileOut(fLocation, '\"x\": 180,', false);
  374.             if (shape == 'inner_right' || shape == 'outer_right') { fileOut(fLocation, '\"y\": 270,', false); } else { fileOut(fLocation, '\"y\": 180,', false); }
  375.             if (shape == 'straight') { more = false; }
  376.         }
  377.         if (more) { fileOut(fLocation, '\"uvlock\": true\n},') } else { fileOut(fLocation, '\"uvlock\": true\n}\n}\n}') }
  378.     }
  379. }
  380. function fenceModels(customTemplateLocation, customModelLocation){
  381.     let fold;
  382.     let foldg;
  383.     if (customModelLocation) {
  384.         fold = path.join(baseFolder, models, fenceModelFiles);
  385.         foldg = path.join(baseFolder, models, fenceGateModelFiles);
  386.         fs.mkdirSync(foldg, { recursive: true });
  387.     } else {
  388.         fold = path.join(baseFolder, models, baseModelFiles);
  389.         foldg = fold;
  390.     }
  391.     fs.mkdirSync(fold, { recursive: true });
  392.     if (useWoodCycle) {
  393.         fmAid(customTemplateLocation, customModelLocation, fold, foldg, blockName+'_wood')
  394.         fmAid(customTemplateLocation, customModelLocation, fold, foldg, blockName+'_log')
  395.         fmAid(customTemplateLocation, customModelLocation, fold, foldg, 'stripped_'+blockName+'_wood')
  396.         fmAid(customTemplateLocation, customModelLocation, fold, foldg, 'stripped_'+blockName+'_log')
  397.     } else { fmAid(customTemplateLocation, customModelLocation, fold, foldg, blockName) }
  398. }
  399. function fmAid(customTemplateLocation, customModelLocation, fmodel, fgmodel, bName) {
  400.     let iFold = path.join(baseFolder, itemModelFiles);
  401.     fs.mkdirSync(iFold, { recursive: true });
  402.     fmFencePost(fmodel, customTemplateLocation, bName);
  403.     fmFenceSide(fmodel, customTemplateLocation, bName);
  404.     fmFenceInventory(fmodel, customTemplateLocation, bName);
  405.     fmFenceGate(fgmodel, customTemplateLocation, bName);
  406.     fmFenceGateOpen(fgmodel, customTemplateLocation, bName);
  407.     fmFenceGateWall(fgmodel, customTemplateLocation, bName);
  408.     fmFenceGateWallOpen(fgmodel, customTemplateLocation, bName);    
  409.     fmFenceItems(iFold, customModelLocation, bName);
  410. }
  411. function fmFencePost(folder, iscustomtemplate, bName){
  412.     let template;
  413.     let templatemod;
  414.     let json = path.join(folder, bName+'_fence_post.json')
  415.     if (iscustomtemplate) {
  416.         template = customFencePost;
  417.         templatemod = customModModelTemplateID;
  418.     } else {
  419.         template = templateFencePost;
  420.         templatemod = baseModID;
  421.     }
  422.     fileOut(json, '{', true);
  423.     fileOut(json, '\"parent\": \"'+templatemod+':'+template+'\",');
  424.     fmFenceAid(textureUseCount, iscustomtemplate, json, textureModID);
  425. }
  426. function fmFenceSide(folder, iscustomtemplate, bName) {
  427.     let template;
  428.     let templatemod;
  429.     let json = path.join(folder, bName+'_fence_side.json')
  430.     if (iscustomtemplate) {
  431.         template = customFenceSide;
  432.         templatemod = customModModelTemplateID;
  433.     } else {
  434.         template = templateFenceSide;
  435.         templatemod = baseModID;
  436.     }
  437.     fileOut(json, '{', true);
  438.     fileOut(json, '\"parent\": \"'+templatemod+':'+template+'\",');
  439.     fmFenceAid(textureUseCount, iscustomtemplate, json, textureModID);
  440. }
  441. function fmFenceInventory(folder, iscustomtemplate, bName) {
  442.     let template;
  443.     let templatemod;
  444.     let json = path.join(folder, bName+'_fence_inventory.json')
  445.     if (iscustomtemplate) {
  446.         template = customFenceInventory;
  447.         templatemod = customModModelTemplateID;
  448.     } else {
  449.         template = templateFenceInventory;
  450.         templatemod = baseModID;
  451.     }
  452.     fileOut(json, '{', true);
  453.     fileOut(json, '\"parent\": \"'+templatemod+':'+template+'\",');
  454.     fmFenceAid(textureUseCount, iscustomtemplate, json, textureModID);
  455. }
  456. function fmFenceGate(folder, iscustomtemplate, bName) {
  457.     let template;
  458.     let templatemod;
  459.     let json = path.join(folder, bName+'_fence_gate.json')
  460.     if (iscustomtemplate) {
  461.         template = customFenceGate;
  462.         templatemod = customModModelTemplateID;
  463.     } else {
  464.         template = templateFenceGate;
  465.         templatemod = baseModID;
  466.     }
  467.     fileOut(json, '{', true);
  468.     fileOut(json, '\"parent\": \"'+templatemod+':'+template+'\",');
  469.     fmFenceAid(textureUseCount, iscustomtemplate, json, textureModID);
  470. }
  471. function fmFenceGateOpen(folder, iscustomtemplate, bName) {
  472.     let template;
  473.     let templatemod;
  474.     let json = path.join(folder, bName+'_fence_gate_open.json')
  475.     if (iscustomtemplate) {
  476.         template = customFenceGateOpen;
  477.         templatemod = customModModelTemplateID;
  478.     } else {
  479.         template = templateFenceGateOpen;
  480.         templatemod = baseModID;
  481.     }
  482.     fileOut(json, '{', true);
  483.     fileOut(json, '\"parent\": \"'+templatemod+':'+template+'\",');
  484.     fmFenceAid(textureUseCount, iscustomtemplate, json, textureModID);
  485. }
  486. function fmFenceGateWall(folder, iscustomtemplate, bName) {
  487.     let template;
  488.     let templatemod;
  489.     let json = path.join(folder, bName+'_fence_gate_wall.json')
  490.     if (iscustomtemplate) {
  491.         template = customFenceGateWall;
  492.         templatemod = customModModelTemplateID;
  493.     } else {
  494.         template = templateFenceGateWall;
  495.         templatemod = baseModID;
  496.     }
  497.     fileOut(json, '{', true);
  498.     fileOut(json, '\"parent\": \"'+templatemod+':'+template+'\",');
  499.     fmFenceAid(textureUseCount, iscustomtemplate, json, textureModID);
  500. }
  501. function fmFenceGateWallOpen(folder, iscustomtemplate, bName) {
  502.     let template;
  503.     let templatemod;
  504.     let json = path.join(folder, bName+'_fence_gate_wall_open.json')
  505.     if (iscustomtemplate) {
  506.         template = customFenceGateWallOpen;
  507.         templatemod = customModModelTemplateID;
  508.     } else {
  509.         template = templateFenceGateWallOpen;
  510.         templatemod = baseModID;
  511.     }
  512.     fileOut(json, '{', true);
  513.     fileOut(json, '\"parent\": \"'+templatemod+':'+template+'\",');
  514.     fmFenceAid(textureUseCount, iscustomtemplate, json, textureModID);
  515. }
  516. function fmFenceItems(folder, iscustomLocation, bName) {
  517.     let modelLocation;
  518.     let modelgLocation;
  519.     if (iscustomLocation) {
  520.         modelLocation = fenceModelFiles;
  521.         modelgLocation = fenceGateModelFiles;
  522.     } else {
  523.         modelLocation = baseModelFiles;
  524.         modelgLocation = modelLocation;
  525.     }
  526.     itemAid(path.join(folder, bName+'_fence.json'), modelLocation, 'fence_inventory', bName);
  527.     itemAid(path.join(folder, bName+'_fence_gate.json'), modelgLocation, 'fence_gate', bName);
  528. }
  529. function itemAid(file, modelLocation, type, bName) {
  530.     //used by all item models
  531.     let model = modelLocation.slice(1);
  532.     fileOut(file, '{', true);
  533.     fileOut(file, '\"parent\": \"'+bridgeModID+':'+model+'/'+bName+'_'+type+'\"', false);
  534.     fileOut(file, '}', false);
  535. }
  536. function fmFenceAid(texturecount, isCustom, file, mod) {
  537.     fileOut(file, '\"textures\": {', false)
  538.     if (isCustom) {
  539.         if (texturecount > 1) {
  540.             fileOut(file, '\"'+customTextureUpDownTag+'\": \"'+mod+':'+'block/'+textureOne+'\",', false)
  541.             fileOut(file, '\"'+customTextureSideTag+'\": \"'+mod+':'+'block/'+textureTwo+'\"', false)
  542.         } else {
  543.             fileOut(file, '\"'+customTextureUpDownTag+'\": \"'+mod+':'+'block/'+textureOne+'\"', false)
  544.         }
  545.     } else {
  546.         fileOut(file, '\"'+baseTextureTag+'\": \"'+mod+':'+'block/'+textureOne+'\"', false)
  547.     }
  548.     fileOut(file, '}\n}', false)
  549. }
  550. function slabModels(customModelLocation) {
  551.     let fold;
  552.     let texture = 'block/';
  553.     if (customModelLocation) { fold = slabModelFiles } else { fold = baseModelFiles }
  554.     fs.mkdirSync(fold, { recursive: true });
  555.     if (useWoodCycle) {
  556.         smModelAid(fold, blockName+'_wood', texture, customModelLocation);
  557.         smModelAid(fold, blockName+'_log', texture, customModelLocation);
  558.         smModelAid(fold, 'stripped_'+blockName+'_wood', texture, customModelLocation);
  559.         smModelAid(fold, 'stripped_'+blockName+'_log', texture, customModelLocation);
  560.     } else { smModelAid(fold, blockName, texture, customModelLocation); }
  561.  
  562. }
  563. function smModelAid(foldLocation, fBaseName, tLocation, iscustomLocation) {
  564.     let iFold = path.join(baseFolder, itemModelFiles);
  565.     let fLocation = path.join(baseFolder, models, foldLocation)
  566.     fs.mkdirSync(fLocation, { recursive: true });
  567.     slbmTextureAid(path.join(fLocation+'/'+fBaseName+'_slab.json'), tLocation, baseModID, templateSlab);
  568.     slbmTextureAid(path.join(fLocation+'/'+fBaseName+'_slab_double.json'), tLocation, baseModID, templateSlabDouble);
  569.     slbmTextureAid(path.join(fLocation+'/'+fBaseName+'_slab_top.json'), tLocation, baseModID, templateSlabTop);
  570.     slbmSlabItems(iFold, iscustomLocation, fBaseName);
  571. }
  572. function slbmTextureAid(fileLocation, bPath, baseMod, template) {
  573.     fileOut(fileLocation, '{', true);
  574.     fileOut(fileLocation, '\"parent\": \"'+baseMod+':'+template+'\",', false);
  575.     fileOut(fileLocation, '\"textures\": {', false)
  576.     fileOut(fileLocation, '\"bottom\": \"'+textureModID+':'+bPath+textureOne+'\",', false);
  577.     fileOut(fileLocation, '\"top\": \"'+textureModID+':'+bPath+textureOne+'\",', false);
  578.     fileOut(fileLocation, '\"side\": \"'+textureModID+':'+bPath+textureTwo+'\"\n}', false);
  579.     fileOut(fileLocation, '}', false);
  580. }
  581. function slbmSlabItems(folder, iscustomLocation, bName) {
  582.     let modelLocation;
  583.     if (iscustomLocation) { modelLocation = slabModelFiles; } else { modelLocation = baseModelFiles; }
  584.     itemAid(path.join(folder, bName+'_slab.json'), modelLocation, 'slab', bName)
  585. }
  586. function wallModels(customTemplateLocation, customModelLocation){
  587.     let tname1 = 'wall';
  588.     let tname2;
  589.     let flocate;
  590.     if (customModelLocation) { flocate = path.join(baseFolder, models, wallModelFiles) } else { flocate = path.join(baseFolder, models, baseModelFiles); }
  591.     if (customTemplateLocation) { tname2 = 'top'; } else { tname2 = null; }
  592.     fs.mkdirSync(flocate, { recursive: true });
  593.     if (useWoodCycle) {
  594.         wmAid(flocate, customTemplateLocation, blockName+'_wood', tname1, tname2, textureOne, textureTwo, customModelLocation);
  595.         wmAid(flocate, customTemplateLocation, blockName+'_log', tname1, tname2, textureOne, textureTwo, customModelLocation);
  596.         wmAid(flocate, customTemplateLocation,'stripped_'+blockName+'_wood', tname1, tname2, textureOne, textureTwo, customModelLocation);
  597.         wmAid(flocate, customTemplateLocation, 'stripped_'+blockName+'_log', tname1, tname2, textureOne, textureTwo, customModelLocation);
  598.     } else { wmAid(flocate, customTemplateLocation, blockName, tname1, tname2, textureOne, textureTwo, customModelLocation); }
  599. }
  600. function wmAid(fLocation, iscustomtemplate, bName, tag1, tag2, tName1, tName2, iscustomLocation) {
  601.     let iFold = path.join(baseFolder, itemModelFiles);
  602.     let btpath = 'block/';
  603.     let template;
  604.     if (iscustomtemplate) { template = customModModelTemplateID+':'; } else { baseModID+':'; }
  605.     wmInventory(path.join(fLocation, bName+'_wall_inventory.json'), template, tag1, tag2, tName1, tName2, btpath);
  606.     wmPost(path.join(fLocation, bName+'_wall_post.json'), template, tag1, tag2, tName1, tName2, btpath);
  607.     wmWallSide(path.join(fLocation, bName+'_wall_side.json'), template, tag1, tag2, tName1, tName2, btpath);
  608.     wmWallSideTall(path.join(fLocation, bName+'_wall_side_tall.json'), template, tag1, tag2, tName1, tName2, btpath);
  609.     wmItems(iFold, iscustomLocation, bName);
  610. }
  611. function wmInventory(file, templateMod, tag1, tag2, tName1, tName2, bPath) {
  612.     let parent;
  613.     if (tag2 != null) { parent = templateMod+customWallInventory; } else { parent = templateMod+templateWallInventory; }
  614.     wmTextureAid(file, tName1, tName2, tag1, tag2, bPath, parent);
  615. }
  616. function wmPost(file, templateMod, tag1, tag2, tName1, tName2, bPath) {
  617.     let parent;
  618.     if (tag2 != null) { parent = templateMod+customWallPost; } else { parent = templateMod+templateWallWallPost; }
  619.     wmTextureAid(file, tName1, tName2, tag1, tag2, bPath, parent);
  620. }
  621. function wmWallSide(file, templateMod, tag1, tag2, tName1, tName2, bPath) {
  622.     let parent;
  623.     if (tag2 != null) {
  624.         if (useWallTwist) {
  625.             parent = templateMod+customWallSideTwist;
  626.         } else {
  627.             parent = templateMod+customWallSide;
  628.         }
  629.     } else { parent = templateMod+templateWallSide; }
  630.     wmTextureAid(file, tName1, tName2, tag1, tag2, bPath, parent);
  631. }
  632. function wmWallSideTall(file, templateMod, tag1, tag2, tName1, tName2, bPath) {
  633.     let parent;
  634.     if (tag2 != null) {
  635.         if (useWallTwist) {
  636.             parent = templateMod+customWallSideTallTwist;
  637.         } else {
  638.             parent = templateMod+customWallSideTall;
  639.         }
  640.     } else { parent = templateMod+templateWallSideTall; }
  641.     wmTextureAid(file, tName1, tName2, tag1, tag2, bPath, parent);
  642. }
  643. function wmTextureAid(file, texture1, texture2, tag1, tag2, bPath, parent) {
  644.     fileOut(file, '{', true);
  645.     fileOut(file, '\"parent\": \"'+parent+'\",', false)
  646.     fileOut(file, '\"textures\": {', false);
  647.     if(tag2 != null) {
  648.         fileOut(file, '\"'+tag1+'\": \"'+textureModID+':'+bPath+texture1+'\",', false)
  649.         fileOut(file, '\"'+tag2+'\": \"'+textureModID+':'+bPath+texture2+'\"\n}\n}', false)
  650.     } else { fileOut(file, '\"'+tag1+'\": \"'+textureModID+':'+bPath+texture1+'\"\n}\n}', false) }
  651. }
  652. function wmItems(folder, iscustomLocation, bName) {
  653.     let modelLocation;
  654.     if (iscustomLocation) { modelLocation = wallModelFiles; } else { modelLocation = baseModelFiles; }
  655.     itemAid(path.join(folder, bName+'_wall.json'), modelLocation, 'wall_inventory', bName)
  656. }
  657. function stairModels(customTemplateLocation, customModelLocation) {
  658.     let t1 = 'bottom';
  659.     let t2 = 'top';
  660.     let t3 = 'side';
  661.     let t4;
  662.     let t5 = 'inside_base';
  663.     let flocate;
  664.     let column;
  665.     if (useColumnStair) { column = true; } else { column = false; }
  666.     if (customModelLocation) { flocate = path.join(baseFolder, models, stairModelFiles) } else { flocate = path.join(baseFolder, models, baseModelFiles); }
  667.     if (customTemplateLocation) { t4 = 'inside'; } else { t4 = 'bob'; }
  668.     fs.mkdirSync(flocate, { recursive: true });
  669.     if (useWoodCycle) {
  670.         column = true;
  671.         smAid(flocate, customTemplateLocation, blockName+'_wood', t1, t2, t3, t4, t5, textureOne, textureTwo, textureThree, column, customModelLocation);
  672.         smAid(flocate, customTemplateLocation, blockName+'_log', t1, t2, t3, t4, t5, textureOne, textureTwo, textureThree, column, customModelLocation);
  673.         smAid(flocate, customTemplateLocation, 'stripped_'+blockName+'_wood', t1, t2, t3, t4, t5, textureOne, textureTwo, textureThree, column, customModelLocation);
  674.         smAid(flocate, customTemplateLocation, 'stripped_'+blockName+'_log', t1, t2, t3, t4, t5, textureOne, textureTwo, textureThree, column, customModelLocation);
  675.     } else { smAid(flocate, customTemplateLocation, blockName, t1, t2, t3, t4, t5, textureOne, textureTwo, textureThree, column, customModelLocation); }
  676. }
  677. function smAid(fLocation, iscustomtemplate, bName, tag1, tag2, tag3, tag4, tag5, texture1, texture2, texture3, column, iscustomLocation) {
  678.     let iFold = path.join(baseFolder, itemModelFiles);
  679.     let btpath = 'block/';
  680.     let template;
  681.     if (iscustomtemplate) { template = customModModelTemplateID+':'; } else { baseModID+':'; }
  682.     smStair(path.join(fLocation, bName+'_stair.json'), template, tag1, tag2, tag3, tag4, tag5, texture1, texture2, texture3, btpath, column);
  683.     smStairInner(path.join(fLocation, bName+'_stair_inner.json'), template, tag1, tag2, tag3, tag4, tag5, texture1, texture2, texture3, btpath, column);
  684.     smStairOuter(path.join(fLocation, bName+'_stair_outer.json'), template, tag1, tag2, tag3, tag4, tag5, texture1, texture2, texture3, btpath, column);
  685.     strItems(iFold, iscustomLocation, bName);
  686. }
  687. function smStair(file, templateMod, tag1, tag2, tag3, tag4, tag5, texture1, texture2, texture3, bPath, column) {
  688.     if (tag4 != 'bob') {
  689.         if (column) {
  690.             parent = templateMod+customStairsColumn;
  691.         } else {
  692.             parent = templateMod+customStairs;
  693.         }
  694.     } else { parent = templateMod+templateStair; }
  695.     strmTextureAid(file, texture1, texture2, texture3, tag1, tag2, tag3, tag4, tag5, bPath, parent, column);
  696. }
  697. function smStairInner(file, templateMod, tag1, tag2, tag3, tag4, tag5, texture1, texture2, texture3, bPath, column) {
  698.     let parent;
  699.     if (tag4 != 'bob') {
  700.         if (column) {
  701.             parent = templateMod+customInnerStairColumn;
  702.         } else {
  703.             parent = templateMod+customInnerStair;
  704.         }
  705.     } else { parent = templateMod+templateInnerStair; }
  706.     strmTextureAid(file, texture1, texture2, texture3, tag1, tag2, tag3, tag4, tag5, bPath, parent, column);
  707. }
  708. function smStairOuter(file, templateMod, tag1, tag2, tag3, tag4, tag5, texture1, texture2, texture3, bPath, column) {
  709.     let parent;
  710.     if (tag4 != 'bob') {
  711.         if (column) {
  712.             parent = templateMod+customouterStairsColumn;
  713.         } else {
  714.             parent = templateMod+customouterStairs;
  715.         }
  716.     } else { parent = templateMod+templateOuterStair; }
  717.     strmTextureAid(file, texture1, texture2, texture3, tag1, tag2, tag3, tag4, tag5, bPath, parent, column);
  718. }
  719. function strmTextureAid(file, texture1, texture2, texture3, tag1, tag2, tag3, tag4, tag5, bPath, parent, column) {
  720.     fileOut(file, '{', true);
  721.     fileOut(file, '\"parent\": \"'+parent+'\",', false)
  722.     fileOut(file, '\"textures\": {', false);
  723.     fileOut(file, '\"'+tag1+'\": \"'+textureModID+':'+bPath+texture1+'\",', false)
  724.     fileOut(file, '\"'+tag2+'\": \"'+textureModID+':'+bPath+texture1+'\",', false)
  725.     if (tag4 != 'bob') {
  726.         fileOut(file, '\"'+tag3+'\": \"'+textureModID+':'+bPath+texture2+'\",', false)
  727.         if (column) {
  728.             fileOut(file, '\"'+tag4+'\": \"'+textureModID+':'+bPath+texture3+'\",', false)
  729.             fileOut(file, '\"'+tag5+'\": \"'+textureModID+':'+bPath+texture1+'\"\n}\n}', false)
  730.         } else {
  731.             fileOut(file, '\"'+tag4+'\": \"'+textureModID+':'+bPath+texture1+'\"\n}\n}', false)
  732.         }
  733.     } else { fileOut(file, '\"'+tag3+'\": \"'+textureModID+':'+bPath+texture3+'\"\n}\n}', false) }
  734. }
  735. function strItems(folder, iscustomLocation, bName) {
  736.     let modelLocation;
  737.     if (iscustomLocation) { modelLocation = stairModelFiles; } else { modelLocation = baseModelFiles; }
  738.     itemAid(path.join(folder, bName+'_stair.json'), modelLocation, 'stair', bName)
  739. }
  740. function lootTable(){
  741.     let fold = path.join(baseFolder, lootTableFiles);
  742.     fs.mkdirSync(fold, { recursive: true })
  743.     if (useWoodCycle) {
  744.         ltAid(blockName+'_wood', fold)
  745.         ltAid(blockName+'_log', fold)
  746.         ltAid('stripped_'+blockName+'_wood', fold)
  747.         ltAid('stripped_'+blockName+'_log', fold)
  748.     } else { ltAid(blockName, fold); }
  749. }
  750. function ltAid(bName, fold){
  751.     ltgenAid(path.join(fold, bName+'_fence.json'), bName+'_fence', false);
  752.     ltgenAid(path.join(fold, bName+'_fence_gate.json'), bName+'_fence_gate', false);
  753.     ltgenAid(path.join(fold, bName+'_wall.json'), bName+'_wall', false);
  754.     ltgenAid(path.join(fold, bName+'_stair.json'), bName+'_stair', false);
  755.     ltgenAid(path.join(fold, bName+'_slab.json'), bName+'_slab', true);
  756. }
  757. function ltgenAid(file, block, isSlab) {
  758.     fileOut(file, '{', true);
  759.     fileOut(file, '\"type\": \"minecraft:block\",', false);
  760.     fileOut(file, '\"pools\": [\n{', false);
  761.     fileOut(file, '\"rolls\": 1.0,', false);
  762.     fileOut(file, '\"bonus_rolls\": 0.0,', false);
  763.     fileOut(file, '\"entries\": [\n{', false);
  764.     fileOut(file, '\"type\": \"minecraft:item\",', false);
  765.     // slab split
  766.     if (isSlab) {
  767.         fileOut(file, '\"functions\": [\n{', false);
  768.         fileOut(file, '\"function\": \"minecraft:set_count\",', false);
  769.         fileOut(file, '\"conditions\": [\n{', false);
  770.         fileOut(file, '\"condition\": \"minecraft:block_state_property\",', false);
  771.         fileOut(file, '\"block\": \"'+bridgeModID+':'+block+'\",', false);
  772.         fileOut(file, '\"properties\": {', false);
  773.         fileOut(file, '\"type\": \"double\"\n}\n}\n],', false);
  774.         fileOut(file, '\"count\": 2.0,', false);
  775.         fileOut(file, '\"add\": false\n},\n{', false);
  776.         fileOut(file, '\"function\": \"minecraft:explosion_decay\"\n}\n],', false);
  777.         fileOut(file, '\"name\": \"'+bridgeModID+':'+block+'\"\n}\n]\n}\n]\n}', false);
  778.     } else {
  779.         fileOut(file, '\"name\": \"'+bridgeModID+':'+block+'\"\n}\n],', false);
  780.         fileOut(file, '\"conditions\": [\n{', false);
  781.         fileOut(file, '\"condition\": \"minecraft:survives_explosion\"\n}\n]\n\}\n]\n}', false);
  782.     }
  783. }
Advertisement
RAW Paste Data Copied
Advertisement