當前位置: 首頁>>代碼示例>>Java>>正文


Java NonNullList.add方法代碼示例

本文整理匯總了Java中net.minecraft.util.NonNullList.add方法的典型用法代碼示例。如果您正苦於以下問題:Java NonNullList.add方法的具體用法?Java NonNullList.add怎麽用?Java NonNullList.add使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在net.minecraft.util.NonNullList的用法示例。


在下文中一共展示了NonNullList.add方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: createInput

import net.minecraft.util.NonNullList; //導入方法依賴的package包/類
/**
 * Creates a list of ingredients based on an Object[].  Valid types are {@link String}, {@link ItemStack}, {@link Item}, and {@link Block}.
 * Used for shapeless recipes.
 */
private static NonNullList<Ingredient> createInput(Object[] input)
{
	if (input[0] instanceof List)
		input = ((List<?>) input[0]).toArray();
	else if (input[0] instanceof Object[])
		input = (Object[]) input[0];
	NonNullList<Ingredient> inputL = NonNullList.create();
	for (int i = 0; i < input.length; i++)
	{
		Object k = input[i];
		if (k instanceof String)
			inputL.add(i, new OreIngredient((String) k));
		else if (k instanceof ItemStack && !((ItemStack) k).isEmpty())
			inputL.add(i, Ingredient.fromStacks((ItemStack) k));
		else if (k instanceof IForgeRegistryEntry)
			inputL.add(i, Ingredient.fromStacks(makeStack((IForgeRegistryEntry<?>) k)));
		else
			throw new UnsupportedOperationException(
					"Attempted to add invalid shapeless recipe.  Complain to the author of " + MODNAME);
	}
	return inputL;
}
 
開發者ID:raphydaphy,項目名稱:ArcaneMagic,代碼行數:27,代碼來源:RecipeHelper.java

示例2: isValidPosition

import net.minecraft.util.NonNullList; //導入方法依賴的package包/類
@Override
protected boolean isValidPosition(BlockPos pos) {
    IBlockState blockState = worldCache.getBlockState(pos);
    Block block = blockState.getBlock();
    if (!worldCache.isAirBlock(pos) && !ignoreBlock(block)) {
        NonNullList<ItemStack> droppedStacks = NonNullList.create();
        if (block.canSilkHarvest(drone.world(), pos, blockState, drone.getFakePlayer())) {
            droppedStacks.add(getSilkTouchBlock(block, blockState));
        } else {
            block.getDrops(droppedStacks, drone.world(), pos, blockState, 0);
        }
        for (ItemStack droppedStack : droppedStacks) {
            if (widget.isItemValidForFilters(droppedStack, blockState)) {
                swapBestItemToFirstSlot(pos);
                return true;
            }
        }
    }
    return false;
}
 
開發者ID:TeamPneumatic,項目名稱:pnc-repressurized,代碼行數:21,代碼來源:DroneAIDig.java

示例3: getSubItems

import net.minecraft.util.NonNullList; //導入方法依賴的package包/類
@Override
@SideOnly(Side.CLIENT)
public void getSubItems(CreativeTabs tab, NonNullList<ItemStack> subItems) {
	if(!Config.DISABLED_TOOLS.contains("mace")) {
		ItemStack stack1 = new ItemStack(this);
		NBTTagCompound tag = new NBTTagCompound();
		tag.setString(HEAD_TAG, Materials.randomHead().getName());
		tag.setString(HAFT_TAG, Materials.randomHaft().getName());
		tag.setString(HANDLE_TAG, Materials.randomHandle().getName());
		tag.setString(ADORNMENT_TAG, Materials.randomAdornment().getName());
		stack1.setTagCompound(tag);
		if (isInCreativeTab(tab)) {
			subItems.add(stack1);
		}
	}
}
 
開發者ID:the-realest-stu,項目名稱:Adventurers-Toolbox,代碼行數:17,代碼來源:ItemATMace.java

示例4: getSubItems

import net.minecraft.util.NonNullList; //導入方法依賴的package包/類
@Override
@SideOnly(Side.CLIENT)
public void getSubItems(CreativeTabs tab, NonNullList<ItemStack> subItems) {
	if (!Config.DISABLED_TOOLS.contains("pickaxe")) {
		ItemStack stack1 = new ItemStack(this);
		NBTTagCompound tag = new NBTTagCompound();
		tag.setString(HEAD_TAG, Materials.randomHead().getName());
		tag.setString(HAFT_TAG, Materials.randomHaft().getName());
		tag.setString(HANDLE_TAG, Materials.randomHandle().getName());
		tag.setString(ADORNMENT_TAG, Materials.randomAdornment().getName());
		stack1.setTagCompound(tag);
		if (isInCreativeTab(tab)) {
			subItems.add(stack1);
		}
	}
}
 
開發者ID:the-realest-stu,項目名稱:Adventurers-Toolbox,代碼行數:17,代碼來源:ItemATPickaxe.java

示例5: SuperCallTest

import net.minecraft.util.NonNullList; //導入方法依賴的package包/類
public SuperCallTest()
{
    new StringBuilder(); // This is also invokespecial and shouldn't be redirected

    // invokevirtual but from different class
    NonNullList<Integer> list = NonNullList.create();
    list.add(1);
}
 
開發者ID:cubex2,項目名稱:customstuff4,代碼行數:9,代碼來源:MixinTests.java

示例6: getSubBlocks

import net.minecraft.util.NonNullList; //導入方法依賴的package包/類
@Override
@SideOnly(Side.CLIENT)
public void getSubBlocks(CreativeTabs tab, NonNullList<ItemStack> list) {
	if (tab!=this.getCreativeTabToDisplayOn()) return;
	
    for (int i=0; i<16; i++) {
        list.add(new ItemStack(ItemBlock.getItemFromBlock(this), 1, i));
    }
}
 
開發者ID:elytra,項目名稱:ThermionicsWorld,代碼行數:10,代碼來源:BlockVarieties.java

示例7: getIngredients

import net.minecraft.util.NonNullList; //導入方法依賴的package包/類
@Override
public NonNullList<Ingredient> getIngredients()
{
	NonNullList<Ingredient> lst = NonNullList.create();

	lst.add(Ingredient.fromItem(ModItems.simic_slaw));
	lst.add(new FoodIngredient());

	return lst;
}
 
開發者ID:DarkMorford,項目名稱:BetterThanWeagles,代碼行數:11,代碼來源:RecipeSimicSlaw.java

示例8: getDrops

import net.minecraft.util.NonNullList; //導入方法依賴的package包/類
@Override
public void getDrops(NonNullList<ItemStack> drops, IBlockAccess world, BlockPos pos, IBlockState state,
		int fortune) {
	if(state.getValue(TYPE)==EnumKilnTypes.COMPLETE){
		drops.add(new ItemStack(ItemsRegistry.ash_stack.getItem(), Config.PotteryAsh, ItemsRegistry.ash_stack.getItemDamage()));
	}else if(state.getValue(TYPE)==EnumKilnTypes.WOOD||state.getValue(TYPE)==EnumKilnTypes.ACTIVE){
		drops.add(new ItemStack(ItemsRegistry.wood_stack.getItem(), Config.WoodAmount, ItemsRegistry.wood_stack.getItemDamage()));
		drops.add(new ItemStack(ItemsRegistry.thatch_stack.getItem(), Config.ThatchAmount, ItemsRegistry.thatch_stack.getItemDamage()));
	}else if(state.getValue(TYPE)==EnumKilnTypes.THATCH){
		drops.add(new ItemStack(ItemsRegistry.thatch_stack.getItem(), Config.ThatchAmount, ItemsRegistry.thatch_stack.getItemDamage()));
	}
}
 
開發者ID:EnderiumSmith,項目名稱:CharcoalPit,代碼行數:13,代碼來源:BlockPotteryKiln.java

示例9: getSubItems

import net.minecraft.util.NonNullList; //導入方法依賴的package包/類
@Override
@SideOnly(Side.CLIENT)
public void getSubItems(CreativeTabs tab, NonNullList<ItemStack> subItems) {
	if(!Config.DISABLED_TOOLS.contains("dagger")) {
		ItemStack stack1 = new ItemStack(this);
		NBTTagCompound tag = new NBTTagCompound();
		tag.setString(BLADE_TAG, Materials.randomHead().getName());
		tag.setString(HANDLE_TAG, Materials.randomHandle().getName());
		tag.setString(ADORNMENT_TAG, Materials.randomAdornment().getName());
		stack1.setTagCompound(tag);
		if (isInCreativeTab(tab)) {
			subItems.add(stack1);
		}
	}
}
 
開發者ID:the-realest-stu,項目名稱:Adventurers-Toolbox,代碼行數:16,代碼來源:ItemATDagger.java

示例10: getSubItems

import net.minecraft.util.NonNullList; //導入方法依賴的package包/類
@Override
public void getSubItems(CreativeTabs tab, @Nonnull NonNullList<ItemStack> items) {
	if (this.isInCreativeTab(tab)) {
		for (int i = 0; i < BlockGemOre.Gem.values().length; ++i) {
			items.add(new ItemStack(this, 1, i));
		}
	}
}
 
開發者ID:Um-Mitternacht,項目名稱:Bewitchment,代碼行數:9,代碼來源:ItemGem.java

示例11: getSubBlocks

import net.minecraft.util.NonNullList; //導入方法依賴的package包/類
@Override
public void getSubBlocks(CreativeTabs itemIn, NonNullList<ItemStack> items) {
    if(this.burning) {
        super.getSubBlocks(itemIn, items);
    } else {
        ItemStack stack = new ItemStack(this);
        stack.getOrCreateSubCompound("randores").setInteger("furnace_speed", 1);
        items.add(stack);
    }
}
 
開發者ID:Randores,項目名稱:Randores2,代碼行數:11,代碼來源:CraftiniumForge.java

示例12: getSubBlocks

import net.minecraft.util.NonNullList; //導入方法依賴的package包/類
@SideOnly(Side.CLIENT)
@Override
public void getSubBlocks(CreativeTabs tab, NonNullList<ItemStack> list)
{
	for (int i = 0; i < 4; ++i)
	{
		list.add(new ItemStack(this, 1, i));
	}
}
 
開發者ID:V0idWa1k3r,項目名稱:ExPetrum,代碼行數:10,代碼來源:BlockVegetation.java

示例13: getSubItems

import net.minecraft.util.NonNullList; //導入方法依賴的package包/類
@Override
@SideOnly(Side.CLIENT)
public void getSubItems(CreativeTabs tab, NonNullList<ItemStack> subItems) {
	for (int i = 0; i < meta_map.size(); i++) {
		if (!Config.HIDE_UNCRAFTABLE_HEADS || (OreDictionary.getOres(meta_map.get(i).getCraftingItem()).size() > 0
				&& OreDictionary.getOres(meta_map.get(i).getSmallCraftingItem()).size() > 0)) {
			ItemStack stack = new ItemStack(this, 1, i);
			if (isInCreativeTab(tab)) {
				subItems.add(stack);
			}
		}
	}
}
 
開發者ID:the-realest-stu,項目名稱:Adventurers-Toolbox,代碼行數:14,代碼來源:ItemToolHead.java

示例14: getSubBlocks

import net.minecraft.util.NonNullList; //導入方法依賴的package包/類
/**
 * returns a list of blocks with the same ID, but different meta (eg: wood returns 4 blocks)
 */
public void getSubBlocks(Item itemIn, CreativeTabs tab, NonNullList<ItemStack> list)
{
    list.add(new ItemStack(itemIn));
    list.add(new ItemStack(itemIn, 1, 1));
    list.add(new ItemStack(itemIn, 1, 2));
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:10,代碼來源:BlockAnvil.java

示例15: getSubItems

import net.minecraft.util.NonNullList; //導入方法依賴的package包/類
@Override
@SideOnly(Side.CLIENT)
public void getSubItems(CreativeTabs tab, NonNullList<ItemStack> subItems) {
	for (String type : subtypes) {
		ItemStack stack = new ItemStack(this);
		NBTTagCompound nbt = new NBTTagCompound();
		nbt.setString(type_tag, type);
		stack.setTagCompound(nbt);
		if (isInCreativeTab(tab)) {
			subItems.add(stack);
		}
	}
}
 
開發者ID:the-realest-stu,項目名稱:Adventurers-Toolbox,代碼行數:14,代碼來源:ItemSchematic.java


注:本文中的net.minecraft.util.NonNullList.add方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。