/
ExpandIIngredient.java
44 lines (36 loc) · 1.9 KB
/
ExpandIIngredient.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
package com.blamejared.crafttweaker.impl.ingredients;
import com.blamejared.crafttweaker.api.annotations.ZenRegister;
import com.blamejared.crafttweaker.api.item.IIngredient;
import com.blamejared.crafttweaker.api.item.IItemStack;
import com.blamejared.crafttweaker.api.item.transformed.IIngredientTransformer;
import com.blamejared.crafttweaker.impl.ingredients.transform.*;
import com.blamejared.crafttweaker.impl.item.transformed.MCIngredientTransformed;
import org.openzen.zencode.java.ZenCodeType;
import java.util.function.Function;
@ZenCodeType.Expansion("crafttweaker.api.item.IIngredient")
@ZenRegister
public class ExpandIIngredient {
@ZenCodeType.Method
public static MCIngredientTransformed<IIngredient> transformReplace(IIngredient _this, IItemStack replaceWith) {
return new MCIngredientTransformed<>(_this, new TransformReplace<>(replaceWith));
}
@ZenCodeType.Method
public static MCIngredientTransformed<IIngredient> transformDamage(IIngredient _this, @ZenCodeType.OptionalInt(1) int amount) {
return new MCIngredientTransformed<>(_this, new TransformDamage<>(amount));
}
@ZenCodeType.Method
public static MCIngredientTransformed<IIngredient> transformCustom(IIngredient _this, String uid, @ZenCodeType.Optional Function<IItemStack, IItemStack> function) {
return new MCIngredientTransformed<>(_this, new TransformCustom<>(uid, function));
}
@ZenCodeType.Method
public static MCIngredientTransformed<IIngredient> reuse(IIngredient _this) {
return new MCIngredientTransformed<>(_this, new TransformReuse<>());
}
/**
* Use this if you already have the transformer from another ingredient
*/
@ZenCodeType.Method
public static MCIngredientTransformed<IIngredient> transform(IIngredient _this, IIngredientTransformer<IIngredient> transformer) {
return new MCIngredientTransformed<>(_this, transformer);
}
}