mirror of
https://github.com/GTNewHorizons/CraftTweaker.git
synced 2026-11-19 03:39:17 +00:00
- Added 1.7.10 Buildcraft support
- Exceptions can now log to the minetweaker log, for easier bug resolution - /mt hand now copies to the clipboard too - /mt hand now outputs ore dictionary entries to which it belongs - Reducing verbosity a bit
This commit is contained in:
1 parent
86a3568e9e
commit
a8aae17d8a
29 files changed
+1289
-24
No files matched your search
@@ -1,5 +1,7 @@
|
||||
package minetweaker.api.item;
|
||||
|
||||
import java.util.List;
|
||||
import minetweaker.api.oredict.IOreDictEntry;
|
||||
import stanhebben.zenscript.annotations.Optional;
|
||||
import stanhebben.zenscript.annotations.ZenClass;
|
||||
import stanhebben.zenscript.annotations.ZenGetter;
|
||||
@@ -40,4 +42,13 @@ public interface IItemDefinition {
|
||||
*/
|
||||
@ZenMethod
|
||||
public IItemStack makeStack(@Optional int meta);
|
||||
|
||||
/**
|
||||
* Returns all ore entries containing this item. Also contains ore entries
|
||||
* that refer to a specific sub-item.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@ZenGetter("ores")
|
||||
public List<IOreDictEntry> getOres();
|
||||
}
|
||||
@@ -1,8 +1,10 @@
|
||||
package minetweaker.api.item;
|
||||
|
||||
import java.util.List;
|
||||
import minetweaker.api.block.IBlock;
|
||||
import minetweaker.api.data.IData;
|
||||
import minetweaker.api.liquid.ILiquidStack;
|
||||
import minetweaker.api.oredict.IOreDictEntry;
|
||||
import stanhebben.zenscript.annotations.OperatorType;
|
||||
import stanhebben.zenscript.annotations.ZenCaster;
|
||||
import stanhebben.zenscript.annotations.ZenClass;
|
||||
@@ -180,4 +182,13 @@ public interface IItemStack extends IIngredient {
|
||||
*/
|
||||
@ZenCaster
|
||||
public IBlock asBlock();
|
||||
|
||||
/**
|
||||
* Retrieves all the ores referring to this item. Includes wildcard ore
|
||||
* entries.
|
||||
*
|
||||
* @return ore entries containing this item stack
|
||||
*/
|
||||
@ZenGetter("ores")
|
||||
public List<IOreDictEntry> getOres();
|
||||
}
|
||||
@@ -11,6 +11,7 @@ import java.io.FileNotFoundException;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStreamWriter;
|
||||
import java.io.PrintWriter;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.io.Writer;
|
||||
import minetweaker.runtime.ILogger;
|
||||
@@ -21,14 +22,16 @@ import minetweaker.runtime.ILogger;
|
||||
*/
|
||||
public class FileLogger implements ILogger {
|
||||
private final Writer writer;
|
||||
private final PrintWriter printWriter;
|
||||
|
||||
public FileLogger(File output) {
|
||||
try {
|
||||
writer = new OutputStreamWriter(new FileOutputStream(output), "utf-8");
|
||||
printWriter = new PrintWriter(writer);
|
||||
} catch (UnsupportedEncodingException ex) {
|
||||
throw new RuntimeException("What the heck?");
|
||||
} catch (FileNotFoundException ex) {
|
||||
throw new RuntimeException("File not found");
|
||||
throw new RuntimeException("Could not open log file " + output);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -64,8 +67,16 @@ public class FileLogger implements ILogger {
|
||||
|
||||
@Override
|
||||
public void logError(String message) {
|
||||
logError(message, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void logError(String message, Throwable exception) {
|
||||
try {
|
||||
writer.write("ERROR: " + message + "\n");
|
||||
if (exception != null) {
|
||||
exception.printStackTrace(printWriter);
|
||||
}
|
||||
writer.flush();
|
||||
} catch (IOException ex) {
|
||||
throw new RuntimeException(ex);
|
||||
|
||||
@@ -76,11 +76,16 @@ public class MTLogger implements ILogger {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void logError(String message) {
|
||||
logError(message, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void logError(String message, Throwable exception) {
|
||||
for (ILogger logger : loggers) {
|
||||
logger.logError(message);
|
||||
logger.logError(message, exception);
|
||||
}
|
||||
|
||||
String message2 = "ERROR: " + message;
|
||||
|
||||
Reference in new issue
Block a user