Class GlobalLootModifierProvider

java.lang.Object
net.minecraftforge.common.data.GlobalLootModifierProvider
All Implemented Interfaces:
DataProvider
Direct Known Subclasses:
GlobalLootModifiersTest.DataProvider

public abstract class GlobalLootModifierProvider extends Object implements DataProvider
Provider for forge's GlobalLootModifier system. See LootModifier This provider only requires implementing start() and calling add(java.lang.String, T) from it.
  • Field Details

    • GSON

      private static final com.google.gson.Gson GSON
    • output

      private final PackOutput output
    • modid

      private final String modid
    • toSerialize

      private final Map<String,com.google.gson.JsonElement> toSerialize
    • replace

      private boolean replace
  • Constructor Details

    • GlobalLootModifierProvider

      public GlobalLootModifierProvider(PackOutput output, String modid)
  • Method Details

    • replacing

      protected void replacing()
      Sets the "replace" key in global_loot_modifiers to true.
    • start

      protected abstract void start()
      Call add(java.lang.String, T) here, which will pass in the necessary information to write the jsons.
    • run

      public CompletableFuture<?> run(CachedOutput cache)
      Specified by:
      run in interface DataProvider
    • add

      public <T extends IGlobalLootModifier> void add(String modifier, T instance)
      Passes in the data needed to create the file without any extra objects.
      Parameters:
      modifier - The name of the modifier, which will be the file name.
      instance - The instance to serialize
    • getName

      public String getName()
      Specified by:
      getName in interface DataProvider