Class GlobalLootModifierProvider
java.lang.Object
net.neoforged.neoforge.common.data.GlobalLootModifierProvider
- All Implemented Interfaces:
DataProvider
Provider for forge's GlobalLootModifier system. See
LootModifier
This provider only requires implementing start()
and calling add(java.lang.String, T, java.util.List<net.neoforged.neoforge.common.conditions.ICondition>)
from it.-
Nested Class Summary
Nested classes/interfaces inherited from interface net.minecraft.data.DataProvider
DataProvider.Factory<T extends DataProvider>
-
Field Summary
Modifier and TypeFieldDescriptionprivate static final com.google.gson.Gson
private final String
private final PackOutput
protected HolderLookup.Provider
private final CompletableFuture
<HolderLookup.Provider> private boolean
private final Map
<String, WithConditions<IGlobalLootModifier>> Fields inherited from interface net.minecraft.data.DataProvider
FIXED_ORDER_FIELDS, KEY_COMPARATOR, LOGGER
-
Constructor Summary
ConstructorDescriptionGlobalLootModifierProvider
(PackOutput output, CompletableFuture<HolderLookup.Provider> registries, String modid) -
Method Summary
Modifier and TypeMethodDescription<T extends IGlobalLootModifier>
voidadd
(String modifier, T instance, List<ICondition> conditions) Passes in the data needed to create the file without any extra objects.<T extends IGlobalLootModifier>
voidadd
(String modifier, T instance, ICondition... conditions) Passes in the data needed to create the file without any extra objects.getName()
protected void
Sets the "replace" key in global_loot_modifiers to true.final CompletableFuture
<?> run
(CachedOutput cache) protected CompletableFuture
<?> run
(CachedOutput cache, HolderLookup.Provider registries) protected abstract void
start()
Calladd(java.lang.String, T, java.util.List<net.neoforged.neoforge.common.conditions.ICondition>)
here, which will pass in the necessary information to write the jsons.
-
Field Details
-
GSON
private static final com.google.gson.Gson GSON -
output
-
registriesLookup
-
registries
-
modid
-
toSerialize
-
replace
private boolean replace
-
-
Constructor Details
-
GlobalLootModifierProvider
public GlobalLootModifierProvider(PackOutput output, CompletableFuture<HolderLookup.Provider> registries, String modid)
-
-
Method Details
-
replacing
protected void replacing()Sets the "replace" key in global_loot_modifiers to true. -
start
protected abstract void start()Calladd(java.lang.String, T, java.util.List<net.neoforged.neoforge.common.conditions.ICondition>)
here, which will pass in the necessary information to write the jsons. -
run
- Specified by:
run
in interfaceDataProvider
-
run
-
add
public <T extends IGlobalLootModifier> void add(String modifier, T instance, List<ICondition> conditions) 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 nameinstance
- the instance to serializeconditions
- a list of conditions to add to the GLM file
-
add
public <T extends IGlobalLootModifier> void add(String modifier, T instance, ICondition... conditions) 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 nameinstance
- the instance to serializeconditions
- a list of conditions to add to the GLM file
-
getName
- Specified by:
getName
in interfaceDataProvider
-