Package net.minecraftforge.common.data
Class GlobalLootModifierProvider
- java.lang.Object
-
- net.minecraftforge.common.data.GlobalLootModifierProvider
-
- All Implemented Interfaces:
IDataProvider
- Direct Known Subclasses:
GlobalLootModifiersTest.DataProvider
public abstract class GlobalLootModifierProvider extends java.lang.Object implements IDataProvider
Provider for forge's GlobalLootModifier system. SeeLootModifier
andGlobalLootModifierSerializer
. This provider only requires implementingstart()
and callingadd(java.lang.String, net.minecraftforge.common.loot.GlobalLootModifierSerializer<T>, T)
from it.
-
-
Field Summary
Fields Modifier and Type Field Description private DataGenerator
gen
private static com.google.gson.Gson
GSON
private java.lang.String
modid
private boolean
replace
private java.util.Map<java.lang.String,Tuple<GlobalLootModifierSerializer<?>,com.google.gson.JsonObject>>
toSerialize
-
Fields inherited from interface net.minecraft.data.IDataProvider
SHA1
-
-
Constructor Summary
Constructors Constructor Description GlobalLootModifierProvider(DataGenerator gen, java.lang.String modid)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description <T extends IGlobalLootModifier>
voidadd(java.lang.String modifier, GlobalLootModifierSerializer<T> serializer, T instance)
Passes in the data needed to create the file without any extra objects.java.lang.String
getName()
protected void
replacing()
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 Detail
-
GSON
private static final com.google.gson.Gson GSON
-
gen
private final DataGenerator gen
-
modid
private final java.lang.String modid
-
toSerialize
private final java.util.Map<java.lang.String,Tuple<GlobalLootModifierSerializer<?>,com.google.gson.JsonObject>> toSerialize
-
replace
private boolean replace
-
-
Constructor Detail
-
GlobalLootModifierProvider
public GlobalLootModifierProvider(DataGenerator gen, java.lang.String modid)
-
-
Method Detail
-
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
public void run(DirectoryCache cache) throws java.io.IOException
- Specified by:
run
in interfaceIDataProvider
- Throws:
java.io.IOException
-
add
public <T extends IGlobalLootModifier> void add(java.lang.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
public java.lang.String getName()
- Specified by:
getName
in interfaceIDataProvider
-
-