本文整理汇总了Java中stanhebben.zenscript.annotations.ZenMethod类的典型用法代码示例。如果您正苦于以下问题:Java ZenMethod类的具体用法?Java ZenMethod怎么用?Java ZenMethod使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ZenMethod类属于stanhebben.zenscript.annotations包,在下文中一共展示了ZenMethod类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addMelting
import stanhebben.zenscript.annotations.ZenMethod; //导入依赖的package包/类
/**********************************************
* TConstruct Melting Recipes
**********************************************/
// Adding a Meltery Recipe
@ZenMethod
public static void addMelting(ILiquidStack output, IIngredient input, int temp) {
if (input == null || output == null) {
LogHelper.logError(String.format("Required parameters missing for %s Recipe.", nameMelting));
return;
}
List<MelteryRecipe> recipes = new LinkedList<>();
for (IItemStack in : input.getItems()) {
recipes.add(new MelteryRecipe(new RecipeMatch.ItemCombination(output.getAmount(), toStack(in)), toFluid(output), temp));
}
if (!recipes.isEmpty()) {
MineTweakerAPI.apply(new AddMelting(recipes));
} else {
LogHelper.logError(String.format("No %s recipes could be added for input %s.", nameMelting, input.toString()));
}
}
示例2: removeMelting
import stanhebben.zenscript.annotations.ZenMethod; //导入依赖的package包/类
@ZenMethod
public static void removeMelting(IItemStack input) {
List<MelteryRecipe> recipes = new LinkedList<>();
for (MelteryRecipe meta : MelteryHandler.meltingRecipes) {
NonNullList<ItemStack> items = NonNullList.create();
items.addAll(input.getItems().stream().map(InputHelper::toStack).collect(Collectors.toList()));
if (meta.input.matches(items) != null) {
recipes.add(meta);
}
}
if (!recipes.isEmpty()) {
MineTweakerAPI.apply(new RemoveMelting(recipes));
} else {
LogHelper.logWarning(String.format("No %s Recipe found for %s. Command ignored!", nameMelting, input.toString()));
}
}
示例3: ageFluid
import stanhebben.zenscript.annotations.ZenMethod; //导入依赖的package包/类
@ZenMethod
public static void ageFluid(ILiquidStack outputFS, ILiquidStack inputFS, int minTechLevel, boolean sealed, int sealtime)
{
FluidStack inputFluid = MineTweakerMC.getLiquidStack(inputFS);
FluidStack outputFluid = MineTweakerMC.getLiquidStack(outputFS);
if(inputFluid.amount <= 0)
MineTweakerAPI.logError("InputFluid must contain more than 0 mb of fluid");
else if(outputFluid == null || outputFluid.getFluid() == null)
MineTweakerAPI.logError("Missing OutputFluid");
else if(outputFluid.amount <= 0)
MineTweakerAPI.logError("OutputFluid must contain more than 0 mb of fluid");
else if(sealed == false && sealtime > 0)
MineTweakerAPI.logError("Sealed time must be 0 if barrel is unsealed");
else
MineTweakerAPI.apply(new addAgedFluidAction(inputFluid, outputFluid, sealtime, sealed, minTechLevel));
}
示例4: addFluidCombination
import stanhebben.zenscript.annotations.ZenMethod; //导入依赖的package包/类
@ZenMethod
public static void addFluidCombination(ILiquidStack outputFluid, ILiquidStack fluidInBarrel, ILiquidStack inputFluid)
{
FluidStack barrelContents = MineTweakerMC.getLiquidStack(fluidInBarrel);
FluidStack inputfluid = MineTweakerMC.getLiquidStack(inputFluid);
FluidStack outputfluid = MineTweakerMC.getLiquidStack(outputFluid);
if(barrelContents == null || barrelContents.getFluid() == null)
MineTweakerAPI.logError("Missing Barrel Contents");
else if(barrelContents.amount <= 0)
MineTweakerAPI.logError("Barrel Contents must contain more than 0 mb of fluid");
else if(inputfluid == null || inputfluid.getFluid() == null)
MineTweakerAPI.logError("Missing Input Fluid");
else if(inputfluid.amount <= 0)
MineTweakerAPI.logError("Input Fluid must contain more than 0 mb of fluid");
else if(outputfluid == null || outputfluid.getFluid() == null)
MineTweakerAPI.logError("Missing Input Fluid");
else if(outputfluid.amount <= 0)
MineTweakerAPI.logError("Output Fluid must contain more than 0 mb of fluid");
else
MineTweakerAPI.apply(new addFluidCombinationAction(barrelContents, inputfluid, outputfluid));
}
示例5: removeFluidCombination
import stanhebben.zenscript.annotations.ZenMethod; //导入依赖的package包/类
@ZenMethod
public static void removeFluidCombination(ILiquidStack outputFluid, ILiquidStack fluidInBarrel, ILiquidStack inputFluid)
{
FluidStack barrelContents = MineTweakerMC.getLiquidStack(fluidInBarrel);
FluidStack inputfluid = MineTweakerMC.getLiquidStack(inputFluid);
FluidStack outputfluid = MineTweakerMC.getLiquidStack(outputFluid);
if(barrelContents == null || barrelContents.getFluid() == null)
MineTweakerAPI.logError("Missing Barrel Contents");
else if(barrelContents.amount <= 0)
MineTweakerAPI.logError("Barrel Contents must contain more than 0 mb of fluid");
else if(inputfluid == null || inputfluid.getFluid() == null)
MineTweakerAPI.logError("Missing Input Fluid");
else if(inputfluid.amount <= 0)
MineTweakerAPI.logError("Input Fluid must contain more than 0 mb of fluid");
else if(outputfluid == null || outputfluid.getFluid() == null)
MineTweakerAPI.logError("Missing Input Fluid");
else if(outputfluid.amount <= 0)
MineTweakerAPI.logError("Output Fluid must contain more than 0 mb of fluid");
else
MineTweakerAPI.apply(new removeFluidCombinationAction(barrelContents, inputfluid, outputfluid));
}
示例6: addWeldRecipe
import stanhebben.zenscript.annotations.ZenMethod; //导入依赖的package包/类
@ZenMethod
public static void addWeldRecipe(IItemStack Output, IItemStack Input1, IItemStack Input2, int AnvilReq)
{
ItemStack result = MineTweakerMC.getItemStack(Output);
ItemStack input1 = MineTweakerMC.getItemStack(Input1);
ItemStack input2 = MineTweakerMC.getItemStack(Input2);
if(input1 == null || input1.getItem() == null)
MineTweakerAPI.logError("Missing first InputStack");
else if(input1 == null || input1.getItem() == null)
MineTweakerAPI.logError("Missing second InputStack");
else if(result == null || result.getItem() == null)
MineTweakerAPI.logError("Missing OutputStack");
else if(AnvilReq < 0 || AnvilReq > 7)
MineTweakerAPI.logError("Anvil type must be between 0 and 7, inclusive");
else
MineTweakerAPI.apply(new addWeldRecipeAction(result, input1, input2, AnvilReq));
}
示例7: removeWeldRecipe
import stanhebben.zenscript.annotations.ZenMethod; //导入依赖的package包/类
@ZenMethod
public static void removeWeldRecipe(IItemStack Output, IItemStack Input1, IItemStack Input2, int AnvilReq)
{
ItemStack result = MineTweakerMC.getItemStack(Output);
ItemStack input1 = MineTweakerMC.getItemStack(Input1);
ItemStack input2 = MineTweakerMC.getItemStack(Input2);
if(input1 == null || input1.getItem() == null)
MineTweakerAPI.logError("Missing first InputStack");
else if(input1 == null || input1.getItem() == null)
MineTweakerAPI.logError("Missing second InputStack");
else if(result == null || result.getItem() == null)
MineTweakerAPI.logError("Missing OutputStack");
else if(AnvilReq < 0 || AnvilReq > 6)
MineTweakerAPI.logError("Anvil type must be between 0 and 6, inclusive");
else
MineTweakerAPI.apply(new removeWeldRecipeAction(result, input1, input2, AnvilReq));
}
示例8: addRecipe
import stanhebben.zenscript.annotations.ZenMethod; //导入依赖的package包/类
@ZenMethod
public static void addRecipe(IItemStack output, IItemStack input, double heat, double specHeat)
{
ItemStack inputStack = MineTweakerMC.getItemStack(input);
ItemStack outputStack = MineTweakerMC.getItemStack(output);
if(inputStack == null || inputStack.getItem() == null)
MineTweakerAPI.logError("Missing InputStack");
else if(inputStack.getItem() instanceof ISmeltable &&
((ISmeltable)inputStack.getItem()).getMetalType(inputStack) == null)
MineTweakerAPI.logError(inputStack.getDisplayName() + " is invalid when melted.");
else if(outputStack == null || outputStack.getItem() == null)
MineTweakerAPI.logError("Missing OutputStack");
else if(heat < 0)
MineTweakerAPI.logError("Item melting point cannot be less than 0");
else if(specHeat < 0)
MineTweakerAPI.logError("Item specific heat cannot be less than 0");
else
MineTweakerAPI.apply(new addHeatingAction(outputStack, inputStack, heat, specHeat));
}
示例9: set
import stanhebben.zenscript.annotations.ZenMethod; //导入依赖的package包/类
@ZenMethod
public static void set(IItemStack item, String tool, int level) {
if (item == null) {
MineTweakerAPI.getLogger().logError("Harvest level: Block/Item must not be null!");
return;
}
if (isABlock(toStack(item))) {
MineTweakerAPI.apply(new HarvestLevelChangeBlock(item, tool, level));
} else {
if (tool == null) {
MineTweakerAPI.getLogger().logError("Harvest level: For items tool must not be null!");
return;
}
MineTweakerAPI.apply(new HarvestLevelChangeItem(item, tool, level));
}
}
示例10: removeRecipe
import stanhebben.zenscript.annotations.ZenMethod; //导入依赖的package包/类
@ZenMethod
public static void removeRecipe(final IIngredient output, final IIngredient input)
{
List<Dryable.DryingRecipe> toRemove;
if (isOredict(input))
{
toRemove = Dryable.RECIPES.stream().filter(recipe ->
recipe instanceof Dryable.DryingOreRecipe &&
output.matches(new MCItemStack(recipe.getOutput())) &&
((Dryable.DryingOreRecipe) recipe).getOreName().equals(toOredictName(input))
).collect(Collectors.toList());
}
else
{
toRemove = Dryable.RECIPES.stream().filter(recipe ->
recipe instanceof Dryable.DryingItemRecipe &&
output.matches(new MCItemStack(recipe.getOutput())) &&
input.matches(new MCItemStack(((Dryable.DryingItemRecipe) recipe).getInput()))
).collect(Collectors.toList());
}
Dryable.RECIPES.removeAll(toRemove);
}
示例11: removeAllFuels
import stanhebben.zenscript.annotations.ZenMethod; //导入依赖的package包/类
@ZenMethod
public static void removeAllFuels() {
CraftTweaker.REMOVALS.add(new IAction(){
@Override
public void apply(){
PneumaticCraftAPIHandler.getInstance().liquidFuels.clear();
}
@Override
public String describe(){
return "Removing all fuel values.";
}
});
}
示例12: add
import stanhebben.zenscript.annotations.ZenMethod; //导入依赖的package包/类
@ZenMethod
public static void add(IItemStack output, ILiquidStack liquid, @NotNull IItemStack stamp, @Optional IItemStack input) {
ItemStack stack = InputHelper.toStack(input);
ItemStack stampStack = InputHelper.toStack(stamp); //This is pointless but also the easiest way.
ItemStampingRecipe recipe = new ItemStampingRecipe(stack,InputHelper.toFluid(liquid), EnumStampType.getType(stampStack),InputHelper.toStack(output),stack.getMetadata() != OreDictionary.WILDCARD_VALUE,stack.hasTagCompound());
CraftTweakerAPI.apply(new Add(recipe));
}
示例13: add
import stanhebben.zenscript.annotations.ZenMethod; //导入依赖的package包/类
@ZenMethod
public static void add(IItemStack output,@NotNull IItemStack[] input, int ironMin, int ironMax, int copperMin, int copperMax, int leadMin, int leadMax, int silverMin, int silverMax, int dawnstoneMin, int dawnstoneMax) {
AlchemyRecipe recipe = new AlchemyRecipe(ironMin,ironMax,
dawnstoneMin,dawnstoneMax,
copperMin,copperMax,
silverMin,silverMax,
leadMin,leadMax,
InputHelper.toStack(input[0]),InputHelper.toStack(input[1]),InputHelper.toStack(input[2]),InputHelper.toStack(input[3]),InputHelper.toStack(input[4]),
InputHelper.toStack(output));
CraftTweakerAPI.apply(new Add(recipe));
}
示例14: addFuelBlock
import stanhebben.zenscript.annotations.ZenMethod; //导入依赖的package包/类
@ZenMethod
public static void addFuelBlock(IItemStack block) {
if (!InputHelper.isABlock(block))
MineTweakerAPI.logError(block + " Input MUST be a block!");
ItemStack stack = InputHelper.toStack(block);
ItemBlock itemBlock = (ItemBlock) stack.getItem();
IBlockState state = itemBlock.getBlock().getStateFromMeta(stack.getMetadata());
MineTweakerAPI.apply(new AddFuel(state));
}
示例15: setChance
import stanhebben.zenscript.annotations.ZenMethod; //导入依赖的package包/类
@ZenMethod
public RecipePrimer setChance(float chance) {
if(lastComponent != null) {
if(lastComponent instanceof ComponentRequirement.ChancedRequirement) {
((ComponentRequirement.ChancedRequirement) lastComponent).setChance(chance);
} else {
CraftTweakerAPI.logWarning("Cannot set chance for not-chance-based Component: " + lastComponent.getClass().toString());
}
}
return this;
}