mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-21 12:42:26 +00:00
Fix LootTableLoadEvent not being fired. Closes #10144
This commit is contained in:
11 files changed
+171
-24
No files matched your search
@@ -88,6 +88,7 @@ import net.minecraft.world.level.material.Fluids;
|
||||
import net.minecraft.world.level.storage.LevelStorageSource;
|
||||
import net.minecraft.world.level.storage.WorldData;
|
||||
import net.minecraft.world.level.storage.loot.LootContext;
|
||||
import net.minecraft.world.level.storage.loot.LootDataType;
|
||||
import net.minecraft.world.level.storage.loot.LootPool;
|
||||
import net.minecraft.world.level.storage.loot.LootTable;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
@@ -1242,4 +1243,15 @@ public final class ForgeHooks {
|
||||
public static DataComponentMap gatherItemComponents(Item item, DataComponentMap dataComponents) {
|
||||
return DataComponentMap.composite(dataComponents, ForgeEventFactory.gatherItemComponentsEvent(item, dataComponents).getDataComponentMap());
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public static <T> T onJsonDataParsed(Codec<T> codec, ResourceLocation key, T value) {
|
||||
if (codec == LootDataType.TABLE.codec()) {
|
||||
var table = (LootTable)value;
|
||||
table.setLootTableId(key);
|
||||
value = (T)net.minecraftforge.event.ForgeEventFactory.onLoadLootTable(key, table);
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user