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


Java ChestGenHooks.generateStacks方法代码示例

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


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

示例1: generateRandomChestContents

import net.minecraftforge.common.ChestGenHooks; //导入方法依赖的package包/类
/**
 * Generates a number of random chest contents, placing them in the chest either completely
 * at random or only in empty slots, as designated by the parameters
 */
public static void generateRandomChestContents(Random rand, List<WeightedRandomChestContent> weightedContents, IInventory chest, int numItems, boolean atRandom) {
	for (int i = 0; i < numItems; ++i) {
		WeightedRandomChestContent weightedChest = (WeightedRandomChestContent) WeightedRandom.getRandomItem(rand, weightedContents);
		ItemStack[] stacks = ChestGenHooks.generateStacks(rand, weightedChest.theItemId, weightedChest.minStackSize, weightedChest.maxStackSize);
		for (ItemStack item : stacks) {
			if (atRandom) {
				chest.setInventorySlotContents(rand.nextInt(chest.getSizeInventory()), item);
			} else {
				addItemToInventoryAtRandom(rand, item, chest, 3);
			}
		}
	}
}
 
开发者ID:coolAlias,项目名称:ZeldaSwordSkills,代码行数:18,代码来源:WorldUtils.java

示例2: generateChestContent

import net.minecraftforge.common.ChestGenHooks; //导入方法依赖的package包/类
@Override
protected ItemStack[] generateChestContent(Random random, IInventory newInventory)
   {
       ItemStack[] a = ChestGenHooks.generateStacks(random, theItemId, theMinimumChanceToGenerateItem, theMaximumChanceToGenerateItem);
       for(int i=a.length-1; i>=0; --i) {
       	a[i] = ArtifactsAPI.artifacts.applyRandomEffects(a[i]);
       }
       return a;
   }
 
开发者ID:Draco18s,项目名称:Artifacts,代码行数:10,代码来源:WeightedRandomArtifact.java

示例3: generateChestContent

import net.minecraftforge.common.ChestGenHooks; //导入方法依赖的package包/类
@Override
protected ItemStack[] generateChestContent(Random random, IInventory newInventory) {
	// pick a random item from the group
	WeightedRandomChestContent randomLoot = (WeightedRandomChestContent)WeightedRandom.getRandomItem(random, this.weightedLoot);
	return ChestGenHooks.generateStacks(random, randomLoot.theItemId, this.theMinimumChanceToGenerateItem, this.theMaximumChanceToGenerateItem);
}
 
开发者ID:cheeseum-mods,项目名称:LootAdjuster,代码行数:7,代码来源:WeightedRandomLootGroup.java

示例4: generateChestContent

import net.minecraftforge.common.ChestGenHooks; //导入方法依赖的package包/类
/**
 * Allow a mod to submit a custom implementation that can delegate item stack generation beyond simple stack lookup
 *
 * @param random The current random for generation
 * @param newInventory The inventory being generated (do not populate it, but you can refer to it)
 * @return An array of {@link ItemStack} to put into the chest
 */
protected ItemStack[] generateChestContent(Random random, IInventory newInventory)
{
    return ChestGenHooks.generateStacks(random, theItemId, theMinimumChanceToGenerateItem, theMaximumChanceToGenerateItem);
}
 
开发者ID:xtrafrancyz,项目名称:Cauldron,代码行数:12,代码来源:WeightedRandomChestContent.java


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