Some ZS to clean up Fused Quartz
wsetzer opened this issue ยท 8 comments
I apologize for using the issue system to provide some code, but I don't have the ability to generate pull requests.
Here is some ZenScript to pare down the excessive Fused Quartz blocks. There are 21 different kinds of Fused Quartz, with 16 colors each. This script hides all but the white color, which happens to be the color you look at to see how the block is made. This was tested on the 2022/01/21 version of dev (5d0a409) and worked as expected: All the non-white colors are hidden but craftable if you want them.
import mods.jei.JEI.hide as jeiHide;
val fusedQuartz01 = <enderio:block_fused_quartz> .definition;
val fusedQuartz02 = <enderio:block_enlightened_fused_quartz> .definition;
val fusedQuartz03 = <enderio:block_dark_fused_quartz> .definition;
val fusedQuartz04 = <enderio:block_holy_fused_quartz> .definition;
val fusedQuartz05 = <enderio:block_holy_enlightened_fused_quartz> .definition;
val fusedQuartz06 = <enderio:block_holy_dark_fused_quartz> .definition;
val fusedQuartz07 = <enderio:block_unholy_fused_quartz> .definition;
val fusedQuartz08 = <enderio:block_unholy_enlightened_fused_quartz> .definition;
val fusedQuartz09 = <enderio:block_unholy_dark_fused_quartz> .definition;
val fusedQuartz10 = <enderio:block_pasture_fused_quartz> .definition;
val fusedQuartz11 = <enderio:block_pasture_enlightened_fused_quartz> .definition;
val fusedQuartz12 = <enderio:block_pasture_dark_fused_quartz> .definition;
val fusedQuartz13 = <enderio:block_not_holy_fused_quartz> .definition;
val fusedQuartz14 = <enderio:block_not_holy_enlightened_fused_quartz> .definition;
val fusedQuartz15 = <enderio:block_not_holy_dark_fused_quartz> .definition;
val fusedQuartz16 = <enderio:block_not_unholy_fused_quartz> .definition;
val fusedQuartz17 = <enderio:block_not_unholy_enlightened_fused_quartz> .definition;
val fusedQuartz18 = <enderio:block_not_unholy_dark_fused_quartz> .definition;
val fusedQuartz19 = <enderio:block_not_pasture_fused_quartz> .definition;
val fusedQuartz20 = <enderio:block_not_pasture_enlightened_fused_quartz> .definition;
val fusedQuartz21 = <enderio:block_not_pasture_dark_fused_quartz> .definition;
for color in 1 .. 16 {
jeiHide(fusedQuartz01.makeStack(color));
jeiHide(fusedQuartz02.makeStack(color));
jeiHide(fusedQuartz03.makeStack(color));
jeiHide(fusedQuartz04.makeStack(color));
jeiHide(fusedQuartz05.makeStack(color));
jeiHide(fusedQuartz06.makeStack(color));
jeiHide(fusedQuartz07.makeStack(color));
jeiHide(fusedQuartz08.makeStack(color));
jeiHide(fusedQuartz09.makeStack(color));
jeiHide(fusedQuartz10.makeStack(color));
jeiHide(fusedQuartz11.makeStack(color));
jeiHide(fusedQuartz12.makeStack(color));
jeiHide(fusedQuartz13.makeStack(color));
jeiHide(fusedQuartz14.makeStack(color));
jeiHide(fusedQuartz15.makeStack(color));
jeiHide(fusedQuartz16.makeStack(color));
jeiHide(fusedQuartz17.makeStack(color));
jeiHide(fusedQuartz18.makeStack(color));
jeiHide(fusedQuartz19.makeStack(color));
jeiHide(fusedQuartz20.makeStack(color));
jeiHide(fusedQuartz21.makeStack(color));
}
Some more Zen Script to clean up the 21 versions of Quite Clear Glass. This is cut and pasted from my test script, so obviously the jeiHide() commands belong in the same kind of loop as above.
val fusedGlass01 = <enderio:block_fused_glass> .definition;
val fusedGlass02 = <enderio:block_enlightened_fused_glass> .definition;
val fusedGlass03 = <enderio:block_dark_fused_glass> .definition;
val fusedGlass04 = <enderio:block_holy_fused_glass> .definition;
val fusedGlass05 = <enderio:block_holy_enlightened_fused_glass> .definition;
val fusedGlass06 = <enderio:block_holy_dark_fused_glass> .definition;
val fusedGlass07 = <enderio:block_unholy_fused_glass> .definition;
val fusedGlass08 = <enderio:block_unholy_enlightened_fused_glass> .definition;
val fusedGlass09 = <enderio:block_unholy_dark_fused_glass> .definition;
val fusedGlass10 = <enderio:block_pasture_fused_glass> .definition;
val fusedGlass11 = <enderio:block_pasture_enlightened_fused_glass> .definition;
val fusedGlass12 = <enderio:block_pasture_dark_fused_glass> .definition;
val fusedGlass13 = <enderio:block_not_holy_fused_glass> .definition;
val fusedGlass14 = <enderio:block_not_holy_enlightened_fused_glass> .definition;
val fusedGlass15 = <enderio:block_not_holy_dark_fused_glass> .definition;
val fusedGlass16 = <enderio:block_not_unholy_fused_glass> .definition;
val fusedGlass17 = <enderio:block_not_unholy_enlightened_fused_glass> .definition;
val fusedGlass18 = <enderio:block_not_unholy_dark_fused_glass> .definition;
val fusedGlass19 = <enderio:block_not_pasture_fused_glass> .definition;
val fusedGlass20 = <enderio:block_not_pasture_enlightened_fused_glass> .definition;
val fusedGlass21 = <enderio:block_not_pasture_dark_fused_glass> .definition;
jeiHide(fusedGlass01.makeStack(color));
jeiHide(fusedGlass02.makeStack(color));
jeiHide(fusedGlass03.makeStack(color));
jeiHide(fusedGlass04.makeStack(color));
jeiHide(fusedGlass05.makeStack(color));
jeiHide(fusedGlass06.makeStack(color));
jeiHide(fusedGlass07.makeStack(color));
jeiHide(fusedGlass08.makeStack(color));
jeiHide(fusedGlass09.makeStack(color));
jeiHide(fusedGlass10.makeStack(color));
jeiHide(fusedGlass11.makeStack(color));
jeiHide(fusedGlass12.makeStack(color));
jeiHide(fusedGlass13.makeStack(color));
jeiHide(fusedGlass14.makeStack(color));
jeiHide(fusedGlass15.makeStack(color));
jeiHide(fusedGlass16.makeStack(color));
jeiHide(fusedGlass17.makeStack(color));
jeiHide(fusedGlass18.makeStack(color));
jeiHide(fusedGlass19.makeStack(color));
jeiHide(fusedGlass20.makeStack(color));
jeiHide(fusedGlass21.makeStack(color));
Some more ZenScript to clean up the 15 versions of the Gregtech Frame. Same caveats as above.
val gtFrame01 = <gregtech:frame_hssg> .definition;
val gtFrame02 = <gregtech:frame_bronze> .definition;
val gtFrame03 = <gregtech:frame_darmstadtium> .definition;
val gtFrame04 = <gregtech:frame_aluminium> .definition;
val gtFrame05 = <gregtech:frame_tungsten_steel> .definition;
val gtFrame06 = <gregtech:frame_invar> .definition;
val gtFrame07 = <gregtech:frame_wood> .definition;
val gtFrame08 = <gregtech:frame_stainless_steel> .definition;
val gtFrame09 = <gregtech:frame_steel> .definition;
val gtFrame10 = <gregtech:frame_blue_steel> .definition;
val gtFrame11 = <gregtech:frame_hsse> .definition;
val gtFrame12 = <gregtech:frame_neutronium> .definition;
val gtFrame13 = <gregtech:frame_iron> .definition;
val gtFrame14 = <gregtech:frame_titanium> .definition;
val gtFrame15 = <gregtech:frame_tritanium> .definition;
jeiHide(gtFrame01.makeStack(color));
jeiHide(gtFrame02.makeStack(color));
jeiHide(gtFrame03.makeStack(color));
jeiHide(gtFrame04.makeStack(color));
jeiHide(gtFrame05.makeStack(color));
jeiHide(gtFrame06.makeStack(color));
jeiHide(gtFrame07.makeStack(color));
jeiHide(gtFrame08.makeStack(color));
jeiHide(gtFrame09.makeStack(color));
jeiHide(gtFrame10.makeStack(color));
jeiHide(gtFrame11.makeStack(color));
jeiHide(gtFrame12.makeStack(color));
jeiHide(gtFrame13.makeStack(color));
jeiHide(gtFrame14.makeStack(color));
jeiHide(gtFrame15.makeStack(color));
I seem to keep finding things to tweak. In this case, it's to add an informational panel to JEI for each block so people know that the colors have been hidden to reduce clutter. It assumes the naming conventions from the previous submissions, of course.
Also, the wording of the informational panel should probably be improved.
import mods.jei.JEI.addDescription as jeiAddDesc;
val colorDesc = [ "Most colors for this item are hidden to reduce clutter, but you can still craft them.",
"See the coloring recipe for the pattern." ] as string[];
jeiAddDesc(fusedQuartz01.makeStack(0), colorDesc);
jeiAddDesc(fusedQuartz02.makeStack(0), colorDesc);
jeiAddDesc(fusedQuartz03.makeStack(0), colorDesc);
jeiAddDesc(fusedQuartz04.makeStack(0), colorDesc);
jeiAddDesc(fusedQuartz05.makeStack(0), colorDesc);
jeiAddDesc(fusedQuartz06.makeStack(0), colorDesc);
jeiAddDesc(fusedQuartz07.makeStack(0), colorDesc);
jeiAddDesc(fusedQuartz08.makeStack(0), colorDesc);
jeiAddDesc(fusedQuartz09.makeStack(0), colorDesc);
jeiAddDesc(fusedQuartz10.makeStack(0), colorDesc);
jeiAddDesc(fusedQuartz11.makeStack(0), colorDesc);
jeiAddDesc(fusedQuartz12.makeStack(0), colorDesc);
jeiAddDesc(fusedQuartz13.makeStack(0), colorDesc);
jeiAddDesc(fusedQuartz14.makeStack(0), colorDesc);
jeiAddDesc(fusedQuartz15.makeStack(0), colorDesc);
jeiAddDesc(fusedQuartz16.makeStack(0), colorDesc);
jeiAddDesc(fusedQuartz17.makeStack(0), colorDesc);
jeiAddDesc(fusedQuartz18.makeStack(0), colorDesc);
jeiAddDesc(fusedQuartz19.makeStack(0), colorDesc);
jeiAddDesc(fusedQuartz20.makeStack(0), colorDesc);
jeiAddDesc(fusedQuartz21.makeStack(0), colorDesc);
jeiAddDesc(fusedGlass01.makeStack(0), colorDesc);
jeiAddDesc(fusedGlass02.makeStack(0), colorDesc);
jeiAddDesc(fusedGlass03.makeStack(0), colorDesc);
jeiAddDesc(fusedGlass04.makeStack(0), colorDesc);
jeiAddDesc(fusedGlass05.makeStack(0), colorDesc);
jeiAddDesc(fusedGlass06.makeStack(0), colorDesc);
jeiAddDesc(fusedGlass07.makeStack(0), colorDesc);
jeiAddDesc(fusedGlass08.makeStack(0), colorDesc);
jeiAddDesc(fusedGlass09.makeStack(0), colorDesc);
jeiAddDesc(fusedGlass10.makeStack(0), colorDesc);
jeiAddDesc(fusedGlass11.makeStack(0), colorDesc);
jeiAddDesc(fusedGlass12.makeStack(0), colorDesc);
jeiAddDesc(fusedGlass13.makeStack(0), colorDesc);
jeiAddDesc(fusedGlass14.makeStack(0), colorDesc);
jeiAddDesc(fusedGlass15.makeStack(0), colorDesc);
jeiAddDesc(fusedGlass16.makeStack(0), colorDesc);
jeiAddDesc(fusedGlass17.makeStack(0), colorDesc);
jeiAddDesc(fusedGlass18.makeStack(0), colorDesc);
jeiAddDesc(fusedGlass19.makeStack(0), colorDesc);
jeiAddDesc(fusedGlass20.makeStack(0), colorDesc);
jeiAddDesc(fusedGlass21.makeStack(0), colorDesc);
jeiAddDesc(gtFrame01.makeStack(0), colorDesc);
jeiAddDesc(gtFrame02.makeStack(0), colorDesc);
jeiAddDesc(gtFrame03.makeStack(0), colorDesc);
jeiAddDesc(gtFrame04.makeStack(0), colorDesc);
jeiAddDesc(gtFrame05.makeStack(0), colorDesc);
jeiAddDesc(gtFrame06.makeStack(0), colorDesc);
jeiAddDesc(gtFrame07.makeStack(0), colorDesc);
jeiAddDesc(gtFrame08.makeStack(0), colorDesc);
jeiAddDesc(gtFrame09.makeStack(0), colorDesc);
jeiAddDesc(gtFrame10.makeStack(0), colorDesc);
jeiAddDesc(gtFrame11.makeStack(0), colorDesc);
jeiAddDesc(gtFrame12.makeStack(0), colorDesc);
jeiAddDesc(gtFrame13.makeStack(0), colorDesc);
jeiAddDesc(gtFrame14.makeStack(0), colorDesc);
jeiAddDesc(gtFrame15.makeStack(0), colorDesc);
Sorry to keep spamming the thread, but I fixed my bad code to be less bad and more maintainable and extendable. This should be the final form,.
import crafttweaker.item.IItemDefinition;
val fusedQuartz = [
<enderio:block_fused_quartz> .definition,
<enderio:block_enlightened_fused_quartz> .definition,
<enderio:block_dark_fused_quartz> .definition,
<enderio:block_holy_fused_quartz> .definition,
<enderio:block_holy_enlightened_fused_quartz> .definition,
<enderio:block_holy_dark_fused_quartz> .definition,
<enderio:block_unholy_fused_quartz> .definition,
<enderio:block_unholy_enlightened_fused_quartz> .definition,
<enderio:block_unholy_dark_fused_quartz> .definition,
<enderio:block_pasture_fused_quartz> .definition,
<enderio:block_pasture_enlightened_fused_quartz> .definition,
<enderio:block_pasture_dark_fused_quartz> .definition,
<enderio:block_not_holy_fused_quartz> .definition,
<enderio:block_not_holy_enlightened_fused_quartz> .definition,
<enderio:block_not_holy_dark_fused_quartz> .definition,
<enderio:block_not_unholy_fused_quartz> .definition,
<enderio:block_not_unholy_enlightened_fused_quartz> .definition,
<enderio:block_not_unholy_dark_fused_quartz> .definition,
<enderio:block_not_pasture_fused_quartz> .definition,
<enderio:block_not_pasture_enlightened_fused_quartz>.definition,
<enderio:block_not_pasture_dark_fused_quartz> .definition
] as IItemDefinition[];
val fusedGlass = [
<enderio:block_fused_glass> .definition,
<enderio:block_enlightened_fused_glass> .definition,
<enderio:block_dark_fused_glass> .definition,
<enderio:block_holy_fused_glass> .definition,
<enderio:block_holy_enlightened_fused_glass> .definition,
<enderio:block_holy_dark_fused_glass> .definition,
<enderio:block_unholy_fused_glass> .definition,
<enderio:block_unholy_enlightened_fused_glass> .definition,
<enderio:block_unholy_dark_fused_glass> .definition,
<enderio:block_pasture_fused_glass> .definition,
<enderio:block_pasture_enlightened_fused_glass> .definition,
<enderio:block_pasture_dark_fused_glass> .definition,
<enderio:block_not_holy_fused_glass> .definition,
<enderio:block_not_holy_enlightened_fused_glass> .definition,
<enderio:block_not_holy_dark_fused_glass> .definition,
<enderio:block_not_unholy_fused_glass> .definition,
<enderio:block_not_unholy_enlightened_fused_glass> .definition,
<enderio:block_not_unholy_dark_fused_glass> .definition,
<enderio:block_not_pasture_fused_glass> .definition,
<enderio:block_not_pasture_enlightened_fused_glass> .definition,
<enderio:block_not_pasture_dark_fused_glass> .definition
] as IItemDefinition[];
val gtFrame = [
<gregtech:frame_hssg> .definition,
<gregtech:frame_bronze> .definition,
<gregtech:frame_darmstadtium> .definition,
<gregtech:frame_aluminium> .definition,
<gregtech:frame_tungsten_steel> .definition,
<gregtech:frame_invar> .definition,
<gregtech:frame_wood> .definition,
<gregtech:frame_stainless_steel> .definition,
<gregtech:frame_steel> .definition,
<gregtech:frame_blue_steel> .definition,
<gregtech:frame_hsse> .definition,
<gregtech:frame_neutronium> .definition,
<gregtech:frame_iron> .definition,
<gregtech:frame_titanium> .definition,
<gregtech:frame_tritanium> .definition
] as IItemDefinition[];
val allArrays = [
fusedQuartz,
fusedGlass,
gtFrame
] as IItemDefinition[][];
val colorDesc = [
"Most colors for this item are hidden to reduce clutter.",
"They can still be crafted.",
"See the coloring recipe for the pattern."
] as string[];
for array in allArrays {
for item in array {
mods.jei.JEI.addDescription(item.makeStack(0), colorDesc);
for color in 1 .. 16 {
mods.jei.JEI.hide(item.makeStack(color));
}
}
}
I apologize for using the issue system to provide some code, but I don't have the ability to generate pull requests.
Everyone has the ability to create a pull request, they might simply not know how.
At the top right of GitHub there is a button that says "Fork". This will allow you to create a copy of the repository under your username which you have the ability to edit. As for the edits themselves, you can do that entirely from GitHub if you aren't familiar with how to use git.
In your fork, click the drop-down menu for branches (it most likely says "dev") and type in a name that isn't already in use. It will show a search result that says "Create branch: from ". Click that result to make a new branch for developing your feature which will start at the same place in history as the branch you were looking at, rather than doing it directly in the original branch. This is commonly called a "feature branch" and it is a good habit to get into so that you can work on different things at once, while keeping your fork's copy of the master branch (in our case, dev
) synchronized with the upstream repository (this one).
Next, find the file you want to change (or add it to the directory you are looking at using the "Add file" button). CraftTweaker scripts must go in a file in overrides/scripts
or a subdirectory of the same. Click on the file to open it, and then click the edit button to open the web-based file editor. Paste your changes in there, and at the bottom of the page you can fill in the form to commit the changes you made.
Once a commit has been made, you are usually prompted on the repository's landing page that new commits were recently made to a branch and given a quick button to make a pull request. Use that, and it pre-populates the selectors with the upstream branch and your feature branch. If not, you can go to the Pull Requests tab on the upstream repository (this one), and create a new one from there. Your fork's feature branch should be listed as an option in the dropdown.
Fill out the title and description and then you can submit the pull request. If you need to make changes to the contents of the pull request, just make more commits in your fork's feature branch and the pull request will see them automatically.
Why not just edit your first post?
Honestly, it never occurred to me that there was that facility. For some reason, I expected an edit button if it was editable, plus I'm kinda used to a ticketing system where everything stays forever, for auditing purposes. It's my fault for ignoring The Three Dots.
I apologize for using the issue system to provide some code, but I don't have the ability to generate pull requests.
Everyone has the ability to create a pull request, they might simply not know how.
My fault again. For some reason, I thought pull requests required git, which I have a hate-hate relationship with. Plus, I'm currently stuck on Windows, and I'll shoot myself before I use git on Windows.
Thank you for the step-by-step instructions. If I didn't mess them up, there's a pull request for a new script file with the color hiding code in it.