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


Java NonNullList.withSize方法代碼示例

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


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

示例1: InventoryItem

import net.minecraft.util.NonNullList; //導入方法依賴的package包/類
/**
 * @param itemstack
 *            - the ItemStack to which this inventory belongs
 */
public InventoryItem(ItemStack stack) {
	invItem = stack;

	inventory = NonNullList.withSize(INV_SIZE, ItemStack.EMPTY);

	if (!stack.hasTagCompound()) {
		stack.setTagCompound(new NBTTagCompound());
	}

	readFromNBT(stack.getTagCompound());

	uniqueID = "";

	if (!stack.hasTagCompound()) {
		stack.setTagCompound(new NBTTagCompound());
		uniqueID = UUID.randomUUID().toString();
	}
}
 
開發者ID:Zundrel,項目名稱:Never-Enough-Currency,代碼行數:23,代碼來源:InventoryItem.java

示例2: getToolHeadSchematicRecipe

import net.minecraft.util.NonNullList; //導入方法依賴的package包/類
private static IRecipe getToolHeadSchematicRecipe(ItemStack output, String material, String type, int cost) {
	NonNullList<Ingredient> inputs = NonNullList.withSize(cost + 1, Ingredient.EMPTY);
	ItemStack schematic = new ItemStack(ModItems.schematic);
	NBTTagCompound nbt = new NBTTagCompound();
	nbt.setString(ItemSchematic.type_tag, type);
	schematic.setTagCompound(nbt);
	Ingredient schematicIngredient = new IngredientNBT(schematic) {

	};
	inputs.set(0, schematicIngredient);
	for (int i = 1; i <= cost; i++) {
		inputs.set(i, new OreIngredient(material));
	}

	return new ShapelessOreRecipe(null, inputs, output);
}
 
開發者ID:the-realest-stu,項目名稱:Adventurers-Toolbox,代碼行數:17,代碼來源:ModRecipes.java

示例3: getRemainingItems

import net.minecraft.util.NonNullList; //導入方法依賴的package包/類
@Nonnull
@Override
public NonNullList<ItemStack> getRemainingItems(InventoryCrafting inv) {
    NonNullList<ItemStack> nonnulllist = NonNullList.withSize(inv.getSizeInventory(), ItemStack.EMPTY);

    for (int i = 0; i < nonnulllist.size(); ++i) {
        ItemStack itemstack = inv.getStackInSlot(i);

        if (itemstack.isItemEqual(new ItemStack(Items.POTIONITEM))) {
            nonnulllist.set(i, new ItemStack(Items.GLASS_BOTTLE, 1));
            continue;
        }

        nonnulllist.set(i, net.minecraftforge.common.ForgeHooks.getContainerItem(itemstack));
    }

    return nonnulllist;
}
 
開發者ID:TeamCovertDragon,項目名稱:MooncakeCraft,代碼行數:19,代碼來源:RemainBottleRecipeFactory.java

示例4: onOutputTaken

import net.minecraft.util.NonNullList; //導入方法依賴的package包/類
public void onOutputTaken() {
    ItemStack input = this.input.getStackInSlot(0);
    input.setCount(input.getCount() - 1);
    if (input.getCount() == 0) {
        input = ItemStack.EMPTY;
    }

    this.input.setStackInSlot(0, input);

    NonNullList<ItemStack> toDisplay = NonNullList.withSize(9, ItemStack.EMPTY);
    PagedItemStackHandler handler = new PagedItemStackHandler(toDisplay, this.handler.getIndex());
    this.handler = handler;
    this.delegate.setHandler(handler);

    this.detectAndSendChanges();
}
 
開發者ID:Randores,項目名稱:Randores2,代碼行數:17,代碼來源:CraftiniumConverterContainer.java

示例5: addMeatCompressionRecipe

import net.minecraft.util.NonNullList; //導入方法依賴的package包/類
public static void addMeatCompressionRecipe(IForgeRegistry<IRecipe> registry, EnumEdibleMeat meat, boolean cooked, ItemStack ingredient) {
	ResourceLocation group = new ResourceLocation("thermionics_world", "compress.meat");
	Ingredient input = Ingredient.fromStacks(ingredient);
	ShapedRecipes recipe = 
			new ShapedRecipes(group.toString(), 3, 3,
			NonNullList.withSize(3*3, input),
			new ItemStack(TWBlocks.MEAT_EDIBLE, 1, BlockMeatEdible.getMetaFromValue(meat, cooked)) );
	recipe.setRegistryName(new ResourceLocation("thermionics_world", meat.getName()+((cooked)?".cooked":".raw")+"_CompressToBlock"));
	registry.register(recipe);
}
 
開發者ID:elytra,項目名稱:ThermionicsWorld,代碼行數:11,代碼來源:ThermionicsWorld.java

示例6: getRemainingItems

import net.minecraft.util.NonNullList; //導入方法依賴的package包/類
/**
 * Copied from ShapedRecipes
 */
@Override
public NonNullList<ItemStack> getRemainingItems(InventoryCrafting inv) {
    NonNullList<ItemStack> aitemstack = NonNullList.withSize(inv.getSizeInventory(), ItemStack.EMPTY);

    for (int i = 0; i < aitemstack.size(); ++i) {
        ItemStack itemstack = inv.getStackInSlot(i);
        aitemstack.set(i, net.minecraftforge.common.ForgeHooks.getContainerItem(itemstack));
    }

    return aitemstack;
}
 
開發者ID:TeamPneumatic,項目名稱:pnc-repressurized,代碼行數:15,代碼來源:AbstractRecipe.java

示例7: getRemainingItems

import net.minecraft.util.NonNullList; //導入方法依賴的package包/類
@Override
public NonNullList<ItemStack> getRemainingItems(InventoryCrafting inv) {
	// TODO Auto-generated method stub
	NonNullList<ItemStack> aitemstack = NonNullList.withSize(inv.getSizeInventory(),ItemStack.EMPTY);

	for (int i = 0; i < aitemstack.size(); ++i) {
		ItemStack itemstack = inv.getStackInSlot(i);
		aitemstack.set(i,net.minecraftforge.common.ForgeHooks.getContainerItem(itemstack));
	}

	return aitemstack;
}
 
開發者ID:rafradek,項目名稱:Mods,代碼行數:13,代碼來源:AustraliumRecipe.java

示例8: fromBytes

import net.minecraft.util.NonNullList; //導入方法依賴的package包/類
@Override
public void fromBytes(ByteBuf buf) {
	int i = buf.readShort();
	itemStacks = NonNullList.<ItemStack>withSize(i, ItemStack.EMPTY);
	stackSizes = new int[i];
	for (int j = 0; j < i; ++j) {
		itemStacks.set(j, ByteBufUtils.readItemStack(buf));
	}
	for (int j = 0; j < i; ++j) {
		stackSizes[j] = buf.readInt();
	}

}
 
開發者ID:p455w0rd,項目名稱:DankNull,代碼行數:14,代碼來源:PacketSyncDankNull.java

示例9: getSlots

import net.minecraft.util.NonNullList; //導入方法依賴的package包/類
public NonNullList<ItemStack> getSlots() {
    NonNullList list = NonNullList.withSize(3, ItemStack.EMPTY);
    list.set(0, this.getInput().getStackInSlot(0));
    list.set(1, this.getFuel().getStackInSlot(0));
    list.set(2, this.getOutput().getStackInSlot(0));
    return list;
}
 
開發者ID:Randores,項目名稱:Randores2,代碼行數:8,代碼來源:CraftiniumForgeTileEntity.java

示例10: getRemainingItems

import net.minecraft.util.NonNullList; //導入方法依賴的package包/類
@Override
public NonNullList<ItemStack> getRemainingItems(InventoryCrafting inv)
   {
       NonNullList<ItemStack> nonnulllist = NonNullList.<ItemStack>withSize(inv.getSizeInventory(), ItemStack.EMPTY);

       for (int i = 0; i < nonnulllist.size(); ++i)
       {
           ItemStack itemstack = inv.getStackInSlot(i);
           nonnulllist.set(i, net.minecraftforge.common.ForgeHooks.getContainerItem(itemstack));
       }

       return nonnulllist;
   }
 
開發者ID:rafradek,項目名稱:Mods,代碼行數:14,代碼來源:RecipeFromScrap.java

示例11: onSheared

import net.minecraft.util.NonNullList; //導入方法依賴的package包/類
@Override
public List<ItemStack> onSheared(ItemStack item, IBlockAccess world, BlockPos pos, int fortune) {
	return NonNullList.withSize(1, new ItemStack(this));
}
 
開發者ID:Um-Mitternacht,項目名稱:Bewitchment,代碼行數:5,代碼來源:BlockModLeaves.java

示例12: getRemainingItems

import net.minecraft.util.NonNullList; //導入方法依賴的package包/類
@Override
public NonNullList<ItemStack> getRemainingItems(InventoryCrafting inv) {
	return NonNullList.<ItemStack>withSize(9, ItemStack.EMPTY);
}
 
開發者ID:the-realest-stu,項目名稱:Adventurers-Toolbox,代碼行數:5,代碼來源:BookRecipe.java

示例13: ItemStackHandlerMachine

import net.minecraft.util.NonNullList; //導入方法依賴的package包/類
public ItemStackHandlerMachine(TileEntityMachineBase tile, int size) {
    this.tile = tile;
    stacks = NonNullList.withSize(size, ItemStack.EMPTY);
}
 
開發者ID:jaredlll08,項目名稱:Machines-and-Stuff,代碼行數:5,代碼來源:ItemStackHandlerMachine.java

示例14: getRemainingItems

import net.minecraft.util.NonNullList; //導入方法依賴的package包/類
@Override
public NonNullList<ItemStack> getRemainingItems(InventoryCrafting inv) {
	NonNullList items = NonNullList.<ItemStack>withSize(inv.getSizeInventory(), ItemStack.EMPTY);
	return items;
}
 
開發者ID:the-realest-stu,項目名稱:Adventurers-Toolbox,代碼行數:6,代碼來源:ToolRecipe.java

示例15: TempChest

import net.minecraft.util.NonNullList; //導入方法依賴的package包/類
public TempChest(int numSlots) {
	invList = NonNullList.withSize(numSlots, ItemStack.EMPTY);
}
 
開發者ID:p455w0rd,項目名稱:EndermanEvolution,代碼行數:4,代碼來源:EntityFrienderman.java


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