minecraft server init
This commit is contained in:
157
scripts/crafttweaker/classes/utils/recipeUtil.zs
Normal file
157
scripts/crafttweaker/classes/utils/recipeUtil.zs
Normal file
@ -0,0 +1,157 @@
|
||||
#priority 3400
|
||||
|
||||
/*
|
||||
SevTech: Ages Recipe Util Script
|
||||
|
||||
This script is a zenClass "Util/Wrapper" for recipe adding. Which gives us an easier way
|
||||
to add recipes to the game in a clean script layout using Maps/Arrays.
|
||||
|
||||
Note: These scripts are created and for the usage in SevTech: Ages and other
|
||||
modpacks curated by DarkPacks. You can use these scripts for reference and for
|
||||
learning but not for copying and pasting and claiming as your own.
|
||||
*/
|
||||
import crafttweaker.item.IItemStack;
|
||||
import crafttweaker.item.IIngredient;
|
||||
|
||||
import mods.zenstages.ZenStager;
|
||||
|
||||
import scripts.crafttweaker.stages.stageDisabled;
|
||||
|
||||
zenClass RecipeUtil {
|
||||
zenConstructor() {
|
||||
}
|
||||
|
||||
/*
|
||||
Process Method to handle Shapless Recipes.
|
||||
*/
|
||||
function processNamed(map as IIngredient[][][string][IItemStack]) {
|
||||
for item, itemRecipes in map {
|
||||
for recipeName, recipesInner in itemRecipes {
|
||||
for i, recipe in recipesInner {
|
||||
var toName = recipeName;
|
||||
if (i > 0) {
|
||||
toName = toName ~ "_" ~ i;
|
||||
}
|
||||
if (recipeName == "nameless") {
|
||||
recipes.addShapeless(item, recipe);
|
||||
} else {
|
||||
recipes.addShapeless(toName, item, recipe);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function process(map as IIngredient[][][IItemStack]) {
|
||||
for item, itemRecipes in map {
|
||||
for recipe in itemRecipes {
|
||||
recipes.addShapeless(item, recipe);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
Process Method to handle Shaped and Mirrored Recipes.
|
||||
*/
|
||||
function processNamed(map as IIngredient[][][][string][IItemStack], isMirrored as bool) {
|
||||
for item, itemRecipes in map {
|
||||
for recipeName, recipesInner in itemRecipes {
|
||||
for i, recipe in recipesInner {
|
||||
var toName = recipeName;
|
||||
if (i > 0) {
|
||||
toName = toName ~ "_" ~ i;
|
||||
}
|
||||
|
||||
if (recipeName == "nameless") {
|
||||
if (isMirrored) {
|
||||
recipes.addShapedMirrored(item, recipe);
|
||||
} else {
|
||||
recipes.addShaped(item, recipe);
|
||||
}
|
||||
} else {
|
||||
if (isMirrored) {
|
||||
recipes.addShapedMirrored(toName, item, recipe);
|
||||
} else {
|
||||
recipes.addShaped(toName, item, recipe);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function process(map as IIngredient[][][][IItemStack], isMirrored as bool) {
|
||||
for item, itemRecipes in map {
|
||||
for recipe in itemRecipes {
|
||||
if (isMirrored) {
|
||||
recipes.addShapedMirrored(item, recipe);
|
||||
} else {
|
||||
recipes.addShaped(item, recipe);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
Removes recipes simple as baking a cake!
|
||||
*/
|
||||
function removeRecipes(removals as IItemStack[]) {
|
||||
for toRemove in removals {
|
||||
recipes.remove(toRemove);
|
||||
}
|
||||
}
|
||||
function removeRecipes(removals as string[]) {
|
||||
for toRemove in removals {
|
||||
recipes.removeByRegex(toRemove);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
Process Method for handling Furnace Recipes.
|
||||
*/
|
||||
function processFurnace(recipesToAdd as IIngredient[][IItemStack]) {
|
||||
for output, inputs in recipesToAdd {
|
||||
for input in inputs {
|
||||
furnace.addRecipe(output, input);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
Remove recipes from the Vanilla Furnace
|
||||
*/
|
||||
function removeFurnace(removals as IIngredient[]) {
|
||||
for toRemove in removals {
|
||||
furnace.remove(toRemove);
|
||||
}
|
||||
}
|
||||
function removeFurnace(removals as IIngredient[IIngredient]) {
|
||||
for input, output in removals {
|
||||
furnace.remove(input, output);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
Hide an item from JEI.
|
||||
|
||||
You can also set true to the second param to remove the recipes also.
|
||||
This also sets the Stage to Disabled incase people still have them or find them.
|
||||
*/
|
||||
function hideItems(removals as IIngredient[]) {
|
||||
hideItems(removals, false);
|
||||
}
|
||||
function hideItems(removals as IIngredient[], removeRecipe as bool) {
|
||||
if (removeRecipe) {
|
||||
for toHide in removals {
|
||||
mods.jei.JEI.removeAndHide(toHide);
|
||||
ZenStager.getStage(stageDisabled.stage).addIngredient(toHide, false);
|
||||
}
|
||||
} else {
|
||||
for toHide in removals {
|
||||
for toHideItem in toHide.items {
|
||||
mods.jei.JEI.hide(toHideItem);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
146
scripts/crafttweaker/classes/utils/unifier.zs
Normal file
146
scripts/crafttweaker/classes/utils/unifier.zs
Normal file
@ -0,0 +1,146 @@
|
||||
#priority 2750
|
||||
|
||||
/*
|
||||
SevTech: Ages Unifier Class Script
|
||||
|
||||
Note: These scripts are created and for the usage in SevTech: Ages and other
|
||||
modpacks curated by DarkPacks. You can use these scripts for reference and for
|
||||
learning but not for copying and pasting and claiming as your own.
|
||||
*/
|
||||
import crafttweaker.item.IItemStack;
|
||||
import crafttweaker.liquid.ILiquidStack;
|
||||
import crafttweaker.oredict.IOreDictEntry;
|
||||
|
||||
import mods.chisel.Carving;
|
||||
|
||||
zenClass Unifier {
|
||||
// In order of priority
|
||||
var defaultPreferredMods as string[] = [
|
||||
"minecraft",
|
||||
"contenttweaker",
|
||||
"immersiveengineering",
|
||||
"mekanism"
|
||||
];
|
||||
|
||||
zenConstructor() {
|
||||
}
|
||||
|
||||
/*
|
||||
Figure out which item is preferred
|
||||
|
||||
The array should be in order of priority, so if its found, return immediately
|
||||
as this will be the most preferred option
|
||||
*/
|
||||
function getPreferredItem(oreDictEntry as IOreDictEntry) as IItemStack {
|
||||
return getPreferredItem(oreDictEntry, defaultPreferredMods);
|
||||
}
|
||||
function getPreferredItem(oreDictEntry as IOreDictEntry, preferredMods as string[]) as IItemStack {
|
||||
for modName in preferredMods {
|
||||
for item in oreDictEntry.items {
|
||||
if (item.definition.owner == modName) {
|
||||
return item;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// If there is still no item found, take the first availble
|
||||
return oreDictEntry.firstItem;
|
||||
}
|
||||
|
||||
function clearOreDict(oreDictEntry as IOreDictEntry) {
|
||||
unify(oreDictEntry, null, null);
|
||||
}
|
||||
function clearOreDict(oreDictEntry as IOreDictEntry, liquid as ILiquidStack) {
|
||||
unify(oreDictEntry, null, liquid);
|
||||
}
|
||||
function clearOreDict(oreDictEntry as IOreDictEntry, preferredItem as IItemStack, liquid as ILiquidStack) {
|
||||
unify(oreDictEntry, preferredItem, liquid);
|
||||
}
|
||||
|
||||
function unify(oreDictEntry as IOreDictEntry) {
|
||||
unify(oreDictEntry, getPreferredItem(oreDictEntry), null);
|
||||
}
|
||||
function unify(oreDictEntry as IOreDictEntry, liquid as ILiquidStack) {
|
||||
unify(oreDictEntry, getPreferredItem(oreDictEntry), liquid);
|
||||
}
|
||||
function unify(oreDictEntry as IOreDictEntry, preferredItem as IItemStack) {
|
||||
unify(oreDictEntry, preferredItem, null);
|
||||
}
|
||||
function unify(oreDictEntry as IOreDictEntry, preferredItem as IItemStack, liquid as ILiquidStack) {
|
||||
var hasLiquid = liquid as bool;
|
||||
|
||||
var vgName = "vg_" + oreDictEntry.name.toLowerCase();
|
||||
if (!isNull(preferredItem) & chiselBlocks.keys has oreDictEntry) {
|
||||
print("[Chisel] Removing " + oreDictEntry.name);
|
||||
Carving.removeGroup(oreDictEntry.name);
|
||||
print("[Chisel] Creating " + vgName);
|
||||
Carving.addGroup(vgName);
|
||||
print("[Chisel] Adding " + preferredItem.definition.id + " to " + vgName);
|
||||
Carving.addVariation(vgName, preferredItem);
|
||||
}
|
||||
|
||||
for item in oreDictEntry.items {
|
||||
if (!item.matches(preferredItem)) {
|
||||
oreDictEntry.remove(item);
|
||||
|
||||
furnace.remove(item);
|
||||
furnace.setFuel(item, 0); // Setting the burnTime to 0 will stop the input from being a fuel item
|
||||
|
||||
/*
|
||||
Remove from mod integrations
|
||||
*/
|
||||
// ==================================
|
||||
// Applied Energistics 2
|
||||
appliedEnergistics.removeGrindstone(item);
|
||||
appliedEnergistics.removeInscribe(item);
|
||||
|
||||
// ==================================
|
||||
// Astral Sorcery
|
||||
astralSorcery.removeGrindstone(item);
|
||||
|
||||
// ==================================
|
||||
// Immersive Engineering
|
||||
immersiveEngineering.removeAlloy(item);
|
||||
immersiveEngineering.removeArcFurn(item);
|
||||
immersiveEngineering.removeCrusher(item);
|
||||
immersiveEngineering.removeCrusherByInput(item);
|
||||
immersiveEngineering.removePress(item);
|
||||
|
||||
// ==================================
|
||||
// Just Enough Items
|
||||
mods.jei.JEI.removeAndHide(item);
|
||||
|
||||
// ==================================
|
||||
// Mekanism
|
||||
mekanism.removeChemicalCrystallizer(item);
|
||||
mekanism.removeChemicalInjection(item);
|
||||
mekanism.removeCombiner(item);
|
||||
mekanism.removeCrusher(item);
|
||||
mekanism.removeSmelter(item);
|
||||
mekanism.removeEnrichment(item);
|
||||
mekanism.removeInfusion(item);
|
||||
mekanism.removeCompressor(item);
|
||||
mekanism.removeSawmill(item);
|
||||
mekanism.removePurification(item);
|
||||
|
||||
// ==================================
|
||||
// Tinker's Construct
|
||||
tinkers.removeCastingBasin(item);
|
||||
tinkers.removeCastingTable(item);
|
||||
|
||||
if (hasLiquid) {
|
||||
tinkers.removeMelting(liquid, item);
|
||||
}
|
||||
|
||||
if (item.definition.owner == "chisel" & chiselBlocks.keys has oreDictEntry) {
|
||||
print("[Chisel] Adding " + item.definition.id + " to " + vgName);
|
||||
Carving.addVariation(vgName, item);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!isNull(preferredItem)) {
|
||||
scripts.crafttweaker.utils.ensureOreDict(oreDictEntry, preferredItem);
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user