use of net.minecraft.world.storage.loot.LootEntry in project ImmersiveEngineering by BluSunrize.
the class EventHandler method lootLoad.
@SubscribeEvent
public void lootLoad(LootTableLoadEvent event) {
if (event.getName().getNamespace().equals("minecraft"))
for (ResourceLocation inject : lootInjections) if (event.getName().getPath().equals(inject.getPath())) {
LootPool injectPool = Utils.loadBuiltinLootTable(inject, event.getLootTableManager()).getPool("immersiveengineering_loot_inject");
LootPool mainPool = event.getTable().getPool("main");
if (injectPool != null && mainPool != null)
try {
if (f_lootEntries == null) {
// field_186453_a is srg for lootEntries
f_lootEntries = LootPool.class.getDeclaredField(ObfuscationReflectionHelper.remapFieldNames(LootPool.class.getName(), "field_186453_a")[0]);
f_lootEntries.setAccessible(true);
}
if (f_lootEntries != null) {
List<LootEntry> entryList = (List<LootEntry>) f_lootEntries.get(injectPool);
for (LootEntry entry : entryList) mainPool.addEntry(entry);
}
} catch (Exception e) {
e.printStackTrace();
}
}
}
Aggregations