Compare commits

..
1 Commits
Author SHA1 Message Date
Raven Szewczyk 9a2373b343 Fix missing ModOnly-IC2 annotations (#14)
* Update buildscript&dependencies

* Fix missing ModOnly-IC2 annotations
2023-07-04 22:00:09 +01:00
15 changed files with 50 additions and 363 deletions

No files matched your search

-51
View File
@@ -1,51 +0,0 @@
#!/usr/bin/env bash
# bashsupport disable=BP5006 # Global environment variables
RUNDIR="run" \
CRASH="crash-reports" \
SERVERLOG="server.log"
# enable nullglob to get 0 results when no match rather than the pattern
shopt -s nullglob
# store matches in array
crash_reports=("$RUNDIR/$CRASH/crash"*.txt)
# if array not empty there are crash_reports
if [ "${#crash_reports[@]}" -gt 0 ]; then
# get the latest crash_report from array
latest_crash_report="${crash_reports[-1]}"
{
printf 'Latest crash report detected %s:\n' "${latest_crash_report##*/}"
cat "$latest_crash_report"
} >&2
exit 1
fi
if grep --quiet --fixed-strings 'Fatal errors were detected' "$SERVERLOG"; then
{
printf 'Fatal errors detected:\n'
cat server.log
} >&2
exit 1
fi
if grep --quiet --fixed-strings 'The state engine was in incorrect state ERRORED and forced into state SERVER_STOPPED' \
"$SERVERLOG"; then
{
printf 'Server force stopped:'
cat server.log
} >&2
exit 1
fi
if ! grep --quiet --perl-regexp --only-matching '.+Done \(.+\)\! For help, type "help" or "\?"' "$SERVERLOG"; then
{
printf 'Server did not finish startup:'
cat server.log
} >&2
exit 1
fi
printf 'No crash reports detected'
exit 0
+39 -4
View File
@@ -1,4 +1,4 @@
//version: 1682280358 //version: 1685785062
/* /*
DO NOT CHANGE THIS FILE! DO NOT CHANGE THIS FILE!
Also, you may replace this file at any time if there is an update available. Also, you may replace this file at any time if there is an update available.
@@ -69,8 +69,11 @@ plugins {
id 'com.diffplug.spotless' version '6.13.0' apply false // 6.13.0 is the last jvm8 supporting version id 'com.diffplug.spotless' version '6.13.0' apply false // 6.13.0 is the last jvm8 supporting version
id 'com.modrinth.minotaur' version '2.+' apply false id 'com.modrinth.minotaur' version '2.+' apply false
id 'com.matthewprenger.cursegradle' version '1.4.0' apply false id 'com.matthewprenger.cursegradle' version '1.4.0' apply false
id 'com.gtnewhorizons.retrofuturagradle' version '1.3.2' id 'com.gtnewhorizons.retrofuturagradle' version '1.3.14'
} }
print("You might want to check out './gradlew :faq' if your build fails.\n")
boolean settingsupdated = verifySettingsGradle() boolean settingsupdated = verifySettingsGradle()
settingsupdated = verifyGitAttributes() || settingsupdated settingsupdated = verifyGitAttributes() || settingsupdated
if (settingsupdated) if (settingsupdated)
@@ -219,6 +222,8 @@ if (enableModernJavaSyntax.toBoolean()) {
dependencies { dependencies {
annotationProcessor 'com.github.bsideup.jabel:jabel-javac-plugin:1.0.0' annotationProcessor 'com.github.bsideup.jabel:jabel-javac-plugin:1.0.0'
// workaround for https://github.com/bsideup/jabel/issues/174
annotationProcessor 'net.java.dev.jna:jna-platform:5.13.0'
compileOnly('com.github.bsideup.jabel:jabel-javac-plugin:1.0.0') { compileOnly('com.github.bsideup.jabel:jabel-javac-plugin:1.0.0') {
transitive = false // We only care about the 1 annotation class transitive = false // We only care about the 1 annotation class
} }
@@ -564,9 +569,10 @@ repositories {
def mixinProviderGroup = "io.github.legacymoddingmc" def mixinProviderGroup = "io.github.legacymoddingmc"
def mixinProviderModule = "unimixins" def mixinProviderModule = "unimixins"
def mixinProviderVersion = "0.1.6" def mixinProviderVersion = "0.1.7.1"
def mixinProviderSpecNoClassifer = "${mixinProviderGroup}:${mixinProviderModule}:${mixinProviderVersion}" def mixinProviderSpecNoClassifer = "${mixinProviderGroup}:${mixinProviderModule}:${mixinProviderVersion}"
def mixinProviderSpec = "${mixinProviderSpecNoClassifer}:dev" def mixinProviderSpec = "${mixinProviderSpecNoClassifer}:dev"
ext.mixinProviderSpec = mixinProviderSpec
dependencies { dependencies {
if (usesMixins.toBoolean()) { if (usesMixins.toBoolean()) {
@@ -724,7 +730,7 @@ dependencies {
java17Dependencies("com.github.GTNewHorizons:lwjgl3ify:${lwjgl3ifyVersion}") java17Dependencies("com.github.GTNewHorizons:lwjgl3ify:${lwjgl3ifyVersion}")
} }
if (modId != 'hodgepodge') { if (modId != 'hodgepodge') {
java17Dependencies('com.github.GTNewHorizons:Hodgepodge:2.2.8') java17Dependencies('com.github.GTNewHorizons:Hodgepodge:2.2.13')
} }
java17PatchDependencies('net.minecraft:launchwrapper:1.15') {transitive = false} java17PatchDependencies('net.minecraft:launchwrapper:1.15') {transitive = false}
@@ -817,6 +823,18 @@ public abstract class RunHotswappableMinecraftTask extends RunMinecraftTask {
} }
this.classpath(project.java17DependenciesCfg) this.classpath(project.java17DependenciesCfg)
} }
public void setup(Project project) {
super.setup(project)
if (project.usesMixins.toBoolean()) {
this.extraJvmArgs.addAll(project.provider(() -> {
def mixinCfg = project.configurations.detachedConfiguration(project.dependencies.create(project.mixinProviderSpec))
mixinCfg.canBeConsumed = false
mixinCfg.transitive = false
enableHotswap ? ["-javaagent:" + mixinCfg.singleFile.absolutePath] : []
}))
}
}
} }
def runClient17Task = tasks.register("runClient17", RunHotswappableMinecraftTask, Distribution.CLIENT, "runClient") def runClient17Task = tasks.register("runClient17", RunHotswappableMinecraftTask, Distribution.CLIENT, "runClient")
@@ -1252,6 +1270,23 @@ if (!project.getGradle().startParameter.isOffline() && !Boolean.getBoolean('DISA
} }
} }
// If you want to add more cases to this task, implement them as arguments if total amount to print gets too large
tasks.register('faq') {
group = 'GTNH Buildscript'
description = 'Prints frequently asked questions about building a project'
doLast {
print("If your build fails to fetch dependencies, run './gradlew updateDependencies'. " +
"Or you can manually check if the versions are still on the distributing sites - " +
"the links can be found in repositories.gradle and build.gradle:repositories, " +
"but not build.gradle:buildscript.repositories - those ones are for gradle plugin metadata.\n\n" +
"If your build fails to recognize the syntax of new Java versions, enable Jabel in your " +
"gradle.properties. See how it's done in GTNH ExampleMod/gradle.properties. " +
"However, keep in mind that Jabel enables only syntax features, but not APIs that were introduced in " +
"Java 9 or later.")
}
}
static URL availableBuildScriptUrl() { static URL availableBuildScriptUrl() {
new URL("https://raw.githubusercontent.com/GTNewHorizons/ExampleMod1.7.10/master/build.gradle") new URL("https://raw.githubusercontent.com/GTNewHorizons/ExampleMod1.7.10/master/build.gradle")
} }
+2 -2
View File
@@ -1,5 +1,5 @@
dependencies { dependencies {
shadowImplementation("com.github.GTNewHorizons:ZenScript:1.0.0-GTNH") shadowImplementation("com.github.GTNewHorizons:ZenScript:1.0.0-GTNH")
implementation("net.industrial-craft:industrialcraft-2:2.2.828-experimental:dev") implementation("com.github.GTNewHorizons:NotEnoughItems:2.3.63-GTNH:dev")
implementation("com.github.GTNewHorizons:NotEnoughItems:2.3.45-GTNH:dev") compileOnly("net.industrial-craft:industrialcraft-2:2.2.828-experimental:dev")
} }
-7
View File
@@ -1,11 +1,4 @@
// Add any additional repositories for your dependencies here // Add any additional repositories for your dependencies here
repositories { repositories {
maven {
name = "GTNH Maven"
url = "http://jenkins.usrv.eu:8081/nexus/content/groups/public/"
}
maven {
url "https://cursemaven.com"
}
} }
@@ -6,20 +6,10 @@ import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method; import java.lang.reflect.Method;
import java.lang.reflect.Modifier; import java.lang.reflect.Modifier;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays;
import java.util.List; import java.util.List;
import java.util.Objects;
import java.util.function.Function;
import java.util.logging.Level; import java.util.logging.Level;
import java.util.logging.Logger; import java.util.logging.Logger;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraftforge.fluids.FluidStack;
import org.apache.logging.log4j.LogManager;
import cpw.mods.fml.common.registry.GameRegistry;
import minetweaker.annotations.BracketHandler; import minetweaker.annotations.BracketHandler;
import minetweaker.annotations.ModOnly; import minetweaker.annotations.ModOnly;
import minetweaker.api.client.IClient; import minetweaker.api.client.IClient;
@@ -27,13 +17,8 @@ import minetweaker.api.compat.*;
import minetweaker.api.event.IEventManager; import minetweaker.api.event.IEventManager;
import minetweaker.api.formatting.IFormatter; import minetweaker.api.formatting.IFormatter;
import minetweaker.api.game.IGame; import minetweaker.api.game.IGame;
import minetweaker.api.item.IIngredient;
import minetweaker.api.item.IItemStack;
import minetweaker.api.item.IngredientItem;
import minetweaker.api.mods.ILoadedMods; import minetweaker.api.mods.ILoadedMods;
import minetweaker.api.oredict.IOreDict; import minetweaker.api.oredict.IOreDict;
import minetweaker.api.oredict.IOreDictEntry;
import minetweaker.api.oredict.IngredientOreDict;
import minetweaker.api.recipes.IFurnaceManager; import minetweaker.api.recipes.IFurnaceManager;
import minetweaker.api.recipes.IRecipeManager; import minetweaker.api.recipes.IRecipeManager;
import minetweaker.api.server.IServer; import minetweaker.api.server.IServer;
@@ -65,166 +50,6 @@ import stanhebben.zenscript.type.natives.JavaMethod;
*/ */
public class MineTweakerAPI { public class MineTweakerAPI {
private static final org.apache.logging.log4j.Logger TRANSLATORLOGGER = LogManager
.getLogger("[SCRIPTS TO CODE TRANSLATOR]");
public static void info(String log) {
TRANSLATORLOGGER.info(log);
}
public static String convertStack(ItemStack stack) {
if (stack == null) return "null";
GameRegistry.UniqueIdentifier itemIdentifier = GameRegistry.findUniqueIdentifierFor(stack.getItem());
int meta = stack.getItemDamage();
int size = stack.stackSize;
NBTTagCompound tagCompound = stack.stackTagCompound;
if (tagCompound == null || tagCompound.hasNoTags()) {
return "getModItem(\"" + itemIdentifier.modId
+ "\", \""
+ itemIdentifier.name
+ "\", "
+ size
+ ", "
+ meta
+ ", missing)";
} else {
return "createItemStack(\"" + itemIdentifier.modId
+ "\", \""
+ itemIdentifier.name
+ "\", "
+ size
+ ", "
+ meta
+ ", "
+ "\""
+ tagCompound.toString().replace("\"", "\\\"")
+ "\""
+ ", missing)";
}
}
public static String convertStack(IIngredient ingredient) {
Object internal = ingredient.getInternal();
if (internal instanceof ItemStack) return convertStack((ItemStack) internal);
else return "ERRORSTACK";
}
public static String convertStackOrOre(IIngredient ingredient) {
Object internal = ingredient.getInternal();
if (internal instanceof ItemStack) return convertStack((ItemStack) internal);
else if (internal instanceof String) return "\"" + (String) internal + "\"";
else return "ERRORSTACK";
}
public static String convertArrayInLine(Object[] arr) {
StringBuilder arrayString = new StringBuilder();
for (int i = 0, arrLength = arr.length; i < arrLength; i++) {
Object o = arr[i];
if (o instanceof String) arrayString.append("\"").append((String) o).append("\"");
else if (o instanceof Character) arrayString.append("'").append((char) o).append("'");
else if (o instanceof ItemStack) arrayString.append(convertStack((ItemStack) o));
else if (o instanceof IItemStack || o instanceof IngredientItem)
arrayString.append(convertStack((IIngredient) o));
else if (o instanceof IOreDictEntry)
arrayString.append("\"").append((String) ((IOreDictEntry) o).getInternal()).append("\"");
else if (o instanceof IngredientOreDict)
arrayString.append("\"").append((String) ((IngredientOreDict) o).getInternal()).append("\"");
else if (o == null) arrayString.append("null");
else arrayString.append(o);
if (i + 1 < arrLength) arrayString.append(", ");
}
return arrayString.toString();
}
public static String convert2DArrayInLine(Object[][] arr) {
StringBuilder arrayString = new StringBuilder();
for (int i = 0, arrLength = arr.length; i < arrLength; i++) {
for (int j = 0, jarrLength = arr[i].length; j < jarrLength; j++) {
Object o = arr[i][j];
if (o instanceof String) arrayString.append("\"").append((String) o).append("\"");
else if (o instanceof Character) arrayString.append("'").append((char) o).append("'");
else if (o instanceof ItemStack) arrayString.append(convertStack((ItemStack) o));
else if (o instanceof IItemStack || o instanceof IngredientItem)
arrayString.append(convertStack((IIngredient) o));
else if (o instanceof IOreDictEntry)
arrayString.append("\"").append((String) ((IOreDictEntry) o).getInternal()).append("\"");
else if (o instanceof IngredientOreDict)
arrayString.append("\"").append((String) ((IngredientOreDict) o).getInternal()).append("\"");
else if (o == null) arrayString.append("null");
else arrayString.append(o);
if (i + 1 < arrLength || j + 1 < jarrLength) arrayString.append(", ");
}
}
return arrayString.toString();
}
public static void logGTRecipe(ItemStack[] itemInputs, ItemStack[] itemOutputs, int[] chances,
FluidStack[] fluidInputs, FluidStack[] fluidOutputs, int duration, int eut, Integer specialValue,
String recipeMapVariable) {
StringBuilder builder = new StringBuilder("GT_Values.RA.stdBuilder()");
Function<ItemStack[], ItemStack[]> isAllObjectsNullItemStack = arr -> {
if (arr == null || arr.length == 0 || Arrays.stream(arr).allMatch(Objects::isNull)) return null;
return Arrays.stream(arr).filter(Objects::nonNull).toArray(ItemStack[]::new);
};
Function<FluidStack[], FluidStack[]> isAllObjectsNullFluidStack = arr -> {
if (arr == null || arr.length == 0 || Arrays.stream(arr).allMatch(Objects::isNull)) return null;
return Arrays.stream(arr).filter(Objects::nonNull).toArray(FluidStack[]::new);
};
itemInputs = isAllObjectsNullItemStack.apply(itemInputs);
itemOutputs = isAllObjectsNullItemStack.apply(itemOutputs);
fluidInputs = isAllObjectsNullFluidStack.apply(fluidInputs);
fluidOutputs = isAllObjectsNullFluidStack.apply(fluidOutputs);
if (itemInputs == null || itemInputs.length == 0) builder.append(".noItemInputs()");
else builder.append(".itemInputs(").append(convertArrayInLine(itemInputs)).append(")");
if (itemOutputs == null || itemOutputs.length == 0) builder.append(".noItemOutputs()");
else builder.append(".itemOutputs(").append(convertArrayInLine(itemOutputs)).append(")");
if (chances != null && chances.length > 0) builder.append(".outputChances(")
.append(convertArrayInLine(Arrays.stream(chances).boxed().toArray(Integer[]::new))).append(")");
if (fluidInputs == null || fluidInputs.length == 0) builder.append(".noFluidInputs()");
else builder.append(".fluidInputs(").append(convertArrayInLine(fluidInputs)).append(")");
if (fluidOutputs == null || fluidOutputs.length == 0) builder.append(".noFluidOutputs()");
else builder.append(".fluidOutputs(").append(convertArrayInLine(fluidOutputs)).append(")");
builder.append(".duration(").append(duration).append(")");
builder.append(".eut(").append(eut).append(")");
if (specialValue != null) builder.append(".specialValue(").append(specialValue.intValue()).append(")");
builder.append(".addTo(").append(recipeMapVariable).append(");");
info(builder.toString());
}
public static void logGTRecipe(ItemStack[] itemInputs, ItemStack[] itemOutputs, FluidStack[] fluidInputs,
FluidStack[] fluidOutputs, int duration, int eut, String recipeMapVariable) {
logGTRecipe(itemInputs, itemOutputs, null, fluidInputs, fluidOutputs, duration, eut, null, recipeMapVariable);
}
public static void logGTRecipe(ItemStack[] itemInputs, ItemStack[] itemOutputs, int[] chances,
FluidStack[] fluidInputs, FluidStack[] fluidOutputs, int duration, int eut, String recipeMapVariable) {
logGTRecipe(
itemInputs,
itemOutputs,
chances,
fluidInputs,
fluidOutputs,
duration,
eut,
null,
recipeMapVariable);
}
public static void logGTRecipe(ItemStack[] itemInputs, ItemStack[] itemOutputs, FluidStack[] fluidInputs,
FluidStack[] fluidOutputs, int duration, int eut, int specialValue, String recipeMapVariable) {
logGTRecipe(
itemInputs,
itemOutputs,
null,
fluidInputs,
fluidOutputs,
duration,
eut,
specialValue,
recipeMapVariable);
}
public static final String[] COLOR_NAMES = { "White", "Orange", "Magenta", "Light Blue", "Yellow", "Lime", "Pink", public static final String[] COLOR_NAMES = { "White", "Orange", "Magenta", "Light Blue", "Yellow", "Lime", "Pink",
"Gray", "Light Gray", "Cyan", "Purple", "Blue", "Brown", "Green", "Red", "Black" }; "Gray", "Light Gray", "Cyan", "Purple", "Blue", "Brown", "Green", "Red", "Black" };
private static IJEIRecipeRegistry ijeiRecipeRegistry = new DummyJEIRecipeRegistry(); private static IJEIRecipeRegistry ijeiRecipeRegistry = new DummyJEIRecipeRegistry();
@@ -112,7 +112,6 @@ public class MCFurnaceManager implements IFurnaceManager {
public void apply() { public void apply() {
for (ItemStack item : items) { for (ItemStack item : items) {
FurnaceRecipes.smelting().getSmeltingList().remove(item); FurnaceRecipes.smelting().getSmeltingList().remove(item);
MineTweakerAPI.info("GT_ModHandler.removeFurnaceSmelting(" + MineTweakerAPI.convertStack(item) + ");");
} }
} }
@@ -162,11 +161,6 @@ public class MCFurnaceManager implements IFurnaceManager {
public void apply() { public void apply() {
for (ItemStack inputStack : input) { for (ItemStack inputStack : input) {
FurnaceRecipes.smelting().func_151394_a(inputStack, output, (float) xp); FurnaceRecipes.smelting().func_151394_a(inputStack, output, (float) xp);
MineTweakerAPI.info(
"GT_ModHandler.addSmeltingRecipe(" + MineTweakerAPI.convertStack(inputStack)
+ ", "
+ MineTweakerAPI.convertStack(output)
+ ");");
} }
} }
@@ -209,11 +203,6 @@ public class MCFurnaceManager implements IFurnaceManager {
@Override @Override
public void apply() { public void apply() {
FuelTweaker.INSTANCE.addFuelPattern(pattern); FuelTweaker.INSTANCE.addFuelPattern(pattern);
MineTweakerAPI.info(
"GT_ModHandler.setFuelValue(" + MineTweakerAPI.convertStack(pattern.getPattern())
+ ", "
+ pattern.getValue()
+ ");");
} }
@Override @Override
@@ -208,7 +208,6 @@ public class MCGame implements IGame {
} else { } else {
added = false; added = false;
} }
MineTweakerAPI.info(key + "=" + text);
} }
@Override @Override
@@ -271,11 +271,6 @@ public class MCOreDictEntry implements IOreDictEntry {
@Override @Override
public void apply() { public void apply() {
OreDictionary.registerOre(id, item); OreDictionary.registerOre(id, item);
MineTweakerAPI.info(
"OreDictionary.registerOre(\"" + OreDictionary.getOreName(id)
+ "\", "
+ MineTweakerAPI.convertStack(item)
+ ");");
} }
@Override @Override
@@ -316,17 +316,6 @@ public final class MCRecipeManager implements IRecipeManager {
toRemove = find(); toRemove = find();
removeRecipes(toRemove); removeRecipes(toRemove);
for (Pair<IIngredient, Boolean> output : outputs) {
if (output.getKey().getInternal() instanceof String) MineTweakerAPI
.info("removeRecipeByOreOutputDelayed(\"" + ((String) output.getKey().getInternal()) + "\")");
else MineTweakerAPI.info(
"GT_ModHandler.removeRecipeByOutputDelayed(" + MineTweakerAPI.convertStack(output.getKey())
+ ", "
+ (output.getValue() ? "false" : "true")
+ ", false, true);");
}
} }
@Override @Override
@@ -451,14 +440,6 @@ public final class MCRecipeManager implements IRecipeManager {
toRemove = find(); toRemove = find();
MineTweakerAPI.logInfo("Removing " + toRemove.size() + " Shapeless recipes."); MineTweakerAPI.logInfo("Removing " + toRemove.size() + " Shapeless recipes.");
super.removeRecipes(toRemove); super.removeRecipes(toRemove);
if (ingredients == null || ingredients.length == 0)
MineTweakerAPI.info("removeRecipeShapeless(" + MineTweakerAPI.convertStackOrOre(output) + ");");
else MineTweakerAPI.info(
"removeRecipeShapeless(" + MineTweakerAPI.convertStackOrOre(output)
+ ", "
+ MineTweakerAPI.convertArrayInLine(ingredients)
+ ");");
} }
@Override @Override
@@ -573,21 +554,6 @@ public final class MCRecipeManager implements IRecipeManager {
MineTweakerAPI.logInfo(toRemove.size() + " removed"); MineTweakerAPI.logInfo(toRemove.size() + " removed");
super.removeRecipes(toRemove); super.removeRecipes(toRemove);
if (ingredients == null || ingredients.length == 0)
MineTweakerAPI.info("removeRecipeShaped(" + MineTweakerAPI.convertStackOrOre(output) + ");");
else MineTweakerAPI.info(
"removeRecipeShaped(" + MineTweakerAPI.convertStackOrOre(output)
+ ", new Object[]{"
+ MineTweakerAPI.convertArrayInLine(ingredients[0])
+ "}"
+ (ingredients.length >= 2
? (", new Object[]{" + MineTweakerAPI.convertArrayInLine(ingredients[1]) + "}")
: ", new Object[0]")
+ (ingredients.length >= 3
? (", new Object[]{" + MineTweakerAPI.convertArrayInLine(ingredients[2]) + "}")
: ", new Object[0]")
+ ");");
} }
@Override @Override
@@ -692,50 +658,17 @@ public final class MCRecipeManager implements IRecipeManager {
private static class ActionAddShapedRecipe extends ActionBaseAddRecipe { private static class ActionAddShapedRecipe extends ActionBaseAddRecipe {
IItemStack aOutput;
IIngredient[][] aIngredients;
boolean aMirrored;
public ActionAddShapedRecipe(IItemStack output, IIngredient[][] ingredients, IRecipeFunction function, public ActionAddShapedRecipe(IItemStack output, IIngredient[][] ingredients, IRecipeFunction function,
IRecipeAction action, boolean mirrored) { IRecipeAction action, boolean mirrored) {
super(new ShapedRecipe(output, ingredients, function, action, mirrored), output, true); super(new ShapedRecipe(output, ingredients, function, action, mirrored), output, true);
aOutput = output;
aIngredients = ingredients;
aMirrored = mirrored;
}
@Override
public void apply() {
super.apply();
MineTweakerAPI.info(
"addShapedRecipe(" + MineTweakerAPI.convertStack(aOutput)
+ ", new Object[] {"
+ MineTweakerAPI.convert2DArrayInLine(aIngredients)
+ "});");
} }
} }
private static class ActionAddShapelessRecipe extends ActionBaseAddRecipe { private static class ActionAddShapelessRecipe extends ActionBaseAddRecipe {
IItemStack aOutput;
IIngredient[] aIngredients;
public ActionAddShapelessRecipe(IItemStack output, IIngredient[] ingredients, IRecipeFunction function, public ActionAddShapelessRecipe(IItemStack output, IIngredient[] ingredients, IRecipeFunction function,
IRecipeAction action) { IRecipeAction action) {
super(new ShapelessRecipe(output, ingredients, function, action), output, false); super(new ShapelessRecipe(output, ingredients, function, action), output, false);
aOutput = output;
aIngredients = ingredients;
}
@Override
public void apply() {
super.apply();
MineTweakerAPI.info(
"addShapelessCraftingRecipe(" + MineTweakerAPI.convertStack(aOutput)
+ ", new Object[] { "
+ MineTweakerAPI.convertArrayInLine(aIngredients)
+ " });");
} }
} }
@@ -786,7 +719,7 @@ public final class MCRecipeManager implements IRecipeManager {
recipes.removeIf(recipesToUndo::contains); recipes.removeIf(recipesToUndo::contains);
} }
int commonPoolParallelism = getCommonPoolParallelism(); int commonPoolParallelism = getCommonPoolParallelism();
if (true) { if (commonPoolParallelism <= 1) {
// if thread == 1, then we have parallel overhead but doesn't have parallel speedup. // if thread == 1, then we have parallel overhead but doesn't have parallel speedup.
// never do this // never do this
recipesToRemove.forEach(ActionBaseRemoveRecipes::apply); recipesToRemove.forEach(ActionBaseRemoveRecipes::apply);
@@ -1,6 +1,7 @@
package minetweaker.mods.ic2.crops; package minetweaker.mods.ic2.crops;
import ic2.api.crops.CropCard; import ic2.api.crops.CropCard;
import minetweaker.annotations.ModOnly;
import stanhebben.zenscript.annotations.ZenCaster; import stanhebben.zenscript.annotations.ZenCaster;
import stanhebben.zenscript.annotations.ZenClass; import stanhebben.zenscript.annotations.ZenClass;
import stanhebben.zenscript.annotations.ZenGetter; import stanhebben.zenscript.annotations.ZenGetter;
@@ -13,6 +14,7 @@ import stanhebben.zenscript.annotations.ZenMethod;
* *
*/ */
@ZenClass("mods.ic2.Crop") @ZenClass("mods.ic2.Crop")
@ModOnly("IC2")
public class Crop { public class Crop {
private CropCard cc; private CropCard cc;
@@ -1,5 +1,6 @@
package minetweaker.mods.ic2.crops; package minetweaker.mods.ic2.crops;
import minetweaker.annotations.ModOnly;
import minetweaker.api.item.IItemStack; import minetweaker.api.item.IItemStack;
import stanhebben.zenscript.annotations.ZenClass; import stanhebben.zenscript.annotations.ZenClass;
import stanhebben.zenscript.annotations.ZenGetter; import stanhebben.zenscript.annotations.ZenGetter;
@@ -12,6 +13,7 @@ import stanhebben.zenscript.annotations.ZenSetter;
* *
*/ */
@ZenClass("mods.ic2.GrowthRequirements") @ZenClass("mods.ic2.GrowthRequirements")
@ModOnly("IC2")
public class GrowthRequirements { public class GrowthRequirements {
private int minNutrients; private int minNutrients;
@@ -9,6 +9,7 @@ import cpw.mods.fml.relauncher.SideOnly;
import ic2.api.crops.CropCard; import ic2.api.crops.CropCard;
import ic2.api.crops.ICropTile; import ic2.api.crops.ICropTile;
import minetweaker.MineTweakerAPI; import minetweaker.MineTweakerAPI;
import minetweaker.annotations.ModOnly;
import minetweaker.api.item.IItemStack; import minetweaker.api.item.IItemStack;
import minetweaker.api.minecraft.MineTweakerMC; import minetweaker.api.minecraft.MineTweakerMC;
import stanhebben.zenscript.annotations.ZenClass; import stanhebben.zenscript.annotations.ZenClass;
@@ -29,6 +30,7 @@ import stanhebben.zenscript.annotations.ZenSetter;
* *
*/ */
@ZenClass("mods.ic2.SyntheticCrop") @ZenClass("mods.ic2.SyntheticCrop")
@ModOnly("IC2")
public class SyntheticCrop extends CropCard { public class SyntheticCrop extends CropCard {
private String name; private String name;
@@ -4,8 +4,6 @@ import static minetweaker.api.minecraft.MineTweakerMC.getIItemStack;
import static minetweaker.api.minecraft.MineTweakerMC.getItemStack; import static minetweaker.api.minecraft.MineTweakerMC.getItemStack;
import static minetweaker.api.minecraft.MineTweakerMC.getItemStacks; import static minetweaker.api.minecraft.MineTweakerMC.getItemStacks;
import net.minecraft.item.ItemStack;
import ic2.api.recipe.RecipeOutput; import ic2.api.recipe.RecipeOutput;
import ic2.api.recipe.Recipes; import ic2.api.recipe.Recipes;
import minetweaker.MineTweakerAPI; import minetweaker.MineTweakerAPI;
@@ -46,22 +44,7 @@ public class Compressor {
Recipes.compressor, Recipes.compressor,
getItemStacks(output), getItemStacks(output),
null, null,
new IC2RecipeInput(ingredient)) { new IC2RecipeInput(ingredient)));
@Override
public void apply() {
super.apply();
MineTweakerAPI.logGTRecipe(
new ItemStack[] { new IC2RecipeInput(ingredient).getInputs().get(0) },
new ItemStack[] { getItemStack(output) },
null,
null,
300,
2,
"sCompressorRecipes");
}
});
} }
} }
@@ -9,8 +9,6 @@ import static minetweaker.api.minecraft.MineTweakerMC.getIItemStack;
import static minetweaker.api.minecraft.MineTweakerMC.getItemStack; import static minetweaker.api.minecraft.MineTweakerMC.getItemStack;
import static minetweaker.api.minecraft.MineTweakerMC.getItemStacks; import static minetweaker.api.minecraft.MineTweakerMC.getItemStacks;
import net.minecraft.item.ItemStack;
import ic2.api.recipe.RecipeOutput; import ic2.api.recipe.RecipeOutput;
import ic2.api.recipe.Recipes; import ic2.api.recipe.Recipes;
import minetweaker.MineTweakerAPI; import minetweaker.MineTweakerAPI;
@@ -51,22 +49,7 @@ public class Extractor {
Recipes.extractor, Recipes.extractor,
getItemStacks(output), getItemStacks(output),
null, null,
new IC2RecipeInput(ingredient)) { new IC2RecipeInput(ingredient)));
@Override
public void apply() {
super.apply();
MineTweakerAPI.logGTRecipe(
new ItemStack[] { new IC2RecipeInput(ingredient).getInputs().get(0) },
new ItemStack[] { getItemStack(output) },
null,
null,
300,
2,
"sExtractorRecipes");
}
});
} }
} }
@@ -74,7 +74,6 @@ public class NEI {
@Override @Override
public void apply() { public void apply() {
API.addItemListEntry(item); API.addItemListEntry(item);
MineTweakerAPI.info("API.addItemListEntry(" + MineTweakerAPI.convertStack(item) + ");");
} }
@Override @Override
@@ -114,7 +113,6 @@ public class NEI {
@Override @Override
public void apply() { public void apply() {
API.hideItem(stack); API.hideItem(stack);
MineTweakerAPI.info("API.hideItem(" + MineTweakerAPI.convertStack(stack) + ");");
} }
@Override @Override
@@ -156,7 +154,6 @@ public class NEI {
@Override @Override
public void apply() { public void apply() {
API.setOverrideName(item, name); API.setOverrideName(item, name);
MineTweakerAPI.info("API.setOverrideName(" + MineTweakerAPI.convertStack(item) + ", \"" + name + "\");");
} }
@Override @Override