stanhebben.zenscript.annotations.ZenMethod Java Examples

The following examples show how to use stanhebben.zenscript.annotations.ZenMethod. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: Optimiser.java    From EmergingTechnology with MIT License 5 votes vote down vote up
@ZenMethod
public static void addRecipe(Object input, int cores)
{
	OptimiserRecipe recipe = CraftTweakerHelper.getOptimiserRecipe(input, cores);

	CraftTweakerAPI.apply(new Add(recipe));
}
 
Example #2
Source File: CTTFCompressor.java    From TofuCraftReload with MIT License 5 votes vote down vote up
@ZenMethod
public static void RemoveRecipe(IIngredient input) {
	Object itemInput=null;
	if (input instanceof IItemStack) {
		itemInput=CraftTweakerMC.getItemStack(input);
	} 
	else if(input instanceof IOreDictEntry) {
		itemInput=((IOreDictEntry)input).getName();
	}
	if(itemInput!=null)
		RecipeLoader.actions.add(new Removal(itemInput));
}
 
Example #3
Source File: CTTFCompressor.java    From TofuCraftReload with MIT License 5 votes vote down vote up
@ZenMethod
public static void AddRecipe(IIngredient input,IItemStack output) {
	Object itemInput=null;
	if (input instanceof IItemStack) {
		itemInput=CraftTweakerMC.getItemStack(input);
	} 
	else if(input instanceof IOreDictEntry) {
		itemInput=((IOreDictEntry)input).getName();
	}
	if(itemInput!=null)
		RecipeLoader.actions.add(new Addition(itemInput,CraftTweakerMC.getItemStack(output)));
}
 
Example #4
Source File: MaterialStack.java    From GregTech with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
@ZenMethod
public boolean equals(Object o) {
    if (this == o) return true;
    if (o == null || getClass() != o.getClass()) return false;

    MaterialStack that = (MaterialStack) o;

    if (amount != that.amount) return false;
    return material.equals(that.material);
}
 
Example #5
Source File: OreDepositDefinition.java    From GregTech with GNU Lesser General Public License v3.0 5 votes vote down vote up
@ZenMethod("getBiomeWeightModifier")
@Method(modid = GTValues.MODID_CT)
public int ctGetBiomeWeightModifier(IBiome biome) {
    int biomeIndex = ArrayUtils.indexOf(CraftTweakerMC.biomes, biome);
    Biome mcBiome = Biome.REGISTRY.getObjectById(biomeIndex);
    return mcBiome == null ? 0 : getBiomeWeightModifier().apply(mcBiome);
}
 
Example #6
Source File: CTSakuraStoneMortar.java    From Sakura_mod with MIT License 5 votes vote down vote up
@ZenMethod
public static void RemoveRecipe(IIngredient[] input) {
	if(input.length>0){
		Object[] array = new Object[input.length];
	    for(int i = 0; i < input.length;i++){
	    	if (input[i] instanceof IItemStack)
	    		array[i]=CraftTweakerMC.getItemStack(input[i]);
			else if(input[i] instanceof IOreDictEntry) 
				array[i]=((IOreDictEntry)input[i]).getName();	
		}
	    SakuraRecipeRegister.actions.add(new Removal(array));
	}
}
 
Example #7
Source File: CTRecipeBuilder.java    From GregTech with GNU Lesser General Public License v3.0 5 votes vote down vote up
@ZenMethod
public CTRecipeBuilder property(String key, int value) {
    boolean applied = this.backingBuilder.applyProperty(key, value);
    if (!applied) {
        throw new IllegalArgumentException("Property " +
            key + " cannot be applied to recipe type " +
            backingBuilder.getClass().getSimpleName());
    }
    return this;
}
 
Example #8
Source File: CTTFCrusher.java    From TofuCraftReload with MIT License 5 votes vote down vote up
@ZenMethod
public static void AddRecipe(IIngredient input,IItemStack output) {
	Object itemInput=null;
	if (input instanceof IItemStack) {
		itemInput=CraftTweakerMC.getItemStack(input);
	} 
	else if(input instanceof IOreDictEntry) {
		itemInput=((IOreDictEntry)input).getName();
	}
	if(itemInput!=null)
		RecipeLoader.actions.add(new Addition(itemInput,CraftTweakerMC.getItemStack(output)));
}
 
Example #9
Source File: CTTFAggregator.java    From TofuCraftReload with MIT License 5 votes vote down vote up
@ZenMethod
public static void AddRecipe(IIngredient input,IItemStack output) {
	Object itemInput=null;
	if (input instanceof IItemStack) {
		itemInput=CraftTweakerMC.getItemStack(input);
	} 
	else if(input instanceof IOreDictEntry) {
		itemInput=((IOreDictEntry)input).getName();
	}
	if(itemInput!=null)
		RecipeLoader.actions.add(new Addition(itemInput,CraftTweakerMC.getItemStack(output)));
}
 
Example #10
Source File: CTTFAggregator.java    From TofuCraftReload with MIT License 5 votes vote down vote up
@ZenMethod
public static void RemoveRecipe(IIngredient input) {
	Object itemInput=null;
	if (input instanceof IItemStack) {
		itemInput=CraftTweakerMC.getItemStack(input);
	} 
	else if(input instanceof IOreDictEntry) {
		itemInput=((IOreDictEntry)input).getName();
	}
	if(itemInput!=null)
		RecipeLoader.actions.add(new Removal(itemInput));
}
 
Example #11
Source File: CTMaterialRegistry.java    From GregTech with GNU Lesser General Public License v3.0 5 votes vote down vote up
@ZenMethod
public static IngotMaterial createIngotMaterial(int metaItemSubId, String name, int color, String iconSet, int harvestLevel, @Optional MaterialStack[] materialComponents, @Optional float toolSpeed, @Optional float attackDamage, @Optional int toolDurability, @Optional int blastFurnaceTemperature) {
    return new IngotMaterial(metaItemSubId, name, color,
        MaterialIconSet.getByName(iconSet), harvestLevel,
        validateComponentList(materialComponents), 0, null,
        Math.max(0.0f, toolSpeed), Math.max(0.0f, attackDamage), Math.max(0, toolDurability), blastFurnaceTemperature);
}
 
Example #12
Source File: CTRecipeBuilder.java    From GregTech with GNU Lesser General Public License v3.0 5 votes vote down vote up
@ZenMethod
public CTRecipeBuilder inputs(IIngredient... ingredients) {
    this.backingBuilder.inputsIngredients(Arrays.stream(ingredients)
        .map(s -> new CountableIngredient(new CraftTweakerIngredientWrapper(s), s.getAmount()))
        .collect(Collectors.toList()));
    return this;
}
 
Example #13
Source File: ShapeGenerator.java    From GregTech with GNU Lesser General Public License v3.0 5 votes vote down vote up
@ZenMethod
@Method(modid = GTValues.MODID_CT)
public void generate(long randomSeed, IWorld world, IBlockPos centerPos, IBlockState blockState) {
    World mcWorld = CraftTweakerMC.getWorld(world);
    net.minecraft.block.state.IBlockState mcBlockState = CraftTweakerMC.getBlockState(blockState);
    BlockPos blockPos = CraftTweakerMC.getBlockPos(centerPos);
    generate(new Random(randomSeed), (x, y, z) -> mcWorld.setBlockState(blockPos, mcBlockState));
}
 
Example #14
Source File: CTSakuraCampfirePot.java    From Sakura_mod with MIT License 5 votes vote down vote up
@ZenMethod
public static void AddRecipe(IIngredient[] input,IItemStack output,ILiquidStack input_fluid) {
	if(input.length>0){
		Object[] array = new Object[input.length];
	    for(int i = 0; i < input.length;i++){
	    	if (input[i] instanceof IItemStack) 
	    		array[i]=CraftTweakerMC.getItemStack(input[i]);
			else if(input[i] instanceof IOreDictEntry) 
				array[i]=((IOreDictEntry)input[i]).getName();	
		}

	    SakuraRecipeRegister.actions.add(new Addition(array, CraftTweakerMC.getItemStack(output),CraftTweakerMC.getLiquidStack(input_fluid)));
	}
}
 
Example #15
Source File: RecipeMap.java    From GregTech with GNU Lesser General Public License v3.0 5 votes vote down vote up
@ZenMethod("findRecipe")
@Method(modid = GTValues.MODID_CT)
@Nullable
public CTRecipe ctFindRecipe(long maxVoltage, IItemStack[] itemInputs, ILiquidStack[] fluidInputs, @Optional(valueLong = Integer.MAX_VALUE) int outputFluidTankCapacity) {
    List<ItemStack> mcItemInputs = itemInputs == null ? Collections.emptyList() :
        Arrays.stream(itemInputs)
            .map(CraftTweakerMC::getItemStack)
            .collect(Collectors.toList());
    List<FluidStack> mcFluidInputs = fluidInputs == null ? Collections.emptyList() :
        Arrays.stream(fluidInputs)
            .map(CraftTweakerMC::getLiquidStack)
            .collect(Collectors.toList());
    Recipe backingRecipe = findRecipe(maxVoltage, mcItemInputs, mcFluidInputs, outputFluidTankCapacity);
    return backingRecipe == null ? null : new CTRecipe(this, backingRecipe);
}
 
Example #16
Source File: AlgaeBioreactor.java    From EmergingTechnology with MIT License 5 votes vote down vote up
@ZenMethod
public static void addRecipe(IItemStack output, Object input)
{
	IMachineRecipe recipe = CraftTweakerHelper.getMachineRecipe(output, input);

	CraftTweakerAPI.apply(new Add(recipe));
}
 
Example #17
Source File: CokeOvenRecipeBuilder.java    From GregTech with GNU Lesser General Public License v3.0 5 votes vote down vote up
@ZenMethod
public void buildAndRegister() {
    ValidationResult<CokeOvenRecipe> result = build();

    if (result.getType() == EnumValidationResult.VALID) {
        CokeOvenRecipe recipe = result.getResult();
        RecipeMaps.COKE_OVEN_RECIPES.add(recipe);
    }
}
 
Example #18
Source File: FuelRecipeMap.java    From GregTech with GNU Lesser General Public License v3.0 5 votes vote down vote up
@ZenMethod
public void addRecipe(FuelRecipe fuelRecipe) {
    FluidKey fluidKey = new FluidKey(fuelRecipe.getRecipeFluid());
    if (recipeFluidMap.containsKey(fluidKey)) {
        FuelRecipe oldRecipe = recipeFluidMap.remove(fluidKey);
        recipeList.remove(oldRecipe);
    }
    recipeFluidMap.put(fluidKey, fuelRecipe);
    recipeList.add(fuelRecipe);
}
 
Example #19
Source File: CTTFAdvancedAggregator.java    From TofuCraftReload with MIT License 5 votes vote down vote up
@ZenMethod
public static void removeRecipe(IIngredient[] input) {
    ArrayList<Object> converted = new ArrayList<>();
    for (IIngredient i : input) {
        if (i instanceof IItemStack) {
            converted.add(CraftTweakerMC.getItemStack(i));
        } else if (i instanceof IOreDictEntry) {
            converted.add(new OredictItemStack(((IOreDictEntry) i).getName(), 1));
        }
    }
    RecipeLoader.actions.add(new Removal(converted));
}
 
Example #20
Source File: PBFRecipeBuilder.java    From GregTech with GNU Lesser General Public License v3.0 5 votes vote down vote up
@ZenMethod
public void buildAndRegister() {
    ValidationResult<PrimitiveBlastFurnaceRecipe> result = build();

    if (result.getType() == EnumValidationResult.VALID) {
        PrimitiveBlastFurnaceRecipe recipe = result.getResult();
        RecipeMaps.PRIMITIVE_BLAST_FURNACE_RECIPES.add(recipe);
    }
}
 
Example #21
Source File: Processor.java    From EmergingTechnology with MIT License 5 votes vote down vote up
@ZenMethod
public static void addRecipe(IItemStack output, Object input)
{
	IMachineRecipe recipe = CraftTweakerHelper.getMachineRecipe(output, input);

	CraftTweakerAPI.apply(new Add(recipe));
}
 
Example #22
Source File: Bioreactor.java    From EmergingTechnology with MIT License 5 votes vote down vote up
@ZenMethod
public static void addRecipe(IItemStack output, Object input)
{
	IMachineRecipe recipe = CraftTweakerHelper.getMachineRecipe(output, input);

	CraftTweakerAPI.apply(new Add(recipe));
}
 
Example #23
Source File: Biomass.java    From EmergingTechnology with MIT License 5 votes vote down vote up
@ZenMethod
public static void addRecipe(IItemStack output, Object input)
{
	IMachineRecipe recipe = CraftTweakerHelper.getMachineRecipe(output, input);

	CraftTweakerAPI.apply(new Add(recipe));
}
 
Example #24
Source File: Injector.java    From EmergingTechnology with MIT License 5 votes vote down vote up
@ZenMethod
public static void addRecipe(IItemStack output, Object input)
{
	IMachineRecipe recipe = CraftTweakerHelper.getMachineRecipe(output, input);

	CraftTweakerAPI.apply(new Add(recipe));
}
 
Example #25
Source File: Bulbs.java    From EmergingTechnology with MIT License 5 votes vote down vote up
@ZenMethod
public static void addBulb(Object input, int color, int energyUsage, int growthModifier, String[] plants, int boostModifier)
{
	if (input == null) return;

	String itemName = input.toString();

	if (plants == null) plants = new String[0];

	CraftTweakerAPI.apply(new Add(itemName, color, energyUsage, growthModifier, plants, boostModifier));
}
 
Example #26
Source File: CTSakuraBarrel.java    From Sakura_mod with MIT License 5 votes vote down vote up
@ZenMethod
public static void AddRecipe(ILiquidStack input_fluid,IIngredient[] input,ILiquidStack output) {
	if(input.length>0){
		Object[] array = new Object[input.length];
	    for(int i = 0; i < input.length;i++){
	    	if (input[i] instanceof IItemStack) 
	    		array[i]=CraftTweakerMC.getItemStack(input[i]);
			else if(input[i] instanceof IOreDictEntry) 
				array[i]=((IOreDictEntry)input[i]).getName();	
		}

	    SakuraRecipeRegister.actions.add(new Addition(array, CraftTweakerMC.getLiquidStack(output),CraftTweakerMC.getLiquidStack(input_fluid)));
	}
}
 
Example #27
Source File: CTRecipeBuilder.java    From GregTech with GNU Lesser General Public License v3.0 4 votes vote down vote up
@ZenMethod
@Override
public String toString() {
    return this.backingBuilder.toString();
}
 
Example #28
Source File: CTRecipe.java    From GregTech with GNU Lesser General Public License v3.0 4 votes vote down vote up
@ZenMethod
public boolean hasInputFluid(ILiquidStack liquidStack) {
    return this.backingRecipe.hasInputFluid(CraftTweakerMC.getLiquidStack(liquidStack));
}
 
Example #29
Source File: GTCraftTweakerMatterFab.java    From GT-Classic with GNU Lesser General Public License v3.0 4 votes vote down vote up
@ZenMethod
public static void addRecipe(IIngredient input, int amplifier) {
	GTCraftTweakerActions.apply(new MatterFabRecipeAction(GTCraftTweakerActions.of(input), amplifier));
}
 
Example #30
Source File: Processor.java    From EmergingTechnology with MIT License 4 votes vote down vote up
@ZenMethod
public static void removeRecipe(IItemStack output)
{
	CraftTweakerAPI.apply(new Remove(CraftTweakerHelper.toStack(output)));
}