SummoningInfo
Link to summoninginfo
导入类
Link to 导入类
It might be required for you to import the package if you encounter any issues (like casting an Array), so better be safe than sorry and add the import at the very top of the file.
ZenScript Copyimport mods.zensummoning.SummoningInfo;
Static Methods
Link to static-methods
Name: create
Creates a new SummoningInfo with default values.
See other methods for adding more customization.
Same as constructor.
Returns: new info
Return Type: SummoningInfo
ZenScript Copy// SummoningInfo.create() as SummoningInfo
SummoningInfo.create();
Constructor #构造函数
Link to constructor-构造函数
No Description Provided
ZenScript Copynew SummoningInfo() as SummoningInfo
new SummoningInfo();
使用方式
Link to 使用方式
Name: addCondition
Adds an additional condition for the summoning to work. This can be used to require a gamestage (or deny one I guess)
Returns: self
Return Type: SummoningInfo
ZenScript Copy// SummoningInfo.addCondition(condition as Predicate<SummoningAttempt>, failureMessage as string, jeiDescription as string) as SummoningInfo
mySummoningInfo.addCondition(Predicate for summoning to succeed, Chat message to show on failure, Line to show in JEI preview);
参数 | 类型 | 描述 |
---|---|---|
参数 condition | 类型 Predicate<SummoningAttempt> | 描述 condition |
参数 failureMessage | 类型 string | 描述 chat message on failure |
参数 jeiDescription | 类型 string | 描述 No Description Provided |
Name: addMob
Adds a new mob to the summoning. Returns itself for builder pattern.
Returns: self SummoningInfo for builder pattern
Return Type: SummoningInfo
ZenScript Copy// SummoningInfo.addMob(info as MobInfo) as SummoningInfo
mySummoningInfo.addMob(MobInfo.create().setMob("minecraft:zombie"));
参数 | 类型 | 描述 |
---|---|---|
参数 info | 类型 MobInfo | 描述 mob to add |
Name: setCatalyst
Sets the catalyst that will be used to start the ritual.
Returns: self
Return Type: SummoningInfo
ZenScript Copy// SummoningInfo.setCatalyst(ingredient as IIngredientWithAmount) as SummoningInfo
mySummoningInfo.setCatalyst(<item:minecraft:stick> * 2);
参数 | 类型 | 描述 |
---|---|---|
参数 ingredient | 类型 IIngredientWithAmount | 描述 catalyst |
Name: setConsumeCatalyst
Determines whether or not the catalyst will be consumed.
Returns: self
Return Type: SummoningInfo
ZenScript Copy// SummoningInfo.setConsumeCatalyst(value as boolean) as SummoningInfo
mySummoningInfo.setConsumeCatalyst(false);
参数 | 类型 | 描述 |
---|---|---|
参数 value | 类型 布尔值 | 描述 consumed |
Name: setMutator
Custom callback to determine if a summon should be allowed.
Returns: self
Return Type: SummoningInfo
ZenScript Copy// SummoningInfo.setMutator(mutator as Consumer<SummoningAttempt>) as SummoningInfo
mySummoningInfo.setMutator((attempt as SummoningAttempt) => {
if (attempt.world.raining) {
attempt.success = false;
attempt.message = "Can't summon this in the rain!";
} else {
attempt.message = "Good Luck!";
}
});
参数 | 类型 | 描述 |
---|---|---|
参数 mutator | 类型 Consumer<SummoningAttempt> | 描述 callback |
Name: setReagents
Sets the ingredients to be required to start the summon.
Returns: self
Return Type: SummoningInfo
ZenScript Copy// SummoningInfo.setReagents(reagents as IIngredientWithAmount[]) as SummoningInfo
mySummoningInfo.setReagents([<item:minecraft:stone>, <item:minecraft:egg>*12]);
参数 | 类型 | 描述 |
---|---|---|
参数 reagents | 类型 IIngredientWithAmount[] | 描述 ingredient list |
Name: setSound
Sets the sound played when a summon completes.
Returns: self
Return Type: SummoningInfo
ZenScript Copy// SummoningInfo.setSound(sound as string) as SummoningInfo
mySummoningInfo.setSound("entity.evoker.prepare_wololo");
参数 | 类型 | 描述 |
---|---|---|
参数 sound | 类型 string | 描述 sound resource location |
Name: setWeight
Sets the weight that this summoning has. Summonings with the same catalyst and reagents are determined randomly using this.
Returns: self
Return Type: SummoningInfo
ZenScript Copy// SummoningInfo.setWeight(weight as double) as SummoningInfo
mySummoningInfo.setWeight(3);
参数 | 类型 | 描述 |
---|---|---|
参数 weight | 类型 double | 描述 |