From 34646419362b3b2a5a26d77310dada90bce8fa77 Mon Sep 17 00:00:00 2001 From: Alkalus <3060479+draknyte1@users.noreply.github.com> Date: Sun, 19 Jan 2020 14:56:21 +0000 Subject: $ Fixed inner class lookup in ReflectionUtils. $ Can't patch LWJGL's Keyboard class, so now I patch ClientSettings. --- .../core/util/reflect/ReflectionUtils.java | 81 ++++++++++++---------- 1 file changed, 44 insertions(+), 37 deletions(-) (limited to 'src/Java/gtPlusPlus/core') diff --git a/src/Java/gtPlusPlus/core/util/reflect/ReflectionUtils.java b/src/Java/gtPlusPlus/core/util/reflect/ReflectionUtils.java index 135f98dd17..4d8a02d800 100644 --- a/src/Java/gtPlusPlus/core/util/reflect/ReflectionUtils.java +++ b/src/Java/gtPlusPlus/core/util/reflect/ReflectionUtils.java @@ -43,7 +43,7 @@ public class ReflectionUtils { } } - + private static class CachedMethod { private final boolean STATIC; @@ -134,7 +134,7 @@ public class ReflectionUtils { return false; } - + /** * Returns a cached {@link Constructor} object. * @param aClass - Class containing the Constructor. @@ -145,7 +145,7 @@ public class ReflectionUtils { if (aClass == null || aTypes == null) { return null; } - + String aMethodKey = ArrayUtils.toString(aTypes); //Logger.REFLECTION("Looking up method in cache: "+(aClass.getName()+"."+aMethodName + "." + aMethodKey)); CachedConstructor y = mCachedConstructors.get(aClass.getName() + "." + aMethodKey); @@ -162,9 +162,9 @@ public class ReflectionUtils { return y.get(); } } - - - + + + /** * Returns a cached {@link Class} object. @@ -227,14 +227,14 @@ public class ReflectionUtils { return y.get(); } } - + public static boolean isStaticMethod(Class aClass, String aMethodName, Class... aTypes) { return isStaticMethod(ReflectionUtils.getMethod(aClass, aMethodName, aTypes)); } - + public static boolean isStaticMethod(Method aMethod) { if (aMethod != null && Modifier.isStatic(aMethod.getModifiers())) { - return true; + return true; } return false; } @@ -467,7 +467,7 @@ public class ReflectionUtils { Logger.REFLECTION("Invoke failed or did something wrong."); return false; } - + public static boolean invoke(Object objectInstance, Method method, Object[] values){ if (method == null || values == null || (!ReflectionUtils.isStaticMethod(method) && objectInstance == null)){ //Logger.REFLECTION("Null value when trying to Dynamically invoke "+methodName+" on an object of type: "+objectInstance.getClass().getName()); @@ -774,7 +774,7 @@ public class ReflectionUtils { } return m; } - + private static Constructor getConstructor_Internal(Class aClass, Class... aTypes) { Constructor c = null; try { @@ -801,7 +801,7 @@ public class ReflectionUtils { } return c; } - + private static Constructor getConstructorRecursively(Class aClass, Class... aTypes) throws Exception { try { Logger.REFLECTION("Constructor: Recursion Lookup: "+aClass.getName()); @@ -921,31 +921,40 @@ public class ReflectionUtils { aClassName += (i > 0) ? "."+aData[i] : ""+aData[i]; Logger.REFLECTION("Building: "+aClassName); } - Logger.REFLECTION("Trying to search '"+aClassName+"' for inner classes."); - Class clazz = ReflectionUtils.getClass(aClassName); - - Class[] y = clazz.getDeclaredClasses(); - if (y == null || y.length <= 0) { - Logger.REFLECTION("No hidden inner classes found."); - return null; - } - else { - boolean found = false; - for (Class h : y) { - Logger.REFLECTION("Found hidden inner class: "+h.getCanonicalName()); - if (h.getSimpleName().toLowerCase().equals(aData[aData.length-1].toLowerCase())) { - Logger.REFLECTION("Found correct class. ["+aData[aData.length-1]+"] Caching at correct location: "+string); - Logger.REFLECTION("Found at location: "+h.getCanonicalName()); - ReflectionUtils.mCachedClasses.put(string, h); - aClass = h; - found = true; - break; + if (aClassName != null && aClassName.length() > 0) { + Logger.REFLECTION("Trying to search '"+aClassName+"' for inner classes."); + Class clazz = ReflectionUtils.getClass(aClassName); + if (clazz != null) { + Class[] y = clazz.getDeclaredClasses(); + if (y == null || y.length <= 0) { + Logger.REFLECTION("No hidden inner classes found."); + return null; + } + else { + boolean found = false; + for (Class h : y) { + Logger.REFLECTION("Found hidden inner class: "+h.getCanonicalName()); + if (h.getSimpleName().toLowerCase().equals(aData[aData.length-1].toLowerCase())) { + Logger.REFLECTION("Found correct class. ["+aData[aData.length-1]+"] Caching at correct location: "+string); + Logger.REFLECTION("Found at location: "+h.getCanonicalName()); + ReflectionUtils.mCachedClasses.put(string, h); + aClass = h; + found = true; + break; + } + } + if (!found) { + return null; + } } } - if (!found) { + else { return null; } } + else { + return null; + } } return aClass; } @@ -964,11 +973,9 @@ public class ReflectionUtils { */ private static void makeModifiable(Field nameField) throws Exception { nameField.setAccessible(true); - int modifiers = nameField.getModifiers(); - Field modifierField = nameField.getClass().getDeclaredField("modifiers"); - modifiers = modifiers & ~Modifier.FINAL; - modifierField.setAccessible(true); - modifierField.setInt(nameField, modifiers); + Field modifiers = getField(Field.class, "modifiers"); + modifiers.setAccessible(true); + modifiers.setInt(nameField, nameField.getModifiers() & ~Modifier.FINAL); } -- cgit From 5dd32bc8a506dca9507923ab3b35ab0460365f91 Mon Sep 17 00:00:00 2001 From: botn365 <42187820+botn365@users.noreply.github.com> Date: Sat, 1 Feb 2020 00:49:00 +0100 Subject: $ Fixes by Bot $ Fix dissasembler not consumin energy $ Fix where having empty input busses would stop busses from working $ Fix volcanus giving back wrong tempreture $ Fix mixer not working $ Fix maragin 250 and 300 not having a recipe --- src/Java/gtPlusPlus/core/recipe/RECIPES_GREGTECH.java | 1 + .../xmod/gregtech/common/StaticFields59.java | 18 +++++++++--------- .../GregtechMetaTileEntity_IndustrialMixer.java | 7 ++++--- .../GregtechMetaTileEntity_IndustrialMultiMachine.java | 7 ++++--- .../multi/production/GT4Entity_AutoCrafter.java | 17 +++++++++++++++-- 5 files changed, 33 insertions(+), 17 deletions(-) (limited to 'src/Java/gtPlusPlus/core') diff --git a/src/Java/gtPlusPlus/core/recipe/RECIPES_GREGTECH.java b/src/Java/gtPlusPlus/core/recipe/RECIPES_GREGTECH.java index f1676689e7..69bd414d9c 100644 --- a/src/Java/gtPlusPlus/core/recipe/RECIPES_GREGTECH.java +++ b/src/Java/gtPlusPlus/core/recipe/RECIPES_GREGTECH.java @@ -701,6 +701,7 @@ public class RECIPES_GREGTECH { //NITINOL_60 CORE.RA.addBlastSmelterRecipe( new ItemStack[] { + ItemUtils.getGregtechCircuit(2), ELEMENT.getInstance().TITANIUM.getDust(3), ELEMENT.getInstance().NICKEL.getDust(2) }, diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/StaticFields59.java b/src/Java/gtPlusPlus/xmod/gregtech/common/StaticFields59.java index 74e269e932..2891741b2c 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/StaticFields59.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/StaticFields59.java @@ -258,31 +258,31 @@ public class StaticFields59 { public static int getHeatingCapacityForCoilTier(int aCoilTier) { int mHeatingCapacity = 0; switch (aCoilTier) { - case 1: + case 0: mHeatingCapacity = 1800; break; - case 2: + case 1: mHeatingCapacity = 2700; break; - case 3: + case 2: mHeatingCapacity = 3600; break; - case 4: + case 3: mHeatingCapacity = 4500; break; - case 5: + case 4: mHeatingCapacity = 5400; break; - case 6: + case 5: mHeatingCapacity = 7200; break; - case 7: + case 6: mHeatingCapacity = 9000; break; - case 8: + case 7: mHeatingCapacity = 9900; break; - case 9: + case 8: mHeatingCapacity = 10800; break; default: diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialMixer.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialMixer.java index 0c7067b3c0..358a8eec66 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialMixer.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialMixer.java @@ -121,15 +121,16 @@ extends GregtechMeta_MultiBlockBase { if (tBus.getBaseMetaTileEntity().getStackInSlot(i) != null) tBusItems.add(tBus.getBaseMetaTileEntity().getStackInSlot(i)); } - } + } ItemStack[] inputs = new ItemStack[tBusItems.size()]; int slot = 0; for (ItemStack g : tBusItems) { inputs[slot++] = g; } if (inputs.length > 0) { - log("Recipe. ["+inputs.length+"]["+getMaxParallelRecipes()+"]"); - if (checkRecipeGeneric(inputs, (FluidStack[]) ArrayUtils.getArrayFromArrayList(this.getStoredFluids()), getMaxParallelRecipes(), getEuDiscountForParallelism(), 250, 10000)) { + log("Recipe. ["+inputs.length+"]["+getMaxParallelRecipes()+"]"); + FluidStack[] fluid = this.getStoredFluids().toArray(new FluidStack[] {}); + if (checkRecipeGeneric(inputs,fluid , getMaxParallelRecipes(), getEuDiscountForParallelism(), 250, 10000)) { log("Recipe 2."); return true; } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialMultiMachine.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialMultiMachine.java index 05aec14500..caf694669c 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialMultiMachine.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialMultiMachine.java @@ -330,9 +330,10 @@ extends GregtechMeta_MultiBlockBase { long tVoltage = getMaxInputVoltage(); byte tTier = (byte) Math.max(1, GT_Utility.getTier(tVoltage)); - - - GT_Recipe tRecipe = this.getRecipeMap(tCircuit).findRecipe( + GT_Recipe.GT_Recipe_Map tRecipeMap = this.getRecipeMap(tCircuit); + if (tRecipeMap == null) + return false; + GT_Recipe tRecipe = tRecipeMap.findRecipe( getBaseMetaTileEntity(), this.mLastRecipeExtended[tCircuitID], false, gregtech.api.enums.GT_Values.V[tTier], aFluidInputs, aItemInputs); diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GT4Entity_AutoCrafter.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GT4Entity_AutoCrafter.java index 9754eebbb8..b8e6d0c252 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GT4Entity_AutoCrafter.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GT4Entity_AutoCrafter.java @@ -197,6 +197,7 @@ public class GT4Entity_AutoCrafter extends GregtechMeta_MultiBlockBase { return false; } // mInventoryCrafter = new CraftingHelper(this); + setTier(); return tAmount >= 10; } @@ -225,7 +226,7 @@ public class GT4Entity_AutoCrafter extends GregtechMeta_MultiBlockBase { } catch (IllegalArgumentException | IllegalAccessException e) { } } - else if (this.mMachineMode == MODE.DISASSEMBLY) { + else if (this.mMachineMode == MODE.DISASSEMBLY || this.mMachineMode == MODE.CRAFTING) { return null; } return GT_Recipe.GT_Recipe_Map.sAssemblerRecipes; @@ -285,6 +286,11 @@ public class GT4Entity_AutoCrafter extends GregtechMeta_MultiBlockBase { // } // } + private void setTier() { + long tVoltage = getMaxInputVoltage(); + this.mTier = (byte) Math.max(1, GT_Utility.getTier(tVoltage)); + } + @Override public boolean checkRecipe(final ItemStack aStack) { if (mMachineMode == MODE.DISASSEMBLY) { @@ -296,7 +302,6 @@ public class GT4Entity_AutoCrafter extends GregtechMeta_MultiBlockBase { //Logger.MACHINE_INFO("1"); for (GT_MetaTileEntity_Hatch_InputBus tBus : mInputBusses) { ArrayList tBusItems = new ArrayList(); - tBus.mRecipeMap = getRecipeMap(); //Logger.MACHINE_INFO("2"); if (isValidMetaTileEntity(tBus)) { //Logger.MACHINE_INFO("3"); @@ -380,6 +385,10 @@ public class GT4Entity_AutoCrafter extends GregtechMeta_MultiBlockBase { if (this.mTier > 5) { this.mMaxProgresstime >>= this.mTier - 5; } + if (this.mEUt > 0) + this.mEUt = (-this.mEUt); + this.mEfficiency = (10000 - (getIdealStatus() - getRepairStatus()) * 1000); + this.mEfficiencyIncrease = 10000; inputItem.stackSize--; if (inputItem.stackSize <= 0) { tInputs[0] = null; @@ -508,6 +517,10 @@ public class GT4Entity_AutoCrafter extends GregtechMeta_MultiBlockBase { if (this.mTier > 5) { this.mMaxProgresstime >>= this.mTier - 5; } + if (this.mEUt > 0) + this.mEUt = (-this.mEUt); + this.mEfficiency = (10000 - (getIdealStatus() - getRepairStatus()) * 1000); + this.mEfficiencyIncrease = 10000; if (mCorrectInputs == 9) { ItemStack mOutputItem = storedData_Output[0]; -- cgit From 0678527ea975b4a95eb7f3d6547b79865b0a2a0e Mon Sep 17 00:00:00 2001 From: Alkalus <3060479+draknyte1@users.noreply.github.com> Date: Sun, 2 Feb 2020 23:18:44 +0000 Subject: + Added class to generate Obfuscation Dictionaries. + Added all libraries required for Proguard to Obfuscate future builds. - Removed Dev/Src releases. % Adjusted build.gradle to accommodate DictGen + Proguard. --- build.gradle | 34 ++--- src/Java/gtPlusPlus/GenerateDictionaries.java | 176 ++++++++++++++++++++++ src/Java/gtPlusPlus/core/util/data/FileUtils.java | 33 +++- src/Java/speiger/src/crops/api/ICropCardInfo.java | 12 -- 4 files changed, 220 insertions(+), 35 deletions(-) create mode 100644 src/Java/gtPlusPlus/GenerateDictionaries.java delete mode 100644 src/Java/speiger/src/crops/api/ICropCardInfo.java (limited to 'src/Java/gtPlusPlus/core') diff --git a/build.gradle b/build.gradle index f25a954dd4..ab5fec70de 100644 --- a/build.gradle +++ b/build.gradle @@ -20,6 +20,7 @@ buildscript { } dependencies { classpath "net.minecraftforge.gradle:ForgeGradle:1.2-SNAPSHOT" + classpath 'net.sf.proguard:proguard-gradle:6.2.2' //classpath "gradle.plugin.se.bjurr.gitchangelog:git-changelog-gradle-plugin:1.55" } } @@ -171,22 +172,18 @@ jar { } } -task sourceJar(type: Jar) { - from sourceSets.main.allSource - classifier = 'sources' - manifest { - attributes 'FMLCorePlugin': 'gtPlusPlus.preloader.asm.Preloader_FMLLoadingPlugin' - attributes 'FMLCorePluginContainsFMLMod': 'true' - } +task generateDictionaries(type: JavaExec) { + group = "Execution" + description = "Generates the dictionaries for Proguard" + classpath = sourceSets.main.runtimeClasspath + main = "gtPlusPlus.GenerateDictionaries" } -task devJar(type: Jar) { - from sourceSets.main.output - classifier = 'dev' - manifest { - attributes 'FMLCorePlugin': 'gtPlusPlus.preloader.asm.Preloader_FMLLoadingPlugin' - attributes 'FMLCorePluginContainsFMLMod': 'true' - } +// Define a ProGuard task. +task proguard(type: proguard.gradle.ProGuardTask) { + configuration 'proguard.txt' + injars "build/libs/"+archivesBaseName + "-" + version + ".jar" + outjars "build/libs/"+archivesBaseName + "-" + version + "-obf.jar" } //task discordChangelogTask(type: se.bjurr.gitchangelog.plugin.gradle.GitChangelogTask) { @@ -211,10 +208,11 @@ task devJar(type: Jar) { //templateContent = file('changelogcurse.mustache').getText('UTF-8') //} -artifacts { - archives devJar - archives sourceJar -} +// Generate Dicts for Proguard obfuscation +build.finalizedBy(generateDictionaries) + +// Obfuscate this bitch. +//build.finalizedBy(proguard) // Disabled until optimization is working 100% //build.finalizedBy(gitChangelogTask) //build.finalizedBy(curseChangelogTask) diff --git a/src/Java/gtPlusPlus/GenerateDictionaries.java b/src/Java/gtPlusPlus/GenerateDictionaries.java new file mode 100644 index 0000000000..abdf4f4027 --- /dev/null +++ b/src/Java/gtPlusPlus/GenerateDictionaries.java @@ -0,0 +1,176 @@ +package gtPlusPlus; + +import java.io.File; +import java.io.IOException; +import java.nio.charset.Charset; +import java.nio.charset.StandardCharsets; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.nio.file.StandardOpenOption; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; +import java.util.Random; + +import gtPlusPlus.api.objects.random.XSTR; + +public class GenerateDictionaries { + + public static void main(String[] args) { + + File aMainDictionary = new File("proguard/DictionaryMain.txt"); + File aMethodDict = new File("proguard/method-dict.txt"); + File aClassDict = new File("proguard/class-dict.txt"); + + if (Utils.doesFileExist(aMainDictionary)) { + Utils.log("Found Main Dictionary"); + List aLines = Utils.readLines(aMainDictionary); + + ArrayList aLinesToWriteMethods = new ArrayList(); + ArrayList aLinesToWriteClasses = new ArrayList(); + + if (aLines != null && aLines.size() > 0) { + Utils.log("Main Dictionary has > 0 keywords ("+aLines.size()+")"); + HashSet aUsedIndicies = new HashSet(); + int aCount = aLines.size() / 5; + + Utils.log("Mapping "+aCount+" to each dict."); + // Map New Method Names + for (int i=0;aLinesToWriteMethods.size() 0) { + aLinesToWriteMethods.add(aLineAtIndex); + aUsedIndicies.add(aIndex); + } + } + if (i >= aCount * 5) { + break; + } + } + + // Map New Class Names + for (int i=0;aLinesToWriteClasses.size() 0) { + aLinesToWriteClasses.add(aLineAtIndex); + aUsedIndicies.add(aIndex); + } + } + if (i >= aCount * 5) { + break; + } + } + } + + // Remove old generated Dicts + if (Utils.doesFileExist(aMethodDict)) { + aMethodDict.delete(); + Utils.log("Removed old Method-Dict"); + } + if (Utils.doesFileExist(aClassDict)) { + aClassDict.delete(); + Utils.log("Removed old Class-Dict"); + } + + // Create new empty dict files + if (!Utils.doesFileExist(aMethodDict)) { + Utils.createFile(aMethodDict); + } + if (!Utils.doesFileExist(aClassDict)) { + Utils.createFile(aClassDict); + } + + Utils.log("Writing new Dictionaries."); + // Write + Utils.appendListToFile(aMethodDict, aLinesToWriteMethods); + Utils.appendListToFile(aClassDict, aLinesToWriteClasses); + + Utils.log("Finished all generation of new Dictionaries."); + + } + + } + + + + private static final class Utils { + + private static final Charset utf8 = StandardCharsets.UTF_8; + private static final Random rand = new XSTR(); + + private static final void log(String s) { + System.out.println("[GTPP-Proguard] "+s); + } + + public static int randInt(final int min, final int max) { + return rand.nextInt((max - min) + 1) + min; + } + + public static boolean doesFileExist(File f) { + if (f != null && f.exists() && !f.isDirectory()) { + return true; + } + return false; + } + + public static File createFile(File aFile) { + boolean blnCreated = false; + log("Trying to use relative path "+aFile.getPath()); + try { + //log("Trying to use path "+aFile.getCanonicalPath()); + //log("Trying to use absolute path "+aFile.getAbsolutePath()); + blnCreated = aFile.createNewFile(); + } catch (IOException ioe) { + log("Error while creating a new empty file :" + ioe); + return null; + } + return blnCreated ? aFile : null; + } + + public static boolean appendListToFile(File file, List content) { + try { + long oldSize; + long newSize; + if (doesFileExist(file)) { + Path p = Paths.get(file.getPath()); + if (p != null && Files.isWritable(p)) { + oldSize = Files.size(p); + try { + Files.write(p, content, utf8, StandardOpenOption.APPEND); + } catch (IOException e) { + e.printStackTrace(); + } + newSize = Files.size(p); + return newSize > oldSize; + } + } + } catch (IOException e) { + } + return false; + } + + /** + * Reads the contents of a file line by line to a List of Strings using the default encoding for the VM. + * The file is always closed. + * + * @param file the file to read, must not be {@code null} + * @return the list of Strings representing each line in the file, never {@code null} + * @throws IOException in case of an I/O error + * @since 1.3 + */ + public static List readLines(File file) { + try { + return org.apache.commons.io.FileUtils.readLines(file, utf8); + } + catch (IOException e) { + return new ArrayList(); + } + } + } + +} diff --git a/src/Java/gtPlusPlus/core/util/data/FileUtils.java b/src/Java/gtPlusPlus/core/util/data/FileUtils.java index d7d6b9e36e..bec5e0eeff 100644 --- a/src/Java/gtPlusPlus/core/util/data/FileUtils.java +++ b/src/Java/gtPlusPlus/core/util/data/FileUtils.java @@ -8,6 +8,7 @@ import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; import java.nio.file.StandardOpenOption; +import java.util.ArrayList; import java.util.List; import gtPlusPlus.api.objects.Logger; @@ -26,17 +27,21 @@ public class FileUtils { public static File createFile(String path, String filename, String extension) { File file = new File(Utils.getMcDir(), path + filename + extension); + return createFile(file); + } + + public static File createFile(File aFile) { boolean blnCreated = false; - Logger.INFO("Trying to use path "+file.getPath()); + Logger.INFO("Trying to use path "+aFile.getPath()); try { - Logger.INFO("Trying to use path "+file.getCanonicalPath()); - Logger.INFO("Trying to use absolute path "+file.getAbsolutePath()); - blnCreated = file.createNewFile(); + Logger.INFO("Trying to use path "+aFile.getCanonicalPath()); + Logger.INFO("Trying to use absolute path "+aFile.getAbsolutePath()); + blnCreated = aFile.createNewFile(); } catch (IOException ioe) { Logger.INFO("Error while creating a new empty file :" + ioe); return null; } - return blnCreated ? file : null; + return blnCreated ? aFile : null; } public static File getFile(String filename, String extension) { @@ -92,4 +97,22 @@ public class FileUtils { } return false; } + + /** + * Reads the contents of a file line by line to a List of Strings using the default encoding for the VM. + * The file is always closed. + * + * @param file the file to read, must not be {@code null} + * @return the list of Strings representing each line in the file, never {@code null} + * @throws IOException in case of an I/O error + * @since 1.3 + */ + public static List readLines(File file) { + try { + return org.apache.commons.io.FileUtils.readLines(file, utf8); + } + catch (IOException e) { + return new ArrayList(); + } + } } diff --git a/src/Java/speiger/src/crops/api/ICropCardInfo.java b/src/Java/speiger/src/crops/api/ICropCardInfo.java deleted file mode 100644 index ff67eb06b1..0000000000 --- a/src/Java/speiger/src/crops/api/ICropCardInfo.java +++ /dev/null @@ -1,12 +0,0 @@ -package speiger.src.crops.api; - -import java.util.List; -import net.minecraft.item.ItemStack; - -public interface ICropCardInfo { - - List getCropInformation(); - - ItemStack getDisplayItem(); - -} \ No newline at end of file -- cgit