Class CriterionBuilder

java.lang.Object
net.minheur.techno_lib.advancement.CriterionBuilder

public class CriterionBuilder extends Object
Helper class to build a criterion
  • Field Details

    • criterion

      private final com.google.gson.JsonObject criterion
      The 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 an ItemLike and min / max count. Set count to 0 to not set it.
      Parameters:
      item - the ItemLike you want to add
      minCount - the minimum amount of item you need
      maxCount - the maximum amount of item you need
      Returns:
      the built condition.
    • itemCondition

      public CriterionBuilder itemCondition(net.minecraft.world.level.ItemLike item, int minCount)
      create a condition with an ItemLike and min count. Remember to set the int AFTER the item.
      Parameters:
      item - the ItemLike you want to add
      minCount - the minimum amount of item you need
      Returns:
      the built condition.
    • itemCondition

      public CriterionBuilder itemCondition(int maxCount, net.minecraft.world.level.ItemLike item)
      create a condition with an ItemLike and min count. Remember to set the int BEFORE the item.
      Parameters:
      item - the ItemLike you want to add
      maxCount - the maximum amount of item you need
      Returns:
      the built condition.
    • itemCondition

      public CriterionBuilder itemCondition(net.minecraft.world.level.ItemLike item)
      create a condition with an ItemLike.
      Parameters:
      item - the ItemLike you 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 add
      minCount - the minimum amount of item you need
      maxCount - 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 add
      minCount - 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 add
      maxCount - 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)
      create a condition with a tag.
      Parameters:
      tag - the tag you want to add
      Returns:
      the built condition
    • condition

      public CriterionBuilder condition(String item, String type, int minCount, int maxCount)
      the main condition builder.
      Parameters:
      item - the item id you want to add (ex. minecraft:stone)
      type - the type. Only item and tag allowed.
      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

      public CriterionBuilder blockPlacedCondition(net.minecraft.world.level.block.Block pBlock)
      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