Search in sources :

Example 6 with IEnvironmentGlobal

use of stanhebben.zenscript.compiler.IEnvironmentGlobal in project CraftTweaker by CraftTweaker.

the class BracketHandlerItem method find.

private IZenSymbol find(IEnvironmentGlobal environment, List<Token> tokens, int startIndex, int endIndex, int meta) {
    StringBuilder valueBuilder = new StringBuilder();
    for (int i = startIndex; i < endIndex; i++) {
        Token token = tokens.get(i);
        valueBuilder.append(token.getValue());
    }
    String itemName = valueBuilder.toString();
    if (itemNames.containsKey(itemName) || blockNames.containsKey(itemName)) {
        return position -> new ExpressionCallStatic(position, environment, method, new ExpressionString(position, valueBuilder.toString()), new ExpressionInt(position, meta, ZenType.INT));
    }
    return null;
}
Also used : MCItemUtils(crafttweaker.mc1120.item.MCItemUtils) java.util(java.util) ZenTokener(stanhebben.zenscript.ZenTokener) IBracketHandler(crafttweaker.zenscript.IBracketHandler) Token(stanhebben.zenscript.parser.Token) net.minecraft.item(net.minecraft.item) stanhebben.zenscript.expression(stanhebben.zenscript.expression) IJavaMethod(stanhebben.zenscript.type.natives.IJavaMethod) crafttweaker(crafttweaker) Block(net.minecraft.block.Block) IEnvironmentGlobal(stanhebben.zenscript.compiler.IEnvironmentGlobal) OreDictionary(net.minecraftforge.oredict.OreDictionary) crafttweaker.annotations(crafttweaker.annotations) crafttweaker.api.item(crafttweaker.api.item) ResourceLocation(net.minecraft.util.ResourceLocation) ZenType(stanhebben.zenscript.type.ZenType) IZenSymbol(stanhebben.zenscript.symbols.IZenSymbol) CraftTweakerMC.getIItemStackWildcardSize(crafttweaker.api.minecraft.CraftTweakerMC.getIItemStackWildcardSize) Token(stanhebben.zenscript.parser.Token)

Aggregations

IEnvironmentGlobal (stanhebben.zenscript.compiler.IEnvironmentGlobal)6 crafttweaker.annotations (crafttweaker.annotations)4 IBracketHandler (crafttweaker.zenscript.IBracketHandler)4 java.util (java.util)4 stanhebben.zenscript.expression (stanhebben.zenscript.expression)4 Token (stanhebben.zenscript.parser.Token)4 IZenSymbol (stanhebben.zenscript.symbols.IZenSymbol)4 crafttweaker (crafttweaker)2 GlobalRegistry (crafttweaker.zenscript.GlobalRegistry)2 stanhebben.zenscript.type.natives (stanhebben.zenscript.type.natives)2 IJavaMethod (stanhebben.zenscript.type.natives.IJavaMethod)2 CraftTweakerAPI (crafttweaker.CraftTweakerAPI)1 IEntityDefinition (crafttweaker.api.entity.IEntityDefinition)1 crafttweaker.api.item (crafttweaker.api.item)1 ILiquidStack (crafttweaker.api.liquid.ILiquidStack)1 CraftTweakerMC.getIItemStackWildcardSize (crafttweaker.api.minecraft.CraftTweakerMC.getIItemStackWildcardSize)1 IOreDictEntry (crafttweaker.api.oredict.IOreDictEntry)1 MCItemUtils (crafttweaker.mc1120.item.MCItemUtils)1 MCLiquidStack (crafttweaker.mc1120.liquid.MCLiquidStack)1 MCOreDictEntry (crafttweaker.mc1120.oredict.MCOreDictEntry)1