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


Java ItemStackHelper.getAndSplit方法代码示例

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


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

示例1: decrStackSize

import net.minecraft.inventory.ItemStackHelper; //导入方法依赖的package包/类
/**
 * Removes up to a specified number of items from an inventory slot and returns them in a new stack.
 */
public ItemStack decrStackSize(int index, int count)
{
    List<ItemStack> list = null;

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

        index -= nonnulllist.size();
    }

    return list != null && !((ItemStack)list.get(index)).func_190926_b() ? ItemStackHelper.getAndSplit(list, index, count) : ItemStack.field_190927_a;
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:21,代码来源:InventoryPlayer.java

示例2: decrStackSize

import net.minecraft.inventory.ItemStackHelper; //导入方法依赖的package包/类
/**
 * Removes up to a specified number of items from an inventory slot and returns them in a new stack.
 */
@Nullable
public ItemStack decrStackSize(int index, int count)
{
    ItemStack[] aitemstack = null;

    for (ItemStack[] aitemstack1 : this.allInventories)
    {
        if (index < aitemstack1.length)
        {
            aitemstack = aitemstack1;
            break;
        }

        index -= aitemstack1.length;
    }

    return aitemstack != null && aitemstack[index] != null ? ItemStackHelper.getAndSplit(aitemstack, index, count) : null;
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:22,代码来源:InventoryPlayer.java

示例3: onPowered

import net.minecraft.inventory.ItemStackHelper; //导入方法依赖的package包/类
public void onPowered() {
    ItemStack input = inventory.get(0);
    if (!input.isEmpty()) {
        if (timer >= 20) {
            timer = 0;

            WinnowingMachineRecipe recipe = WinnowingMachineRecipes.instance().getProcessingResult(input);
            if (recipe != null) {
                IBlockState state = world.getBlockState(getPos());
                ItemStack output = recipe.getOutput().get();
                ItemStack junk = recipe.getJunk().get();
                EnumFacing facing = state.getValue(BlockFanHousing.FACING);
                if (!output.isEmpty()) outputItems(output, getPos(), facing);
                if (!junk.isEmpty()) outputItems(junk, getPos(), facing.rotateAround(Axis.Y).getOpposite());
                ItemStackHelper.getAndSplit(inventory, 0, 1); //Decrease by 1
            }
        } else timer++;
    }
}
 
开发者ID:GirafiStudios,项目名称:Culinary-Cultivation,代码行数:20,代码来源:TileEntitySeparator.java

示例4: decrStackSize

import net.minecraft.inventory.ItemStackHelper; //导入方法依赖的package包/类
@Nullable
@Override
public ItemStack decrStackSize(int index, int count)
{
    ItemStack itemstack = ItemStackHelper.getAndSplit(this.contents, index, count);

    if (!itemstack.isEmpty())
    {
        this.markDirty();
    }

    return itemstack;
}
 
开发者ID:iChun,项目名称:Clef,代码行数:14,代码来源:TileEntityInstrumentPlayer.java

示例5: decrStackSize

import net.minecraft.inventory.ItemStackHelper; //导入方法依赖的package包/类
@Override
public ItemStack decrStackSize(int index, int count) {
	ItemStack itemstack = ItemStackHelper.getAndSplit(inventory, index, count);

	if (!itemstack.isEmpty()) {
		this.markDirty();
	}

	return itemstack;
}
 
开发者ID:oMilkyy,项目名称:SimpleTubes,代码行数:11,代码来源:TileDisplacer.java

示例6: decrStackSize

import net.minecraft.inventory.ItemStackHelper; //导入方法依赖的package包/类
/**
 * Removes up to a specified number of items from an inventory slot and returns them in a new stack.
 */
public ItemStack decrStackSize(int index, int count)
{
    this.fillWithLoot((EntityPlayer)null);
    ItemStack itemstack = ItemStackHelper.getAndSplit(this.func_190576_q(), index, count);
    return itemstack;
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:10,代码来源:TileEntityHopper.java

示例7: decrStackSize

import net.minecraft.inventory.ItemStackHelper; //导入方法依赖的package包/类
/**
 * Removes up to a specified number of items from an inventory slot and returns them in a new stack.
 */
public ItemStack decrStackSize(int index, int count)
{
    this.fillWithLoot((EntityPlayer)null);
    ItemStack itemstack = ItemStackHelper.getAndSplit(this.func_190576_q(), index, count);

    if (!itemstack.func_190926_b())
    {
        this.markDirty();
    }

    return itemstack;
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:16,代码来源:TileEntityLockableLoot.java

示例8: decrStackSize

import net.minecraft.inventory.ItemStackHelper; //导入方法依赖的package包/类
/**
 * Removes up to a specified number of items from an inventory slot and returns them in a new stack.
 */
@Nullable
public ItemStack decrStackSize(int index, int count)
{
    this.addLoot((EntityPlayer)null);
    return ItemStackHelper.getAndSplit(this.minecartContainerItems, index, count);
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:10,代码来源:EntityMinecartContainer.java

示例9: decrStackSize

import net.minecraft.inventory.ItemStackHelper; //导入方法依赖的package包/类
/**
 * Removes up to a specified number of items from an inventory slot and returns them in a new stack.
 */
@Nullable
public ItemStack decrStackSize(int index, int count)
{
    this.fillWithLoot((EntityPlayer)null);
    ItemStack itemstack = ItemStackHelper.getAndSplit(this.chestContents, index, count);

    if (itemstack != null)
    {
        this.markDirty();
    }

    return itemstack;
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:17,代码来源:TileEntityChest.java

示例10: decrStackSize

import net.minecraft.inventory.ItemStackHelper; //导入方法依赖的package包/类
/**
 * Removes up to a specified number of items from an inventory slot and returns them in a new stack.
 */
@Nullable
public ItemStack decrStackSize(int index, int count)
{
    this.fillWithLoot((EntityPlayer)null);
    ItemStack itemstack = ItemStackHelper.getAndSplit(this.stacks, index, count);

    if (itemstack != null)
    {
        this.markDirty();
    }

    return itemstack;
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:17,代码来源:TileEntityDispenser.java

示例11: decrStackSize

import net.minecraft.inventory.ItemStackHelper; //导入方法依赖的package包/类
/**
 * Removes up to a specified number of items from an inventory slot and returns them in a new stack.
 */
@Nullable
public ItemStack decrStackSize(int index, int count)
{
    this.fillWithLoot((EntityPlayer)null);
    return ItemStackHelper.getAndSplit(this.inventory, index, count);
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:10,代码来源:TileEntityHopper.java

示例12: decrStackSize

import net.minecraft.inventory.ItemStackHelper; //导入方法依赖的package包/类
/**
 * Removes up to a specified number of items from an inventory slot and returns them in a new stack.
 */
@Override
public ItemStack decrStackSize(int index, int count)
{
    ItemStack itemstack = ItemStackHelper.getAndSplit(inventoryContents, index, count);

    if(itemstack != null)
        markDirty();

    return itemstack;
}
 
开发者ID:alxnns1,项目名称:MobHunter,代码行数:14,代码来源:InventoryPouch.java

示例13: decrStackSize

import net.minecraft.inventory.ItemStackHelper; //导入方法依赖的package包/类
@Nullable
@Override
public ItemStack decrStackSize(int index, int count) {
    loadAt(index);
    ItemStack result = ItemStackHelper.getAndSplit(inventory, index, count);
    saveAt(index);
    onChange();
    return result;
}
 
开发者ID:KodyJKing,项目名称:RandomToolKit,代码行数:10,代码来源:InventoryStack.java

示例14: decrStackSize

import net.minecraft.inventory.ItemStackHelper; //导入方法依赖的package包/类
@Nullable
@Override
public ItemStack decrStackSize(int index, int count) {
    ItemStack stack = ItemStackHelper.getAndSplit(inventory, index, count);
    if(stack != null)
        markDirty();
    return stack;
}
 
开发者ID:KodyJKing,项目名称:RandomToolKit,代码行数:9,代码来源:TileUDispenser.java

示例15: decrStackSize

import net.minecraft.inventory.ItemStackHelper; //导入方法依赖的package包/类
@Override
public ItemStack decrStackSize(int slot, int size) {
	ItemStack itemstack = ItemStackHelper.getAndSplit(inventory, slot, size);
	if (!itemstack.isEmpty()) {
		this.markDirty();
	}
	return itemstack;
}
 
开发者ID:notabadminer,项目名称:UniversalCoins,代码行数:9,代码来源:TileTradeStation.java


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