當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。