Created
July 26, 2019 08:37
-
-
Save kindlich/126050db970ec37cbeb1062e90526765 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[PREINITIALIZATION][CLIENT][INFO] Current loaders after merging: [[preinit]] | |
[PREINITIALIZATION][CLIENT][INFO] Loading scripts for loader with names [preinit] | |
[PREINITIALIZATION][CLIENT][INFO] [preinit | SIDE_CLIENT]: Skipping file {[0:crafttweaker]: discord_functional.zs} as we are currently loading with a different loader | |
[PREINITIALIZATION][CLIENT][INFO] Completed script loading in: 3ms | |
[INITIALIZATION][CLIENT][INFO] CraftTweaker: Building registry | |
[INITIALIZATION][CLIENT][INFO] CraftTweaker: Successfully built item registry | |
[INITIALIZATION][CLIENT][INFO] Current loaders after merging: [[preinit], [recipeevent | crafttweaker]] | |
[INITIALIZATION][CLIENT][INFO] Loading scripts for loader with names [crafttweaker | recipeevent] | |
[INITIALIZATION][CLIENT][INFO] [crafttweaker | SIDE_CLIENT]: Loading Script: {[0:crafttweaker]: discord_functional.zs} | |
[INITIALIZATION][CLIENT][INFO] aa | |
[INITIALIZATION][CLIENT][INFO] bb | |
[INITIALIZATION][CLIENT][INFO] cc | |
[INITIALIZATION][CLIENT][INFO] aa | |
[INITIALIZATION][CLIENT][INFO] bb | |
[INITIALIZATION][CLIENT][INFO] cc | |
[INITIALIZATION][CLIENT][INFO] SimpleRecipe[a] | |
[INITIALIZATION][CLIENT][INFO] SimpleRecipe[b] | |
[INITIALIZATION][CLIENT][INFO] SimpleRecipe[c] | |
[INITIALIZATION][CLIENT][INFO] Completed script loading in: 433ms | |
[POSTINITIALIZATION][CLIENT][INFO] Removing recipes for various outputs | |
[AVAILABLE][CLIENT][INFO] Fixed the RecipeBook |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import crafttweaker.tests_functional.RecipeList; | |
import crafttweaker.tests_functional.SimpleRecipe; | |
RecipeList.getString() | |
.map(function(x as string){return x ~ x;}) | |
.filter(function(x as string) {return !(x has "d");}) | |
.forEach(function(x as string) {print(x);}); | |
RecipeList.getString2() | |
.map(function(x as string){return x ~ x;}) | |
.filter(function(x as string) {return !(x has "d");}) | |
.forEach(function(x as string) {print(x);}); | |
RecipeList.getSimpleRecipes() | |
.filter(function(x as SimpleRecipe) {return !(x.id has "d");}) | |
.forEach(function(x as SimpleRecipe) {x.print();}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package crafttweaker.api.tests.functional; | |
import crafttweaker.annotations.*; | |
import stanhebben.zenscript.annotations.*; | |
@ZenClass("crafttweaker.tests_functional.RecipeFilter") | |
@ZenRegister | |
@FunctionalInterface | |
public interface RecipeFilter<T> { | |
boolean doFilter(T recipe); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package crafttweaker.api.tests.functional; | |
import crafttweaker.annotations.*; | |
import stanhebben.zenscript.annotations.*; | |
@ZenClass("crafttweaker.tests_functional.RecipeForEach") | |
@ZenRegister | |
@FunctionalInterface | |
public interface RecipeForEach<T> { | |
void apply(T obj); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package crafttweaker.api.tests.functional; | |
import crafttweaker.annotations.*; | |
import stanhebben.zenscript.annotations.*; | |
import java.util.stream.*; | |
@ZenClass("crafttweaker.tests_functional.RecipeList") | |
@ZenRegister | |
public class RecipeList<T> { | |
private Stream<T> internalStream; | |
public RecipeList(Stream<T> internalStream) { | |
this.internalStream = internalStream; | |
} | |
@ZenMethod | |
public static RecipeList<String> getString() { | |
return new RecipeList<>(Stream.of("a", "b", "c", "d")); | |
} | |
@ZenMethod | |
public static RecipeList<String> getString2() { | |
return new RecipeList<>(Stream.of("a", "b", "c", "d")); | |
} | |
@ZenMethod | |
public static RecipeList<SimpleRecipe> getSimpleRecipes() { | |
return new RecipeList<>(Stream.of("a", "b", "c", "d").map(SimpleRecipe::new)); | |
} | |
@ZenMethod | |
@ReturnsSelf | |
public RecipeList<T> filter(RecipeFilter<T> filter) { | |
internalStream = internalStream.filter(filter::doFilter); | |
return this; | |
} | |
@ZenMethod | |
@ReturnsSelf | |
public RecipeList<T> map(RecipeMapper<T> mapper) { | |
internalStream = internalStream.map(mapper::doMap); | |
return this; | |
} | |
@ZenMethod | |
public void forEach(RecipeForEach<T> applyFn) { | |
internalStream.forEach(applyFn::apply); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package crafttweaker.api.tests.functional; | |
import crafttweaker.annotations.*; | |
import stanhebben.zenscript.annotations.*; | |
@ZenClass("crafttweaker.tests_functional.RecipeMapper") | |
@ZenRegister | |
@FunctionalInterface | |
public interface RecipeMapper<T> { | |
T doMap(T obj); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package crafttweaker.api.tests.functional; | |
import crafttweaker.*; | |
import crafttweaker.annotations.*; | |
import stanhebben.zenscript.annotations.*; | |
import java.util.*; | |
@ZenClass("crafttweaker.tests_functional.SimpleRecipe") | |
@ZenRegister | |
public class SimpleRecipe { | |
private final String id; | |
public SimpleRecipe(String id) { | |
this.id = id; | |
} | |
@ZenGetter("id") | |
public String getId() { | |
return id; | |
} | |
@ZenMethod | |
public void print() { | |
CraftTweakerAPI.logInfo(String.format(Locale.ENGLISH, "SimpleRecipe[%s]", id)); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment