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


Java WeightedRandomLoot类代码示例

本文整理汇总了Java中thaumcraft.api.internal.WeightedRandomLoot的典型用法代码示例。如果您正苦于以下问题:Java WeightedRandomLoot类的具体用法?Java WeightedRandomLoot怎么用?Java WeightedRandomLoot使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: addLootBagItem

import thaumcraft.api.internal.WeightedRandomLoot; //导入依赖的package包/类
/**
 * Used to add possible loot to treasure bags. As a reference, the weight of gold coins are 2000
 * and a diamond is 50. The weights are the same for all loot bag types - the only difference is
 * how many items the bag contains.
 * 
 * @param item
 * @param weight
 * @param bagTypes
 *        array of which type of bag to add this loot to. Multiple types can be specified 0 =
 *        common, 1 = uncommon, 2 = rare
 */
public static void addLootBagItem(ItemStack item, int weight, int... bagTypes) {
	if ( (bagTypes == null) || (bagTypes.length == 0)) {
		WeightedRandomLoot.lootBagCommon.add(new WeightedRandomLoot(item, weight));
	}
	else {
		for (int rarity : bagTypes) {
			switch (rarity) {
				case 0:
					WeightedRandomLoot.lootBagCommon.add(new WeightedRandomLoot(item, weight));
					break;
				case 1:
					WeightedRandomLoot.lootBagUncommon.add(new WeightedRandomLoot(item, weight));
					break;
				case 2:
					WeightedRandomLoot.lootBagRare.add(new WeightedRandomLoot(item, weight));
					break;
			}
		}
	}
}
 
开发者ID:PrincessRTFM,项目名称:TweakCraft,代码行数:32,代码来源:ThaumcraftApi.java

示例2: addLootBagItem

import thaumcraft.api.internal.WeightedRandomLoot; //导入依赖的package包/类
/**
 * Used to add possible loot to treasure bags. As a reference, the weight of gold coins are 2000
 * and a diamond is 50.
 * The weights are the same for all loot bag types - the only difference is how many items the bag
 * contains.
 *
 * @param item
 * @param weight
 * @param bagTypes array of which type of bag to add this loot to. Multiple types can be specified
 *                 0 = common, 1 = uncommon, 2 = rare
 */
public static void addLootBagItem(ItemStack item, int weight, int... bagTypes)
{
    if(bagTypes == null || bagTypes.length == 0)
        WeightedRandomLoot.lootBagCommon.add(new WeightedRandomLoot(item, weight));
    else
    {
        for(int rarity : bagTypes)
        {
            switch(rarity)
            {
                case 0:
                    WeightedRandomLoot.lootBagCommon.add(new WeightedRandomLoot(item, weight));
                    break;
                case 1:
                    WeightedRandomLoot.lootBagUncommon.add(new WeightedRandomLoot(item, weight));
                    break;
                case 2:
                    WeightedRandomLoot.lootBagRare.add(new WeightedRandomLoot(item, weight));
                    break;
            }
        }
    }
}
 
开发者ID:J3FF97,项目名称:Steel-Industries,代码行数:35,代码来源:ThaumcraftApi.java

示例3: addLootBagItem

import thaumcraft.api.internal.WeightedRandomLoot; //导入依赖的package包/类
/**
 * Used to add possible loot to treasure bags. As a reference, the weight of gold coins are 2000
 * and a diamond is 50.
 * The weights are the same for all loot bag types - the only difference is how many items the bag
 * contains.
 * @param item
 * @param weight
 * @param bagTypes array of which type of bag to add this loot to. Multiple types can be specified
 * 0 = common, 1 = uncommon, 2 = rare
 */
public static void addLootBagItem(ItemStack item, int weight, int... bagTypes) {
    if (bagTypes == null || bagTypes.length == 0) {
        WeightedRandomLoot.lootBagCommon.add(new WeightedRandomLoot(item, weight));
    } else {
        for (int rarity : bagTypes) {
            switch (rarity) {
                case 0:
                    WeightedRandomLoot.lootBagCommon.add(new WeightedRandomLoot(item, weight));
                    break;
                case 1:
                    WeightedRandomLoot.lootBagUncommon.add(new WeightedRandomLoot(item, weight));
                    break;
                case 2:
                    WeightedRandomLoot.lootBagRare.add(new WeightedRandomLoot(item, weight));
                    break;
            }
        }
    }
}
 
开发者ID:AgileMods,项目名称:MateriaMuto,代码行数:30,代码来源:ThaumcraftApi.java

示例4: addLootBagItem

import thaumcraft.api.internal.WeightedRandomLoot; //导入依赖的package包/类
/**
 * Used to add possible loot to treasure bags. As a reference, the weight of gold coins are 2000 
 * and a diamond is 50.
 * The weights are the same for all loot bag types - the only difference is how many items the bag
 * contains.
 * @param item
 * @param weight
 * @param bagTypes array of which type of bag to add this loot to. Multiple types can be specified
 * 0 = common, 1 = uncommon, 2 = rare
 */
public static void addLootBagItem(ItemStack item, int weight, int... bagTypes) {
	if (bagTypes==null || bagTypes.length==0)
		WeightedRandomLoot.lootBagCommon.add(new WeightedRandomLoot(item,weight));
	else {
		for (int rarity:bagTypes) {
			switch(rarity) {
				case 0: WeightedRandomLoot.lootBagCommon.add(new WeightedRandomLoot(item,weight)); break;
				case 1: WeightedRandomLoot.lootBagUncommon.add(new WeightedRandomLoot(item,weight)); break;
				case 2: WeightedRandomLoot.lootBagRare.add(new WeightedRandomLoot(item,weight)); break;
			}
		}
	}
}
 
开发者ID:Brandomine,项目名称:Augury,代码行数:24,代码来源:ThaumcraftApi.java


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