use of stanhebben.zenscript.annotations.ZenMethod in project GregTech by GregTechCEu.
the class MaterialPropertyExpansion method addFluid.
@ZenMethod
public static void addFluid(Material m, @Optional FluidType fluidType, @Optional boolean hasBlock) {
if (checkFrozen("add a Fluid to a material"))
return;
FluidType type = validateFluidTypeNoPlasma(fluidType == null ? null : fluidType.getName());
if (m.hasProperty(PropertyKey.FLUID)) {
m.getProperty(PropertyKey.FLUID).setIsGas(type == FluidTypes.GAS);
m.getProperty(PropertyKey.FLUID).setHasBlock(hasBlock);
} else
m.setProperty(PropertyKey.FLUID, new FluidProperty(type, hasBlock));
}
use of stanhebben.zenscript.annotations.ZenMethod in project GregTech by GregTechCEu.
the class MaterialPropertyExpansion method addFluid.
@ZenMethod
public static void addFluid(Material m, @Optional String fluidTypeName, @Optional boolean hasBlock) {
if (checkFrozen("add a Fluid to a material"))
return;
FluidType type = validateFluidTypeNoPlasma(fluidTypeName);
if (m.hasProperty(PropertyKey.FLUID)) {
m.getProperty(PropertyKey.FLUID).setIsGas(type == FluidTypes.GAS);
m.getProperty(PropertyKey.FLUID).setHasBlock(hasBlock);
} else
m.setProperty(PropertyKey.FLUID, new FluidProperty(type, hasBlock));
}
use of stanhebben.zenscript.annotations.ZenMethod in project gugu-utils by ParaParty.
the class RecipePrimerExt method addAspcetInput.
// ----------------------------------------------------------------------------------------------
// aspect
// ----------------------------------------------------------------------------------------------
@ZenMethod
public static RecipePrimer addAspcetInput(RecipePrimer primer, int amount, String aspectTag) {
Aspect aspect = Aspect.getAspect(aspectTag);
if (aspect == null) {
GuGuUtils.logger.warn("Couldn't find aspect " + aspectTag);
}
primer.appendComponent(RequirementAspect.createInput(amount, aspect));
return primer;
}
use of stanhebben.zenscript.annotations.ZenMethod in project gugu-utils by ParaParty.
the class RecipePrimerExt method addAspcetOutput.
@ZenMethod
public static RecipePrimer addAspcetOutput(RecipePrimer primer, int amount, String aspectTag) {
Aspect aspect = Aspect.getAspect(aspectTag);
if (aspect == null) {
GuGuUtils.logger.warn("Couldn't find aspect " + aspectTag);
}
primer.appendComponent(new RequirementAspectOutput(amount, aspect));
return primer;
}
use of stanhebben.zenscript.annotations.ZenMethod in project ExtendedCrafting by BlakeBr0.
the class TableCrafting method addShapedMirrored.
@ZenMethod
public static void addShapedMirrored(int tier, IItemStack output, IIngredient[][] ingredients) {
if (tier > 4 || tier < 0) {
CraftTweakerAPI.getLogger().logError("Unable to assign a tier to the Table Recipe for stack " + output.getDisplayName() + ". Tier cannot be greater than 4 or less than 0.");
tier = 0;
}
int height = ingredients.length;
int width = 0;
for (IIngredient[] row : ingredients) {
if (width < row.length) {
width = row.length;
}
}
NonNullList<Ingredient> input = NonNullList.withSize(height * width, Ingredient.EMPTY);
Map<Integer, Function<ItemStack, ItemStack>> transformers = new HashMap<>();
int i = 0;
for (int a = 0; a < height; a++) {
for (int b = 0; b < ingredients[a].length; b++) {
IIngredient iing = ingredients[a][b];
Ingredient ing = CraftingHelper.getIngredient(toObject(iing));
if (ing == null) {
ing = Ingredient.EMPTY;
}
i = a * width + b;
input.set(i, ing);
if (ing != Ingredient.EMPTY && iing.hasNewTransformers()) {
transformers.put(i, stack -> {
IItemStack istack = iing.applyNewTransform(CraftTweakerMC.getIItemStack(stack));
ItemStack transformed = CraftTweakerMC.getItemStack(istack);
return transformed;
});
}
}
}
CraftTweakerAPI.apply(new Add(new TableRecipeShaped(tier, toStack(output), width, height, input).setMirrored(true).withTransformers(transformers)));
}
Aggregations