Class AdvancementProviderBase

java.lang.Object
org.moddingx.libx.datagen.provider.AdvancementProviderBase
All Implemented Interfaces:
net.minecraft.data.DataProvider

public abstract class AdvancementProviderBase extends Object implements net.minecraft.data.DataProvider
Base provider for custom advancements. If you want to have multiple advancement tabs, use multiple providers. Every provider has one root advancement. All advancements with no explicit parent will be added to it. You should configure your advancements with the root() and advancement(String) methods in setup.
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    class 
    An advancement factory can be used to customise an advancement in a builder style pattern.
    static interface 
    A task factory can define multiple tasks.

    Nested classes/interfaces inherited from interface net.minecraft.data.DataProvider

    net.minecraft.data.DataProvider.Factory<T extends net.minecraft.data.DataProvider>
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected final ModX
     
    protected final PackTarget
     

    Fields inherited from interface net.minecraft.data.DataProvider

    FIXED_ORDER_FIELDS, KEY_COMPARATOR, LOGGER
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    Adds an advancement to the provider identified by an id.
    void
    advancement(net.minecraft.advancements.Advancement advancement)
    Adds a built advancement to the provider.
    advancement(net.minecraft.resources.ResourceLocation id)
    Adds an advancement to the provider identified by its ResourceLocation.
    net.minecraft.advancements.CriterionTriggerInstance
    changeDim(net.minecraft.resources.ResourceKey<net.minecraft.world.level.Level> from, net.minecraft.resources.ResourceKey<net.minecraft.world.level.Level> to)
    Gets a criterion that requires a player to perform a specific dimension change.
    net.minecraft.advancements.Advancement
    dummy(net.minecraft.resources.ResourceLocation id)
    Creates a dummy advancement with a given id to be used as a parent if your advancement should have another advancement from another mod as parent.
    net.minecraft.advancements.Advancement
    dummy(net.minecraft.resources.ResourceLocation id, boolean hidden)
    Creates a dummy advancement with a given id to be used as a parent if your advancement should have another advancement from another mod as parent.
    net.minecraft.advancements.CriterionTriggerInstance
    eat(net.minecraft.advancements.critereon.ItemPredicate food)
    Gets a criterion that requires a player to consume (eat/drink) an item.
    net.minecraft.advancements.CriterionTriggerInstance
    eat(net.minecraft.tags.TagKey<net.minecraft.world.item.Item> food)
    Gets a criterion that requires a player to consume (eat/drink) an item.
    net.minecraft.advancements.CriterionTriggerInstance
    eat(net.minecraft.world.level.ItemLike food)
    Gets a criterion that requires a player to consume (eat/drink) an item.
    net.minecraft.advancements.CriterionTriggerInstance
    enter(net.minecraft.resources.ResourceKey<net.minecraft.world.level.Level> dimension)
    Gets a criterion that requires a player to enter a dimension.
    net.minecraft.advancements.critereon.ContextAwarePredicate
    entity(net.minecraft.advancements.critereon.EntityPredicate entity)
    Gets the given EntityPredicate as an ContextAwarePredicate.
    net.minecraft.advancements.critereon.ContextAwarePredicate
    entity(net.minecraft.world.entity.EntityType<?> type)
    Gets an ContextAwarePredicate that matches for a specific entity type.
     
    net.minecraft.advancements.CriterionTriggerInstance
    items(net.minecraft.advancements.critereon.ItemPredicate... items)
    Gets a criterion that requires all of the given items to be in the inventory at the same time.
    final net.minecraft.advancements.CriterionTriggerInstance
    items(net.minecraft.tags.TagKey<net.minecraft.world.item.Item>... items)
    Gets a criterion that requires all of the given items to be in the inventory at the same time.
    net.minecraft.advancements.CriterionTriggerInstance
    items(net.minecraft.world.level.ItemLike... items)
    Gets a criterion that requires all of the given items to be in the inventory at the same time.
    itemTasks(net.minecraft.advancements.critereon.ItemPredicate... items)
    Gets a AdvancementProviderBase.TaskFactory that adds a task for every item given to this method.
    itemTasks(net.minecraft.tags.TagKey<net.minecraft.world.item.Item>... items)
    Gets a AdvancementProviderBase.TaskFactory that adds a task for every item given to this method.
    itemTasks(net.minecraft.world.level.ItemLike... items)
    Gets a AdvancementProviderBase.TaskFactory that adds a task for every item given to this method.
    net.minecraft.advancements.CriterionTriggerInstance
    leave(net.minecraft.resources.ResourceKey<net.minecraft.world.level.Level> dimension)
    Gets a criterion that requires a player to leave a dimension.
    Gets an AdvancementProviderBase.AdvancementFactory to customise the root advancement for this provider.
    Gets an AdvancementProviderBase.AdvancementFactory to customise the root advancement for this provider.
    root(String namespace, String id)
    Gets an AdvancementProviderBase.AdvancementFactory to customise the root advancement for this provider.
    run(net.minecraft.data.CachedOutput cache)
     
    abstract void
     
    net.minecraft.advancements.critereon.ItemPredicate
    stack(net.minecraft.tags.TagKey<net.minecraft.world.item.Item> item, net.minecraft.world.item.enchantment.Enchantment... enchs)
    Gets an ItemPredicate for an item and optionally some enchantments.
    net.minecraft.advancements.critereon.ItemPredicate
    stack(net.minecraft.world.item.enchantment.Enchantment... enchs)
    Gets an ItemPredicate for some enchantments.
    net.minecraft.advancements.critereon.ItemPredicate
    stack(net.minecraft.world.item.enchantment.Enchantment ench, int min)
    Gets an ItemPredicate for an enchantment with a minimum level.
    net.minecraft.advancements.critereon.ItemPredicate
    stack(net.minecraft.world.level.ItemLike item, net.minecraft.world.item.enchantment.Enchantment... enchs)
    Gets an ItemPredicate for an item and optionally some enchantments.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • mod

      protected final ModX mod
    • packTarget

      protected final PackTarget packTarget
  • Constructor Details

    • AdvancementProviderBase

      public AdvancementProviderBase(DatagenContext ctx)
  • Method Details

    • setup

      public abstract void setup()
    • getName

      @Nonnull public String getName()
      Specified by:
      getName in interface net.minecraft.data.DataProvider
    • run

      @Nonnull public CompletableFuture<?> run(@Nonnull net.minecraft.data.CachedOutput cache)
      Specified by:
      run in interface net.minecraft.data.DataProvider
    • root

      Gets an AdvancementProviderBase.AdvancementFactory to customise the root advancement for this provider. The root id will be the modid.
      See Also:
    • root

      Gets an AdvancementProviderBase.AdvancementFactory to customise the root advancement for this provider.
      Parameters:
      id - The root id. The actual advancement id will be modid:id/root
      See Also:
    • root

      Gets an AdvancementProviderBase.AdvancementFactory to customise the root advancement for this provider.
      Parameters:
      namespace - The namespace of the root advancement.
      id - The root id. The actual advancement id will be namespace:id/root
    • advancement

      public void advancement(net.minecraft.advancements.Advancement advancement)
      Adds a built advancement to the provider.
    • advancement

      public AdvancementProviderBase.AdvancementFactory advancement(net.minecraft.resources.ResourceLocation id)
      Adds an advancement to the provider identified by its ResourceLocation. Returns an AdvancementProviderBase.AdvancementFactory to customise the advancement.
    • advancement

      Adds an advancement to the provider identified by an id. The ResourceLocation is built with the modid and the root advancement id. Returns an AdvancementProviderBase.AdvancementFactory to customise the advancement.
    • dummy

      public net.minecraft.advancements.Advancement dummy(net.minecraft.resources.ResourceLocation id)
      Creates a dummy advancement with a given id to be used as a parent if your advancement should have another advancement from another mod as parent.
    • dummy

      public net.minecraft.advancements.Advancement dummy(net.minecraft.resources.ResourceLocation id, boolean hidden)
      Creates a dummy advancement with a given id to be used as a parent if your advancement should have another advancement from another mod as parent.
      Parameters:
      hidden - Whether the advancement is hidden.
    • items

      public net.minecraft.advancements.CriterionTriggerInstance items(net.minecraft.world.level.ItemLike... items)
      Gets a criterion that requires all of the given items to be in the inventory at the same time.
    • items

      @SafeVarargs public final net.minecraft.advancements.CriterionTriggerInstance items(net.minecraft.tags.TagKey<net.minecraft.world.item.Item>... items)
      Gets a criterion that requires all of the given items to be in the inventory at the same time.
    • items

      public net.minecraft.advancements.CriterionTriggerInstance items(net.minecraft.advancements.critereon.ItemPredicate... items)
      Gets a criterion that requires all of the given items to be in the inventory at the same time.
    • itemTasks

      public AdvancementProviderBase.TaskFactory itemTasks(net.minecraft.world.level.ItemLike... items)
      Gets a AdvancementProviderBase.TaskFactory that adds a task for every item given to this method.
    • itemTasks

      @SafeVarargs public final AdvancementProviderBase.TaskFactory itemTasks(net.minecraft.tags.TagKey<net.minecraft.world.item.Item>... items)
      Gets a AdvancementProviderBase.TaskFactory that adds a task for every item given to this method.
    • itemTasks

      public AdvancementProviderBase.TaskFactory itemTasks(net.minecraft.advancements.critereon.ItemPredicate... items)
      Gets a AdvancementProviderBase.TaskFactory that adds a task for every item given to this method.
    • eat

      public net.minecraft.advancements.CriterionTriggerInstance eat(net.minecraft.world.level.ItemLike food)
      Gets a criterion that requires a player to consume (eat/drink) an item.
    • eat

      public net.minecraft.advancements.CriterionTriggerInstance eat(net.minecraft.tags.TagKey<net.minecraft.world.item.Item> food)
      Gets a criterion that requires a player to consume (eat/drink) an item.
    • eat

      public net.minecraft.advancements.CriterionTriggerInstance eat(net.minecraft.advancements.critereon.ItemPredicate food)
      Gets a criterion that requires a player to consume (eat/drink) an item.
    • leave

      public net.minecraft.advancements.CriterionTriggerInstance leave(net.minecraft.resources.ResourceKey<net.minecraft.world.level.Level> dimension)
      Gets a criterion that requires a player to leave a dimension.
    • enter

      public net.minecraft.advancements.CriterionTriggerInstance enter(net.minecraft.resources.ResourceKey<net.minecraft.world.level.Level> dimension)
      Gets a criterion that requires a player to enter a dimension.
    • changeDim

      public net.minecraft.advancements.CriterionTriggerInstance changeDim(net.minecraft.resources.ResourceKey<net.minecraft.world.level.Level> from, net.minecraft.resources.ResourceKey<net.minecraft.world.level.Level> to)
      Gets a criterion that requires a player to perform a specific dimension change.
    • entity

      public net.minecraft.advancements.critereon.ContextAwarePredicate entity(net.minecraft.advancements.critereon.EntityPredicate entity)
      Gets the given EntityPredicate as an ContextAwarePredicate.
    • entity

      public net.minecraft.advancements.critereon.ContextAwarePredicate entity(net.minecraft.world.entity.EntityType<?> type)
      Gets an ContextAwarePredicate that matches for a specific entity type.
    • stack

      public net.minecraft.advancements.critereon.ItemPredicate stack(net.minecraft.world.level.ItemLike item, net.minecraft.world.item.enchantment.Enchantment... enchs)
      Gets an ItemPredicate for an item and optionally some enchantments.
    • stack

      public net.minecraft.advancements.critereon.ItemPredicate stack(net.minecraft.tags.TagKey<net.minecraft.world.item.Item> item, net.minecraft.world.item.enchantment.Enchantment... enchs)
      Gets an ItemPredicate for an item and optionally some enchantments.
    • stack

      public net.minecraft.advancements.critereon.ItemPredicate stack(net.minecraft.world.item.enchantment.Enchantment... enchs)
      Gets an ItemPredicate for some enchantments.
    • stack

      public net.minecraft.advancements.critereon.ItemPredicate stack(net.minecraft.world.item.enchantment.Enchantment ench, int min)
      Gets an ItemPredicate for an enchantment with a minimum level.