当前位置: 首页>>代码示例>>Java>>正文


Java LootTableLoadEvent.getTable方法代码示例

本文整理汇总了Java中net.minecraftforge.event.LootTableLoadEvent.getTable方法的典型用法代码示例。如果您正苦于以下问题:Java LootTableLoadEvent.getTable方法的具体用法?Java LootTableLoadEvent.getTable怎么用?Java LootTableLoadEvent.getTable使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在net.minecraftforge.event.LootTableLoadEvent的用法示例。


在下文中一共展示了LootTableLoadEvent.getTable方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onLootTableLoad

import net.minecraftforge.event.LootTableLoadEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void onLootTableLoad(LootTableLoadEvent evt) 
{
	LootTable table = evt.getTable();
	
	FyrestonePool lp = new FyrestonePool();
	
	if (evt.getName() == LootTableList.CHESTS_SIMPLE_DUNGEON)
	{
		lp.addItem(createLootEntry(ItemRegister.itemMysticalOrb, 0, 1, 1, 0.25));
	}
	
	if (evt.getName() == LootTableList.CHESTS_JUNGLE_TEMPLE)
	{
		lp.addItem(createLootEntry(ItemRegister.itemMysticalOrb, 0, 1, 1, 0.3));
	}
	
	if (evt.getName() == LootTableList.CHESTS_VILLAGE_BLACKSMITH)
	{
		lp.addItem(createLootEntry(ItemRegister.itemMysticalOrb, 0, 1, 1, 0.25));
	}
	
	if (evt.getName() == LootTableList.ENTITIES_ENDERMAN)
	{
		lp.addItem(createLootEntry(ItemRegister.itemMysticalOrb, 0, 1, 1, 0.1));
	}
	
	if (!lp.isEmpty())
	{
		table.addPool(lp);
	}
}
 
开发者ID:gunnerwolf,项目名称:Fyrestone,代码行数:33,代码来源:LootHandler.java

示例2: onLootTableLoad

import net.minecraftforge.event.LootTableLoadEvent; //导入方法依赖的package包/类
@SubscribeEvent
public static void onLootTableLoad(LootTableLoadEvent e) {
	final ResourceLocation rl = e.getName();
	if (rl.equals(LootTableList.CHESTS_VILLAGE_BLACKSMITH) || rl.equals(LootTableList.CHESTS_ABANDONED_MINESHAFT) || rl.equals(LootTableList.CHESTS_JUNGLE_TEMPLE)) {
		final LootTable lt = e.getTable();
		LootPool lp = lt.getPool("pool0");
		if (lp == null)
			lp = lt.getPool("main");
		if (lp != null) {
			lp.addEntry(new LootEntryItem(MCFluxResources.UPCHIP, 20, 0, new LootFunction[0], new LootCondition[0], "mcflux:loot/upchip"));
		}
	}
}
 
开发者ID:Szewek,项目名称:Minecraft-Flux,代码行数:14,代码来源:MCFluxEvents.java

示例3: onLootLoad

import net.minecraftforge.event.LootTableLoadEvent; //导入方法依赖的package包/类
@SubscribeEvent(priority= EventPriority.NORMAL)
public void onLootLoad(LootTableLoadEvent event){
	if(event.getName().getResourceDomain().equals("minecraft") == false) return; // loot table from another mod (too fancy for ALT)
	String categoryAndEntry = event.getName().getResourcePath(); // e.g. "chests/abandoned_mineshaft"
	if(categoryAndEntry.contains("/") == false) return; // not valid
	// category is "chests" or "entities"
	String category = categoryAndEntry.substring(0,categoryAndEntry.indexOf('/'));
	// entry is the name of the loot table (e.g. "abandoned_mineshaft")
	String entry = categoryAndEntry.substring(categoryAndEntry.indexOf('/')+1,categoryAndEntry.length());
	final Map<String, Map<String, List<LootPool>>> additional_loot = AdditionalLootTables.getAdditionalLootTables();
	if(additional_loot.containsKey(category)
			&& additional_loot.get(category).containsKey(entry)){
		List<LootPool> pools = additional_loot.get(category).get(entry);
		if(pools == null || pools.isEmpty()) return; // nothing to add
		if(event.getTable() == null) {
			// table was removed by another mod
			FMLLog.info("%s: creating new loot table %s", MODID, event.getName());
			event.setTable(new LootTable(pools.toArray(new LootPool[pools.size()])));
		} else {
			// table exists, add pools to it
			FMLLog.info("%s: adding more loot to loot table %s", MODID, event.getName());
			for (LootPool pool : pools) {
				event.getTable().addPool(pool);
			}
		}
	}
}
 
开发者ID:cyanobacterium,项目名称:AdditionalLootTables,代码行数:28,代码来源:ALTEventHandler.java

示例4: onLootTableLoad

import net.minecraftforge.event.LootTableLoadEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void onLootTableLoad (LootTableLoadEvent event) {

    final LootTable table = event.getTable();

    if (skeletonDropDust && event.getName().equals(LootTableList.ENTITIES_WITHER_SKELETON)) {

        final LootPool pool1 = table.getPool("pool1");

        if (pool1 != null) {
            pool1.addEntry(new LootEntryItem(itemMaterial, dustDropWeight, 0, new LootFunction[0], new LootCondition[0], DarkUtils.MOD_ID + ":wither_dust"));
        }
    }
}
 
开发者ID:Darkhax-Minecraft,项目名称:Dark-Utilities,代码行数:15,代码来源:FeatureMaterial.java


注:本文中的net.minecraftforge.event.LootTableLoadEvent.getTable方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。