当前位置: 首页>>代码示例>>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;未经允许,请勿转载。