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


Java ISidedInventory.getAccessibleSlotsFromSide方法代碼示例

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


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

示例1: InventoryRange

import net.minecraft.inventory.ISidedInventory; //導入方法依賴的package包/類
public InventoryRange(IInventory inv, int side)
{
    this.inv = inv;
    this.side = side;
    if(inv instanceof ISidedInventory)
    {
        sidedInv = (ISidedInventory)inv;
        slots = sidedInv.getAccessibleSlotsFromSide(side);
    }
    else
    {
        slots = new int[inv.getSizeInventory()];
        for(int i = 0; i < slots.length; i++)
            slots[i] = i;
    }
}
 
開發者ID:4Space,項目名稱:4Space-5,代碼行數:17,代碼來源:InventoryRange.java

示例2: isSlotAccessibleFromAnySide

import net.minecraft.inventory.ISidedInventory; //導入方法依賴的package包/類
private static boolean isSlotAccessibleFromAnySide(IInventory inventory, int slot) {
	if (inventory instanceof ISidedInventory) {
		ISidedInventory sidedInventory = (ISidedInventory) inventory;
		for (ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) {
			int[] accessible = sidedInventory.getAccessibleSlotsFromSide(dir.ordinal());
			for (int i = 0; i < accessible.length; i++) {
				if (accessible[i] == slot) {
					return true;
				}
			}
		}

		return false;
	}

	return true;
}
 
開發者ID:thraaawn,項目名稱:CCFactoryManager,代碼行數:18,代碼來源:TileEntityFactoryController.java

示例3: insert

import net.minecraft.inventory.ISidedInventory; //導入方法依賴的package包/類
public static ItemStack insert(IInventory inventory, ItemStack itemStack, int side, boolean simulate) {

    if (inventory instanceof ISidedInventory && side > -1) {
        ISidedInventory isidedinventory = (ISidedInventory) inventory;
        int[] aint = isidedinventory.getAccessibleSlotsFromSide(side);
        
        for (int j = 0; j < aint.length && itemStack != null && itemStack.stackSize > 0; ++j) {
            itemStack = insert(inventory, itemStack, aint[j], side, simulate);
        }
    } else {
        int k = inventory.getSizeInventory();
        
        for (int l = 0; l < k && itemStack != null && itemStack.stackSize > 0; ++l) {
            itemStack = insert(inventory, itemStack, l, side, simulate);
        }
    }
    
    if (itemStack != null && itemStack.stackSize == 0) {
        itemStack = null;
    }
    
    return itemStack;
}
 
開發者ID:Quetzi,項目名稱:BluePower,代碼行數:24,代碼來源:IOHelper.java

示例4: buildInventorySlotWhitelist

import net.minecraft.inventory.ISidedInventory; //導入方法依賴的package包/類
public static List<Integer> buildInventorySlotWhitelist(IInventory inv) {
	List<Integer> ret = new ArrayList<Integer>(inv.getSizeInventory());

	if (inv instanceof ISidedInventory) {
		ISidedInventory sidedinv = (ISidedInventory)inv;

		for (int i = 0; i < 6; i++) {
			int[] slots = sidedinv.getAccessibleSlotsFromSide(i);
			for (int j = 0; j < slots.length; j++) {
				ret.add(j);
			}
		}
		
		if (inv instanceof TileEntityFurnace) { // special case for furnace exploit
			ret.remove(2);
		}
	} else {
		for (int i = 0; i < inv.getSizeInventory(); i++) {
			ret.add(i);
		}
	}

	return ret;
}
 
開發者ID:austinv11,項目名稱:PeripheralsPlusPlus,代碼行數:25,代碼來源:Util.java

示例5: extractItemStackFromInventory

import net.minecraft.inventory.ISidedInventory; //導入方法依賴的package包/類
public static ItemStack extractItemStackFromInventory(IInventory theInventory, int side) {

		ItemStack retStack = null;

		if (theInventory instanceof ISidedInventory) {
			ISidedInventory sidedInv = (ISidedInventory) theInventory;
			int slots[] = sidedInv.getAccessibleSlotsFromSide(side);
			for (int i = 0; i < slots.length && retStack == null; i++) {
				if (sidedInv.getStackInSlot(i) != null && sidedInv.canExtractItem(i, sidedInv.getStackInSlot(i), side)) {
					retStack = sidedInv.getStackInSlot(i).copy();
					sidedInv.setInventorySlotContents(i, null);
				}
			}
		} else {
			for (int i = 0; i < theInventory.getSizeInventory() && retStack == null; i++) {
				if (theInventory.getStackInSlot(i) != null) {
					retStack = theInventory.getStackInSlot(i).copy();
					theInventory.setInventorySlotContents(i, null);
				}
			}
		}
		if (retStack != null) {
			theInventory.onInventoryChanged();
		}
		return retStack;
	}
 
開發者ID:PaleoCrafter,項目名稱:R0b0ts,代碼行數:27,代碼來源:InventoryHelper.java

示例6: insert

import net.minecraft.inventory.ISidedInventory; //導入方法依賴的package包/類
public static ItemStack insert(IInventory inventory, ItemStack itemStack, int side, boolean simulate){

        if(inventory instanceof ISidedInventory && side > -1) {
            ISidedInventory isidedinventory = (ISidedInventory)inventory;
            int[] aint = isidedinventory.getAccessibleSlotsFromSide(side);

            for(int j = 0; j < aint.length && itemStack != null && itemStack.stackSize > 0; ++j) {
                itemStack = insert(inventory, itemStack, aint[j], side, simulate);
            }
        } else if(inventory != null) {
            int k = inventory.getSizeInventory();

            for(int l = 0; l < k && itemStack != null && itemStack.stackSize > 0; ++l) {
                itemStack = insert(inventory, itemStack, l, side, simulate);
            }
        }

        if(itemStack != null && itemStack.stackSize == 0) {
            itemStack = null;
        }

        return itemStack;
    }
 
開發者ID:MineMaarten,項目名稱:PneumaticCraft,代碼行數:24,代碼來源:IOHelper.java

示例7: func_152102_a

import net.minecraft.inventory.ISidedInventory; //導入方法依賴的package包/類
private boolean func_152102_a(IInventory p_152102_1_, int p_152102_2_)
{
    if (p_152102_1_ instanceof ISidedInventory && p_152102_2_ > -1)
    {
        ISidedInventory isidedinventory = (ISidedInventory)p_152102_1_;
        int[] aint = isidedinventory.getAccessibleSlotsFromSide(p_152102_2_);

        for (int l = 0; l < aint.length; ++l)
        {
            ItemStack itemstack1 = isidedinventory.getStackInSlot(aint[l]);

            if (itemstack1 == null || itemstack1.stackSize != itemstack1.getMaxStackSize())
            {
                return false;
            }
        }
    }
    else
    {
        int j = p_152102_1_.getSizeInventory();

        for (int k = 0; k < j; ++k)
        {
            ItemStack itemstack = p_152102_1_.getStackInSlot(k);

            if (itemstack == null || itemstack.stackSize != itemstack.getMaxStackSize())
            {
                return false;
            }
        }
    }

    return true;
}
 
開發者ID:jtrent238,項目名稱:PopularMMOS-EpicProportions-Mod,代碼行數:35,代碼來源:TileEntityBlockChristmasPresents_Red.java

示例8: func_152103_b

import net.minecraft.inventory.ISidedInventory; //導入方法依賴的package包/類
private static boolean func_152103_b(IInventory p_152103_0_, int p_152103_1_)
{
    if (p_152103_0_ instanceof ISidedInventory && p_152103_1_ > -1)
    {
        ISidedInventory isidedinventory = (ISidedInventory)p_152103_0_;
        int[] aint = isidedinventory.getAccessibleSlotsFromSide(p_152103_1_);

        for (int l = 0; l < aint.length; ++l)
        {
            if (isidedinventory.getStackInSlot(aint[l]) != null)
            {
                return false;
            }
        }
    }
    else
    {
        int j = p_152103_0_.getSizeInventory();

        for (int k = 0; k < j; ++k)
        {
            if (p_152103_0_.getStackInSlot(k) != null)
            {
                return false;
            }
        }
    }

    return true;
}
 
開發者ID:jtrent238,項目名稱:PopularMMOS-EpicProportions-Mod,代碼行數:31,代碼來源:TileEntityBlockChristmasPresents_Red.java

示例9: func_145889_a

import net.minecraft.inventory.ISidedInventory; //導入方法依賴的package包/類
public static ItemStack func_145889_a(TileEntityBlockChristmasPresents_Red tileEntityBlockChristmasPresents_Red, ItemStack p_145889_1_, int p_145889_2_)
{
    if (tileEntityBlockChristmasPresents_Red instanceof ISidedInventory && p_145889_2_ > -1)
    {
        ISidedInventory isidedinventory = (ISidedInventory)tileEntityBlockChristmasPresents_Red;
        int[] aint = isidedinventory.getAccessibleSlotsFromSide(p_145889_2_);

        for (int l = 0; l < aint.length && p_145889_1_ != null && p_145889_1_.stackSize > 0; ++l)
        {
            p_145889_1_ = func_145899_c(tileEntityBlockChristmasPresents_Red, p_145889_1_, aint[l], p_145889_2_);
        }
    }
    else
    {
        int j = tileEntityBlockChristmasPresents_Red.getSizeInventory();

        for (int k = 0; k < j && p_145889_1_ != null && p_145889_1_.stackSize > 0; ++k)
        {
            p_145889_1_ = func_145899_c(tileEntityBlockChristmasPresents_Red, p_145889_1_, k, p_145889_2_);
        }
    }

    if (p_145889_1_ != null && p_145889_1_.stackSize == 0)
    {
        p_145889_1_ = null;
    }

    return p_145889_1_;
}
 
開發者ID:jtrent238,項目名稱:PopularMMOS-EpicProportions-Mod,代碼行數:30,代碼來源:TileEntityBlockChristmasPresents_Red.java

示例10: addToSidedInventory

import net.minecraft.inventory.ISidedInventory; //導入方法依賴的package包/類
private ItemStack addToSidedInventory(ISidedInventory inventory, int side, ItemStack stack)
{
    ItemStack adding = stack.copy();
    int[] accessibleSlots = inventory.getAccessibleSlotsFromSide(side);
    for (int i = 0; i < accessibleSlots.length && adding.stackSize > 0; i++)
    {
        int slot = accessibleSlots[i];
        ItemStack inSlot = inventory.getStackInSlot(slot);
        if (inSlot == null || inSlot.getItem() == null)
        {
            inventory.setInventorySlotContents(slot, adding.copy());
            adding.stackSize = 0;
        } else if (inSlot.isItemEqual(adding) && ItemStack.areItemStackTagsEqual(stack, inSlot))
        {
            int stackLimit = Math.min(inSlot.getMaxStackSize(), inventory.getInventoryStackLimit());
            int remaining = inSlot.stackSize + adding.stackSize - stackLimit;
            if (remaining > 0)
            {
                inSlot.stackSize = stackLimit;
                adding.stackSize = remaining;
            } else
            {
                inSlot.stackSize += adding.stackSize;
                adding.stackSize = 0;
            }
        }
    }
    return adding;
}
 
開發者ID:MrSpring,項目名稱:ToggleBlocks,代碼行數:30,代碼來源:TileEntityToggleBlock.java

示例11: getFromSidedInventory

import net.minecraft.inventory.ISidedInventory; //導入方法依賴的package包/類
private ItemStack getFromSidedInventory(ISidedInventory inventory, int side, ItemStack stack)
{
    ItemStack result = null;
    int[] accessibleSlots = inventory.getAccessibleSlotsFromSide(side);
    for (int i = 0; i < accessibleSlots.length && result == null; i++)
    {
        int slot = accessibleSlots[i];
        ItemStack inSlot = inventory.getStackInSlot(slot);
        if (inSlot != null && inSlot.isItemEqual(stack) && inSlot.stackSize > 0)
            result = inSlot;
    }
    return result;
}
 
開發者ID:MrSpring,項目名稱:ToggleBlocks,代碼行數:14,代碼來源:TileEntityToggleBlock.java

示例12: getTFromSidedInventory

import net.minecraft.inventory.ISidedInventory; //導入方法依賴的package包/類
private ItemStack getTFromSidedInventory(ISidedInventory inventory, int side, String toolType)
{
    ItemStack result = null;
    int[] accessibleSlots = inventory.getAccessibleSlotsFromSide(side);
    for (int slot : accessibleSlots)
    {
        ItemStack inSlot = inventory.getStackInSlot(slot);
        if (isItemTool(toolType, inSlot))
            result = inSlot;
    }
    return result;
}
 
開發者ID:MrSpring,項目名稱:ToggleBlocks,代碼行數:13,代碼來源:TileEntityToggleBlock.java

示例13: copyInvFromSide

import net.minecraft.inventory.ISidedInventory; //導入方法依賴的package包/類
public static InventoryCopy copyInvFromSide(IInventory inv, int side)
{
	inv = InventoryUtils.checkChestInv(inv);

	ItemStack[] ret = new ItemStack[inv.getSizeInventory()];

	if(!(inv instanceof ISidedInventory))
	{
		for(int i = 0; i <= inv.getSizeInventory() - 1; i++)
		{
			ret[i] = inv.getStackInSlot(i) != null ? inv.getStackInSlot(i).copy() : null;
		}
	}
	else {
		ISidedInventory sidedInventory = (ISidedInventory)inv;
		int[] slots = sidedInventory.getAccessibleSlotsFromSide(ForgeDirection.getOrientation(side).getOpposite().ordinal());

		if(slots == null || slots.length == 0)
		{
			return null;
		}

		for(int get = 0; get <= slots.length - 1; get++)
		{
			int slotID = slots[get];

			ret[slotID] = sidedInventory.getStackInSlot(slotID) != null ? sidedInventory.getStackInSlot(slotID).copy() : null;
		}
		
		if(inv instanceof TileEntityBin)
		{
			return new InventoryCopy(ret, ((TileEntityBin)inv).getItemCount());
		}
		else {
			return new InventoryCopy(ret);
		}
	}

	return new InventoryCopy(ret);
}
 
開發者ID:Microsoft,項目名稱:vsminecraft,代碼行數:41,代碼來源:TransporterManager.java

示例14: func_145889_a

import net.minecraft.inventory.ISidedInventory; //導入方法依賴的package包/類
public static ItemStack func_145889_a(IInventory p_145889_0_, ItemStack p_145889_1_, int p_145889_2_)
{
    if (p_145889_0_ instanceof ISidedInventory && p_145889_2_ > -1)
    {
        ISidedInventory var6 = (ISidedInventory)p_145889_0_;
        int[] var7 = var6.getAccessibleSlotsFromSide(p_145889_2_);

        for (int var5 = 0; var5 < var7.length && p_145889_1_ != null && p_145889_1_.stackSize > 0; ++var5)
        {
            p_145889_1_ = func_145899_c(p_145889_0_, p_145889_1_, var7[var5], p_145889_2_);
        }
    }
    else
    {
        int var3 = p_145889_0_.getSizeInventory();

        for (int var4 = 0; var4 < var3 && p_145889_1_ != null && p_145889_1_.stackSize > 0; ++var4)
        {
            p_145889_1_ = func_145899_c(p_145889_0_, p_145889_1_, var4, p_145889_2_);
        }
    }

    if (p_145889_1_ != null && p_145889_1_.stackSize == 0)
    {
        p_145889_1_ = null;
    }

    return p_145889_1_;
}
 
開發者ID:MinecraftModdedClients,項目名稱:Resilience-Client-Source,代碼行數:30,代碼來源:TileEntityHopper.java

示例15: insertStack

import net.minecraft.inventory.ISidedInventory; //導入方法依賴的package包/類
/**
 * Inserts a stack into an inventory. Args: Inventory, stack, side. Returns leftover items.
 */
public ItemStack insertStack(IInventory par0IInventory, ItemStack par1ItemStack, int par2)
{
    if (par0IInventory instanceof ISidedInventory && par2 > -1)
    {
        ISidedInventory isidedinventory = (ISidedInventory)par0IInventory;
        int[] aint = isidedinventory.getAccessibleSlotsFromSide(par2);


        for (int j = 0; j < aint.length && par1ItemStack != null && par1ItemStack.stackSize > 0; ++j)
        {
            par1ItemStack = func_102014_c(par0IInventory, par1ItemStack, aint[j], par2);
        }
    }
    else
    {
        int k = par0IInventory.getSizeInventory();


        for (int l = 0; l < k && par1ItemStack != null && par1ItemStack.stackSize > 0; ++l)
        {
            par1ItemStack = func_102014_c(par0IInventory, par1ItemStack, l, par2);
        }
    }


    if (par1ItemStack != null && par1ItemStack.stackSize == 0)
    {
        par1ItemStack = null;
    }


    return par1ItemStack;
}
 
開發者ID:NovaViper,項目名稱:ZeroQuest,代碼行數:37,代碼來源:InventoryDarkPack.java


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