本文整理汇总了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;
}
示例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;
}
示例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++;
}
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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);
}
示例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;
}
示例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;
}
示例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);
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}