mirror of
https://github.com/GTNewHorizons/CraftTweaker.git
synced 2026-11-25 06:14:25 +00:00
- Continued writing on the IC2 integration code
- Implemented advanced recipes on <*> values - Removed unused ZenScript classes - Continued work on any values - Moved documentation generation to buildSrc - Started work on a jar merging task - Added toString implementation to ingredients - Added stack count to ICraftingInventory - Fixed imports - Added logCommand to the logger to log command output - Implemented memory script provider to load scripts received from the server - Added exception handling for script execution - First attempt at creating a transformer to generate a list of ZenClass and ZenExpansion classes - Added console commands (reload, names, liquids, inventory, hand, oredict) - Added general logic - Fixed item ingredients for wildcard sizes - Implemented selective recipe removal - Fixed null recipe results - Started implementation of player-specific recipes - Removed redundant IC2 mod copy - Other minor fixes
This commit is contained in:
1 parent
f3ea7f7831
commit
489347558f
124 files changed
+3942
-419
No files matched your search
+74
@@ -0,0 +1,74 @@
|
||||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
|
||||
package minetweaker.runtime.providers;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.Set;
|
||||
import minetweaker.runtime.IScriptIterator;
|
||||
import minetweaker.runtime.IScriptProvider;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Stan Hebben
|
||||
*/
|
||||
public class ScriptProviderCascade implements IScriptProvider {
|
||||
private final IScriptProvider[] providers;
|
||||
|
||||
public ScriptProviderCascade(IScriptProvider... providers) {
|
||||
this.providers = providers;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterator<IScriptIterator> getScripts() {
|
||||
return new MyScripterator();
|
||||
}
|
||||
|
||||
private class MyScripterator implements Iterator<IScriptIterator> {
|
||||
private final Set<String> executed = new HashSet<String>();
|
||||
|
||||
private int currentIndex = providers.length - 1;
|
||||
private Iterator<IScriptIterator> current;
|
||||
private IScriptIterator currentValue;
|
||||
|
||||
public MyScripterator() {
|
||||
currentIndex = providers.length - 1;
|
||||
current = providers[currentIndex].getScripts();
|
||||
|
||||
advance();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasNext() {
|
||||
return currentIndex >= 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IScriptIterator next() {
|
||||
IScriptIterator result = currentValue;
|
||||
executed.add(result.getGroupName());
|
||||
|
||||
advance();
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
private void advance() {
|
||||
do {
|
||||
while (!current.hasNext()) {
|
||||
currentIndex--;
|
||||
if (currentIndex < 0) return;
|
||||
|
||||
current = providers[currentIndex].getScripts();
|
||||
}
|
||||
if (currentIndex < 0) break;
|
||||
|
||||
currentValue = current.next();
|
||||
} while (executed.contains(currentValue.getGroupName()) && hasNext());
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user