Class CriterionBuilder
java.lang.Object
net.minheur.techno_lib.advancement.CriterionBuilder
Helper class to build a criterion
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final com.google.gson.JsonObjectThe json where the criterion is stored. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionblockPlacedCondition(net.minecraft.world.level.block.Block pBlock) Create a condition for placing a blockcom.google.gson.JsonObjectbuild()finish the build of your criterionthe main condition builder.itemCondition(int maxCount, net.minecraft.world.level.ItemLike item) create a condition with anItemLikeand min count.itemCondition(net.minecraft.world.level.ItemLike item) create a condition with anItemLike.itemCondition(net.minecraft.world.level.ItemLike item, int minCount) create a condition with anItemLikeand min count.itemCondition(net.minecraft.world.level.ItemLike item, int minCount, int maxCount) create a condition with anItemLikeand min / max count.tagCondition(int maxCount, net.minecraft.tags.TagKey<net.minecraft.world.item.Item> tag) create a condition with a tag and min count.tagCondition(net.minecraft.tags.TagKey<net.minecraft.world.item.Item> tag) create a condition with a tag.tagCondition(net.minecraft.tags.TagKey<net.minecraft.world.item.Item> tag, int minCount) create a condition with a tag and min count.tagCondition(net.minecraft.tags.TagKey<net.minecraft.world.item.Item> tag, int minCount, int maxCount) create a condition with a tag and min / max count.
-
Field Details
-
criterion
private final com.google.gson.JsonObject criterionThe json where the criterion is stored. The properties are written in slowly
-
-
Constructor Details
-
CriterionBuilder
public CriterionBuilder(net.minecraft.resources.ResourceLocation trigger)
-
-
Method Details
-
itemCondition
public CriterionBuilder itemCondition(net.minecraft.world.level.ItemLike item, int minCount, int maxCount) create a condition with anItemLikeand min / max count. Set count to 0 to not set it.- Parameters:
item- theItemLikeyou want to addminCount- the minimum amount of item you needmaxCount- the maximum amount of item you need- Returns:
- the built condition.
-
itemCondition
create a condition with anItemLikeand min count. Remember to set the int AFTER the item.- Parameters:
item- theItemLikeyou want to addminCount- the minimum amount of item you need- Returns:
- the built condition.
-
itemCondition
create a condition with anItemLikeand min count. Remember to set the int BEFORE the item.- Parameters:
item- theItemLikeyou want to addmaxCount- the maximum amount of item you need- Returns:
- the built condition.
-
itemCondition
create a condition with anItemLike.- Parameters:
item- theItemLikeyou want to add- Returns:
- the built condition
-
tagCondition
public CriterionBuilder tagCondition(net.minecraft.tags.TagKey<net.minecraft.world.item.Item> tag, int minCount, int maxCount) create a condition with a tag and min / max count. Set count to 0 to not set it.- Parameters:
tag- the tag you want to addminCount- the minimum amount of item you needmaxCount- the maximum amount of item you need- Returns:
- the built condition.
-
tagCondition
public CriterionBuilder tagCondition(net.minecraft.tags.TagKey<net.minecraft.world.item.Item> tag, int minCount) create a condition with a tag and min count. Remember to set the int AFTER the item.- Parameters:
tag- the tag you want to addminCount- the minimum amount of item you need- Returns:
- the built condition.
-
tagCondition
public CriterionBuilder tagCondition(int maxCount, net.minecraft.tags.TagKey<net.minecraft.world.item.Item> tag) create a condition with a tag and min count. Remember to set the int BEFORE the item.- Parameters:
tag- the tag you want to addmaxCount- the maximum amount of item you need- Returns:
- the built condition.
-
tagCondition
create a condition with a tag.- Parameters:
tag- the tag you want to add- Returns:
- the built condition
-
condition
the main condition builder.- Parameters:
item- the item id you want to add (ex. minecraft:stone)type- the type. Onlyitemandtagallowed.minCount- the minimum amount you need. Set 0 to not set.maxCount- the maximum amount you need. Set 0 to net set.- Returns:
- a built condition
-
blockPlacedCondition
Create a condition for placing a block- Parameters:
pBlock- the block to place- Returns:
- the built condition
-
build
public com.google.gson.JsonObject build()finish the build of your criterion- Returns:
- the json you built
-