mirror of
https://github.com/GTNewHorizons/CraftTweaker.git
synced 2026-11-21 12:32:29 +00:00
- Rewrote the whole damn typecasting system. Now uses a more flexible and more structure casting rule system.
- Improved function literals. Function recipes are a thing! - Added mirrored shaped recipes - Fixed a few "any" type - related errors - Added environment to the bracket handlers. Breaks existing bracket handlers!! - Turned JavaMethod into an interface. Can now be used both for existing methods and generated ones. Makes a few things simpler :) - Added creative and adventure getters to player info
This commit is contained in:
1 parent
c67ad22270
commit
154c2242f9
172 files changed
+5400
-2134
No files matched your search
@@ -13,6 +13,7 @@ import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
import minetweaker.IBracketHandler;
|
||||
@@ -35,6 +36,7 @@ import stanhebben.zenscript.symbols.SymbolPackage;
|
||||
import stanhebben.zenscript.symbols.SymbolType;
|
||||
import stanhebben.zenscript.type.ZenType;
|
||||
import stanhebben.zenscript.type.ZenTypeNative;
|
||||
import stanhebben.zenscript.type.natives.IJavaMethod;
|
||||
import stanhebben.zenscript.type.natives.JavaMethod;
|
||||
import stanhebben.zenscript.util.ZenPosition;
|
||||
|
||||
@@ -105,9 +107,9 @@ public class GlobalRegistry {
|
||||
}
|
||||
}
|
||||
|
||||
public static IZenSymbol resolveBracket(List<Token> tokens) {
|
||||
public static IZenSymbol resolveBracket(IEnvironmentGlobal environment, List<Token> tokens) {
|
||||
for (IBracketHandler handler : bracketHandlers) {
|
||||
IZenSymbol symbol = handler.resolve(tokens);
|
||||
IZenSymbol symbol = handler.resolve(environment, tokens);
|
||||
if (symbol != null) {
|
||||
return symbol;
|
||||
}
|
||||
@@ -117,7 +119,7 @@ public class GlobalRegistry {
|
||||
}
|
||||
|
||||
public static IZenSymbol getStaticFunction(Class cls, String name, Class... arguments) {
|
||||
JavaMethod method = JavaMethod.get(types, cls, name, arguments);
|
||||
IJavaMethod method = JavaMethod.get(types, cls, name, arguments);
|
||||
if (method == null) return null;
|
||||
return new SymbolJavaStaticMethod(method);
|
||||
}
|
||||
@@ -180,8 +182,8 @@ public class GlobalRegistry {
|
||||
}
|
||||
|
||||
@Override
|
||||
public IZenSymbol getBracketed(List<Token> tokens) {
|
||||
return resolveBracket(tokens);
|
||||
public IZenSymbol getBracketed(IEnvironmentGlobal environment, List<Token> tokens) {
|
||||
return resolveBracket(environment, tokens);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -266,5 +268,15 @@ public class GlobalRegistry {
|
||||
public void warning(ZenPosition position, String message) {
|
||||
MineTweakerAPI.logWarning(position.toString() + " > " + message);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<String> getClassNames() {
|
||||
return classes.keySet();
|
||||
}
|
||||
|
||||
@Override
|
||||
public byte[] getClass(String name) {
|
||||
return classes.get(name);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -36,6 +36,8 @@ import stanhebben.zenscript.parser.ParseException;
|
||||
* @author Stan Hebben
|
||||
*/
|
||||
public class MTTweaker implements ITweaker {
|
||||
private static final boolean DEBUG = true;
|
||||
|
||||
private final List<IUndoableAction> actions = new ArrayList<IUndoableAction>();
|
||||
private final Set<IUndoableAction> wereStuck = new LinkedHashSet<IUndoableAction>();
|
||||
private final Map<Object, IUndoableAction> stuckOverridable = new HashMap<Object, IUndoableAction>();
|
||||
@@ -61,8 +63,9 @@ public class MTTweaker implements ITweaker {
|
||||
}
|
||||
|
||||
action.apply();
|
||||
actions.add(action);
|
||||
}
|
||||
|
||||
actions.add(action);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -148,7 +151,7 @@ public class MTTweaker implements ITweaker {
|
||||
try {
|
||||
String filename = script.getGroupName();
|
||||
System.out.println("MineTweaker: Loading " + filename);
|
||||
compileScripts(filename, files, environmentGlobal);
|
||||
compileScripts(filename, files, environmentGlobal, DEBUG);
|
||||
|
||||
// execute scripts
|
||||
ZenModule module = new ZenModule(classes, MineTweakerAPI.class.getClassLoader());
|
||||
|
||||
Reference in new issue
Block a user