net.minecraftforge.event.LootTableLoadEvent Java Examples

The following examples show how to use net.minecraftforge.event.LootTableLoadEvent. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: GTEventLootTableLoad.java    From GT-Classic with GNU Lesser General Public License v3.0 6 votes vote down vote up
@SubscribeEvent
public void onLootTableLoad(LootTableLoadEvent event) {
	/*
	 * Iterates both the stack array and resource location array to create a 2d
	 * table
	 */
	if (GTConfig.general.addLootItems) {
		for (ItemStack item : lootpool) {
			for (ResourceLocation table : loottable) {
				if (event.getName().equals(table)) {
					event.getTable().getPool("main").addEntry(new LootEntryItem(item.getItem(), 16, 0, new LootFunction[] {
							createCountFunction(1, 6) }, NO_CONDITIONS, getStackResourceName(item)));
				}
			}
		}
	}
}
 
Example #2
Source File: ChestGenHooks.java    From GregTech with GNU Lesser General Public License v3.0 5 votes vote down vote up
@SubscribeEvent
public void onWorldLoad(LootTableLoadEvent event) {
    LootPool mainPool = event.getTable().getPool("main");
    if (mainPool != null && lootEntryItems.containsKey(event.getName())) {
        ArrayList<LootEntryItem> entryItems = lootEntryItems.get(event.getName());
        for (LootEntryItem entry : entryItems) {
            mainPool.addEntry(entry);
        }
    }
    if (mainPool != null && rollVals.containsKey(event.getName())) {
        RandomValueRange rangeAdd = rollVals.get(event.getName());
        RandomValueRange range = mainPool.getRolls();
        mainPool.setRolls(new RandomValueRange(range.getMin() + rangeAdd.getMin(), range.getMax() + rangeAdd.getMax()));
    }
}
 
Example #3
Source File: SakuraEventLoader.java    From Sakura_mod with MIT License 4 votes vote down vote up
@SubscribeEvent
public static void onFishingLootLoaded(LootTableLoadEvent evt) {
       if (LOOT_LOCATIONS.contains(evt.getName().toString()))
           for (LootEntry entry : FishinglootPools)
           	evt.getTable().getPool("main").addEntry(entry); 
}