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


Java NonNullList.set方法代碼示例

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


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

示例1: getRemainingItems

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

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

        if (itemstack.getItem() instanceof ItemWrittenBook)
        {
            ItemStack itemstack1 = itemstack.copy();
            itemstack1.func_190920_e(1);
            nonnulllist.set(i, itemstack1);
            break;
        }
    }

    return nonnulllist;
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:20,代碼來源:RecipeBookCloning.java

示例2: getRemainingItems

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

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

        if (itemstack.getItem().hasContainerItem())
        {
            nonnulllist.set(i, new ItemStack(itemstack.getItem().getContainerItem()));
        }
    }

    return nonnulllist;
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:17,代碼來源:ShieldRecipes.java

示例3: reArrangeStacks

import net.minecraft.util.NonNullList; //導入方法依賴的package包/類
public static void reArrangeStacks(InventoryDankNull inventory) {
	if (inventory != null) {
		int count = 0;
		NonNullList<ItemStack> stackList = NonNullList.withSize(inventory.getSizeInventory(), ItemStack.EMPTY);
		for (int i = 0; i < inventory.getSizeInventory(); i++) {
			ItemStack stack = inventory.getStackInSlot(i);
			if (!stack.isEmpty()) {
				stackList.set(count, inventory.getStackInSlot(i));
				count++;
			}
		}
		if (stackList.size() == 0) {
			setSelectedStackIndex(inventory, -1);
		}
		else {
			for (int i = 0; i < stackList.size(); i++) {
				inventory.setInventorySlotContents(i, stackList.get(i));
			}
			for (int i = stackList.size(); i < inventory.getSizeInventory(); i++) {
				inventory.setInventorySlotContents(i, ItemStack.EMPTY);
			}
		}
		setSelectedIndexApplicable(inventory);
	}
}
 
開發者ID:p455w0rd,項目名稱:DankNull,代碼行數:26,代碼來源:DankNullUtils.java

示例4: 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

示例5: 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

示例6: setInventorySlotContents

import net.minecraft.util.NonNullList; //導入方法依賴的package包/類
/**
 * Sets the given item stack to the specified slot in the inventory (can be crafting or armor sections).
 */
public void setInventorySlotContents(int index, ItemStack stack)
{
    NonNullList<ItemStack> nonnulllist = null;

    for (NonNullList<ItemStack> nonnulllist1 : this.allInventories)
    {
        if (index < nonnulllist1.size())
        {
            nonnulllist = nonnulllist1;
            break;
        }

        index -= nonnulllist1.size();
    }

    if (nonnulllist != null)
    {
        nonnulllist.set(index, stack);
    }
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:24,代碼來源:InventoryPlayer.java

示例7: func_191283_b

import net.minecraft.util.NonNullList; //導入方法依賴的package包/類
public static void func_191283_b(NBTTagCompound p_191283_0_, NonNullList<ItemStack> p_191283_1_)
{
    NBTTagList nbttaglist = p_191283_0_.getTagList("Items", 10);

    for (int i = 0; i < nbttaglist.tagCount(); ++i)
    {
        NBTTagCompound nbttagcompound = nbttaglist.getCompoundTagAt(i);
        int j = nbttagcompound.getByte("Slot") & 255;

        if (j >= 0 && j < p_191283_1_.size())
        {
            p_191283_1_.set(j, new ItemStack(nbttagcompound));
        }
    }
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:16,代碼來源:ItemStackHelper.java

示例8: getRemainingItems

import net.minecraft.util.NonNullList; //導入方法依賴的package包/類
public NonNullList<ItemStack> getRemainingItems(InventoryCrafting craftMatrix, World worldIn) {
	for (IRecipe irecipe : this.recipes)
		if (irecipe.matches(craftMatrix, worldIn))
			return irecipe.getRemainingItems(craftMatrix);

	NonNullList<ItemStack> aitemstack = NonNullList.withSize(craftMatrix.getSizeInventory(),ItemStack.EMPTY);

	for (int i = 0; i < aitemstack.size(); ++i)
		aitemstack.set(i,craftMatrix.getStackInSlot(i));

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

示例9: fromBytes

import net.minecraft.util.NonNullList; //導入方法依賴的package包/類
@Override
public void fromBytes(ByteBuf buf) {
	this.entityId = buf.readInt();
	int size = buf.readInt();
	NonNullList<ItemStack> list = NonNullList.withSize(size, ItemStack.EMPTY);
	for (int i = 0; i < list.size(); i++) {
		list.set(i, ByteBufUtils.readItemStack(buf));
	}
	this.cart = list;
}
 
開發者ID:Zundrel,項目名稱:Never-Enough-Currency,代碼行數:11,代碼來源:MessageSyncCart.java

示例10: getRemainingItems

import net.minecraft.util.NonNullList; //導入方法依賴的package包/類
@Override
public NonNullList<ItemStack> getRemainingItems(InventoryCrafting inv) {
	int slots = inv.getHeight() * inv.getWidth();
	NonNullList<ItemStack> nonNullList = NonNullList.<ItemStack>withSize(slots, ItemStack.EMPTY);
	int center = (int) ((float) slots / 2);

	ItemStack stack = inv.getStackInSlot(center);
	nonNullList.set(center, stack.copy());

	return nonNullList;
}
 
開發者ID:ArekkuusuJerii,項目名稱:Solar,代碼行數:12,代碼來源:EntangledCloningRecipe.java

示例11: getRemainingItems

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

    matches(inv, null);

    for (int i = 0; i < invSlots.length; i++)
    {
        int amount = damageAmounts[i];
        int invIndex = invSlots[i];
        if (amount > 0)
        {
            ItemStack stack = inv.getStackInSlot(invIndex).copy();
            stack.setItemDamage(stack.getItemDamage() + amount);
            if (stack.getItemDamage() > stack.getMaxDamage())
            {
                stack = ForgeHooks.getContainerItem(stack);
            }
            items.set(invIndex, stack);
        } else
        {
            items.set(invIndex, ForgeHooks.getContainerItem(inv.getStackInSlot(invIndex)));
        }
    }

    return items;
}
 
開發者ID:cubex2,項目名稱:customstuff4,代碼行數:30,代碼來源:DamageableShapelessOreRecipe.java

示例12: 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

示例13: removeStackFromSlot

import net.minecraft.util.NonNullList; //導入方法依賴的package包/類
/**
 * Removes a stack from the given slot and returns it.
 */
public ItemStack removeStackFromSlot(int index)
{
    NonNullList<ItemStack> nonnulllist = null;

    for (NonNullList<ItemStack> nonnulllist1 : this.allInventories)
    {
        if (index < nonnulllist1.size())
        {
            nonnulllist = nonnulllist1;
            break;
        }

        index -= nonnulllist1.size();
    }

    if (nonnulllist != null && !((ItemStack)nonnulllist.get(index)).func_190926_b())
    {
        ItemStack itemstack = (ItemStack)nonnulllist.get(index);
        nonnulllist.set(index, ItemStack.field_190927_a);
        return itemstack;
    }
    else
    {
        return ItemStack.field_190927_a;
    }
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:30,代碼來源:InventoryPlayer.java

示例14: getRemainingItems

import net.minecraft.util.NonNullList; //導入方法依賴的package包/類
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,代碼行數:13,代碼來源:RecipesBlockLauncher.java

示例15: render

import net.minecraft.util.NonNullList; //導入方法依賴的package包/類
@Override
public void render(TileEntityArcaneTransfigurationTable te, double x, double y, double z, float partialTicks,
		int destroyStage, float alpha)
{
	te.frameAge++;
	
	GlStateManager.pushMatrix();
	GlStateManager.translate(x, y, z);
	GlStateManager.disableRescaleNormal();
	IItemHandler cap = te.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, null);
	for (int i = 0; i < cap.getSlots(); i++)
	{
		renderItem(cap.getStackInSlot(i), i);
	}

	EntityPlayer player = Minecraft.getMinecraft().player;
	World world = Minecraft.getMinecraft().world;

	ItemStack held = player.getHeldItemMainhand();

	if (held.isEmpty() || !(held.getItem() instanceof IArcaneTransfigurationItem))
	{
		held = player.getHeldItemOffhand();
	}

	if (!held.isEmpty() && held.getItem() instanceof IArcaneTransfigurationItem)
	{
		NonNullList<ItemStack> recipeInputs = NonNullList.withSize(9, ItemStack.EMPTY);

		for (int i = 0; i < 9; i++)
		{
			recipeInputs.set(i, cap.getStackInSlot(i));
		}

		IArcaneTransfigurationRecipe foundRecipe = ArcaneMagicAPI.getArcaneTransfigurationRecipe(player, held, recipeInputs, world);

		if (foundRecipe != null)
		{
			GLHelper.renderItemStackFancy(foundRecipe.getRecipeOutput(), new Vec3d(0, 1.5, 0), true, Color.RED,
					te.frameAge / 4, te.getWorld().getSeed());
		}
	}

	GlStateManager.popMatrix();
}
 
開發者ID:raphydaphy,項目名稱:ArcaneMagic,代碼行數:46,代碼來源:ArcaneTransfigurationTableTESR.java


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