当前位置: 首页>>代码示例>>Java>>正文


Java IInventory.markDirty方法代码示例

本文整理汇总了Java中net.minecraft.inventory.IInventory.markDirty方法的典型用法代码示例。如果您正苦于以下问题:Java IInventory.markDirty方法的具体用法?Java IInventory.markDirty怎么用?Java IInventory.markDirty使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在net.minecraft.inventory.IInventory的用法示例。


在下文中一共展示了IInventory.markDirty方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: pullItemFromSlot

import net.minecraft.inventory.IInventory; //导入方法依赖的package包/类
/**
 * Pulls from the specified slot in the inventory and places in any available slot in the hopper. Returns true if
 * the entire stack was moved
 */
private static boolean pullItemFromSlot(IHopper hopper, IInventory inventoryIn, int index, EnumFacing direction)
{
    ItemStack itemstack = inventoryIn.getStackInSlot(index);

    if (itemstack != null && canExtractItemFromSlot(inventoryIn, itemstack, index, direction))
    {
        ItemStack itemstack1 = itemstack.copy();
        ItemStack itemstack2 = putStackInInventoryAllSlots(hopper, inventoryIn.decrStackSize(index, 1), (EnumFacing)null);

        if (itemstack2 == null || itemstack2.stackSize == 0)
        {
            inventoryIn.markDirty();
            return true;
        }

        inventoryIn.setInventorySlotContents(index, itemstack1);
    }

    return false;
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:25,代码来源:TileEntityHopper.java

示例2: pullItemFromSlot

import net.minecraft.inventory.IInventory; //导入方法依赖的package包/类
/**
 * Pulls from the specified slot in the inventory and places in any available slot in the hopper. Returns true if
 * the entire stack was moved
 */
private static boolean pullItemFromSlot(IHopper hopper, IInventory inventoryIn, int index, EnumFacing direction)
{
    ItemStack itemstack = inventoryIn.getStackInSlot(index);

    if (!itemstack.func_190926_b() && canExtractItemFromSlot(inventoryIn, itemstack, index, direction))
    {
        ItemStack itemstack1 = itemstack.copy();
        ItemStack itemstack2 = putStackInInventoryAllSlots(inventoryIn, hopper, inventoryIn.decrStackSize(index, 1), (EnumFacing)null);

        if (itemstack2.func_190926_b())
        {
            inventoryIn.markDirty();
            return true;
        }

        inventoryIn.setInventorySlotContents(index, itemstack1);
    }

    return false;
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:25,代码来源:TileEntityHopper.java

示例3: transferItemsOut

import net.minecraft.inventory.IInventory; //导入方法依赖的package包/类
private boolean transferItemsOut()
{
    IInventory iinventory = this.getInventoryForHopperTransfer();

    if (iinventory == null)
    {
        return false;
    }
    else
    {
        EnumFacing enumfacing = BlockHopper.getFacing(this.getBlockMetadata()).getOpposite();

        if (this.isInventoryFull(iinventory, enumfacing))
        {
            return false;
        }
        else
        {
            for (int i = 0; i < this.getSizeInventory(); ++i)
            {
                if (this.getStackInSlot(i) != null)
                {
                    ItemStack itemstack = this.getStackInSlot(i).copy();
                    ItemStack itemstack1 = putStackInInventoryAllSlots(iinventory, this.decrStackSize(i, 1), enumfacing);

                    if (itemstack1 == null || itemstack1.stackSize == 0)
                    {
                        iinventory.markDirty();
                        return true;
                    }

                    this.setInventorySlotContents(i, itemstack);
                }
            }

            return false;
        }
    }
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:40,代码来源:TileEntityHopper.java

示例4: transferItemsOut

import net.minecraft.inventory.IInventory; //导入方法依赖的package包/类
private boolean transferItemsOut()
{
    IInventory iinventory = this.getInventoryForHopperTransfer();

    if (iinventory == null)
    {
        return false;
    }
    else
    {
        EnumFacing enumfacing = BlockHopper.getFacing(this.getBlockMetadata()).getOpposite();

        if (this.isInventoryFull(iinventory, enumfacing))
        {
            return false;
        }
        else
        {
            for (int i = 0; i < this.getSizeInventory(); ++i)
            {
                if (!this.getStackInSlot(i).func_190926_b())
                {
                    ItemStack itemstack = this.getStackInSlot(i).copy();
                    ItemStack itemstack1 = putStackInInventoryAllSlots(this, iinventory, this.decrStackSize(i, 1), enumfacing);

                    if (itemstack1.func_190926_b())
                    {
                        iinventory.markDirty();
                        return true;
                    }

                    this.setInventorySlotContents(i, itemstack);
                }
            }

            return false;
        }
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:40,代码来源:TileEntityHopper.java

示例5: transferItemsOut

import net.minecraft.inventory.IInventory; //导入方法依赖的package包/类
private boolean transferItemsOut()
{
    if (net.minecraftforge.items.VanillaInventoryCodeHooks.insertHook(this)) { return true; }
    IInventory iinventory = this.getInventoryForHopperTransfer();

    if (iinventory == null)
    {
        return false;
    }
    else
    {
        EnumFacing enumfacing = BlockHopper.getFacing(this.getBlockMetadata()).getOpposite();

        if (this.isInventoryFull(iinventory, enumfacing))
        {
            return false;
        }
        else
        {
            for (int i = 0; i < this.getSizeInventory(); ++i)
            {
                if (this.getStackInSlot(i) != null)
                {
                    ItemStack itemstack = this.getStackInSlot(i).copy();
                    ItemStack itemstack1 = putStackInInventoryAllSlots(iinventory, this.decrStackSize(i, 1), enumfacing);

                    if (itemstack1 == null || itemstack1.stackSize == 0)
                    {
                        iinventory.markDirty();
                        return true;
                    }

                    this.setInventorySlotContents(i, itemstack);
                }
            }

            return false;
        }
    }
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:41,代码来源:TileEntityHopper.java

示例6: insertStack

import net.minecraft.inventory.IInventory; //导入方法依赖的package包/类
/**
 * Insert the specified stack to the specified inventory and return any leftover items
 */
private static ItemStack insertStack(IInventory inventoryIn, ItemStack stack, int index, EnumFacing side)
{
    ItemStack itemstack = inventoryIn.getStackInSlot(index);

    if (canInsertItemInSlot(inventoryIn, stack, index, side))
    {
        boolean flag = false;

        if (itemstack == null)
        {
            inventoryIn.setInventorySlotContents(index, stack);
            stack = null;
            flag = true;
        }
        else if (canCombine(itemstack, stack))
        {
            int i = stack.getMaxStackSize() - itemstack.stackSize;
            int j = Math.min(stack.stackSize, i);
            stack.stackSize -= j;
            itemstack.stackSize += j;
            flag = j > 0;
        }

        if (flag)
        {
            if (inventoryIn instanceof TileEntityHopper)
            {
                TileEntityHopper tileentityhopper = (TileEntityHopper)inventoryIn;

                if (tileentityhopper.mayTransfer())
                {
                    tileentityhopper.setTransferCooldown(8);
                }

                inventoryIn.markDirty();
            }

            inventoryIn.markDirty();
        }
    }

    return stack;
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:47,代码来源:TileEntityHopper.java

示例7: insertStack

import net.minecraft.inventory.IInventory; //导入方法依赖的package包/类
/**
 * Insert the specified stack to the specified inventory and return any leftover items
 */
private static ItemStack insertStack(IInventory inventoryIn, IInventory stack, ItemStack index, int side, EnumFacing p_174916_4_)
{
    ItemStack itemstack = stack.getStackInSlot(side);

    if (canInsertItemInSlot(stack, index, side, p_174916_4_))
    {
        boolean flag = false;
        boolean flag1 = stack.func_191420_l();

        if (itemstack.func_190926_b())
        {
            stack.setInventorySlotContents(side, index);
            index = ItemStack.field_190927_a;
            flag = true;
        }
        else if (canCombine(itemstack, index))
        {
            int i = index.getMaxStackSize() - itemstack.func_190916_E();
            int j = Math.min(index.func_190916_E(), i);
            index.func_190918_g(j);
            itemstack.func_190917_f(j);
            flag = j > 0;
        }

        if (flag)
        {
            if (flag1 && stack instanceof TileEntityHopper)
            {
                TileEntityHopper tileentityhopper1 = (TileEntityHopper)stack;

                if (!tileentityhopper1.mayTransfer())
                {
                    int k = 0;

                    if (inventoryIn != null && inventoryIn instanceof TileEntityHopper)
                    {
                        TileEntityHopper tileentityhopper = (TileEntityHopper)inventoryIn;

                        if (tileentityhopper1.field_190578_g >= tileentityhopper.field_190578_g)
                        {
                            k = 1;
                        }
                    }

                    tileentityhopper1.setTransferCooldown(8 - k);
                }
            }

            stack.markDirty();
        }
    }

    return index;
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:58,代码来源:TileEntityHopper.java


注:本文中的net.minecraft.inventory.IInventory.markDirty方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。