Created
November 7, 2019 01:56
-
-
Save supersaiyansubtlety/414ee3bb4bec55f3ea3223a7c4a76066 to your computer and use it in GitHub Desktop.
Attempts to find and replace all slab recipes using CraftTweaker's ZenScript
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import crafttweaker.recipes.ICraftingRecipe; | |
import crafttweaker.item.IIngredient; | |
var slabRecipes = recipes.all; | |
for recipe in slabRecipes | |
{ | |
if (recipe.output.name.toLowerCase has "slab") | |
{ | |
var ingredients = recipe.ingredients1D as IIngredient[]; | |
var i = 0; | |
while ((i < ingredients.length) & (ingredients[i] == null)) | |
{ | |
i+=1; | |
} | |
var input = ingredients[i]; | |
var ouput = recipe.output; | |
output.amount = 4; | |
recipes.remove(recipe.output); | |
recipes.addShapedMirrored(input.displayName + "-to-" + output.displayName, output, | |
[ | |
[null,null,null], | |
[null,null,null], | |
[null,input,input] | |
] | |
); | |
} | |
} |
Ah, thanks! Didn't know that was a possibility.
I'm actually not sure if it's documented that there's a difference between the two, I've been using CT since MT and half of my knowledge is from having spaded things before the documentation was anywhere near this good. But in general, any row or column that consists only of null
can be removed, and almost always should be too because the recipe handling isn't quite intelligent enough to understand that those slots can be completely disregarded, so it'll require that they be present and empty. Of course, sometimes that's what you want, but it'd be nice if it was mentioned on the docs somewhere...
Good to know, thanks again
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I will point out that your recipe matrix is poorly designed. If you specify it like this, then it must be made in a 3x3 matrix, with the ingredients specifically in the bottom row, middle and right columns. Mirroring it only means that they can be in the left and middle columns too. Far better would be to not mirror it and specify the matrix as
[[input, input]]
instead, which only requires they be side-by-side.