Package net.minecraftforge.common.data
Class GlobalLootModifierProvider
java.lang.Object
net.minecraftforge.common.data.GlobalLootModifierProvider
- All Implemented Interfaces:
IDataProvider
- Direct Known Subclasses:
GlobalLootModifiersTest.DataProvider
Provider for forge's GlobalLootModifier system. See
LootModifier
and GlobalLootModifierSerializer
.
This provider only requires implementing start()
and calling add(java.lang.String, net.minecraftforge.common.loot.GlobalLootModifierSerializer<T>, T)
from it.-
Field Summary
Modifier and TypeFieldDescriptionprivate final DataGenerator
private static final com.google.gson.Gson
private final String
private boolean
private final Map<String,
Tuple<GlobalLootModifierSerializer<?>, com.google.gson.JsonObject>> Fields inherited from interface net.minecraft.data.IDataProvider
SHA1
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescription<T extends IGlobalLootModifier>
voidadd
(String modifier, GlobalLootModifierSerializer<T> serializer, T instance) 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.void
run
(DirectoryCache cache) protected abstract void
start()
Calladd(java.lang.String, net.minecraftforge.common.loot.GlobalLootModifierSerializer<T>, T)
here, which will pass in the necessary information to write the jsons.
-
Field Details
-
GSON
private static final com.google.gson.Gson GSON -
gen
-
modid
-
toSerialize
private final Map<String,Tuple<GlobalLootModifierSerializer<?>, toSerializecom.google.gson.JsonObject>> -
replace
private boolean replace
-
-
Constructor Details
-
GlobalLootModifierProvider
-
-
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, net.minecraftforge.common.loot.GlobalLootModifierSerializer<T>, T)
here, which will pass in the necessary information to write the jsons. -
run
- Specified by:
run
in interfaceIDataProvider
- Throws:
IOException
-
add
public <T extends IGlobalLootModifier> void add(String modifier, GlobalLootModifierSerializer<T> serializer, 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.serializer
- The serializer of this modifier.conditions
- The loot conditions beforeLootModifier.doApply(java.util.List<net.minecraft.item.ItemStack>, net.minecraft.loot.LootContext)
is called.
-
getName
- Specified by:
getName
in interfaceIDataProvider
-