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


Java ItemStackHelper类代码示例

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


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

示例1: writeEntityToNBT

import net.minecraft.inventory.ItemStackHelper; //导入依赖的package包/类
/**
 * (abstract) Protected helper method to write subclass entity data to NBT.
 */
protected void writeEntityToNBT(NBTTagCompound compound)
{
    super.writeEntityToNBT(compound);

    if (this.lootTable != null)
    {
        compound.setString("LootTable", this.lootTable.toString());

        if (this.lootTableSeed != 0L)
        {
            compound.setLong("LootTableSeed", this.lootTableSeed);
        }
    }
    else
    {
        ItemStackHelper.func_191282_a(compound, this.minecartContainerItems);
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:22,代码来源:EntityMinecartContainer.java

示例2: readEntityFromNBT

import net.minecraft.inventory.ItemStackHelper; //导入依赖的package包/类
/**
 * (abstract) Protected helper method to read subclass entity data from NBT.
 */
protected void readEntityFromNBT(NBTTagCompound compound)
{
    super.readEntityFromNBT(compound);
    this.minecartContainerItems = NonNullList.<ItemStack>func_191197_a(this.getSizeInventory(), ItemStack.field_190927_a);

    if (compound.hasKey("LootTable", 8))
    {
        this.lootTable = new ResourceLocation(compound.getString("LootTable"));
        this.lootTableSeed = compound.getLong("LootTableSeed");
    }
    else
    {
        ItemStackHelper.func_191283_b(compound, this.minecartContainerItems);
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:19,代码来源:EntityMinecartContainer.java

示例3: 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

示例4: writeToNBT

import net.minecraft.inventory.ItemStackHelper; //导入依赖的package包/类
public NBTTagCompound writeToNBT(NBTTagCompound compound)
{
    super.writeToNBT(compound);

    if (!this.checkLootAndWrite(compound))
    {
        ItemStackHelper.func_191282_a(compound, this.chestContents);
    }

    if (this.hasCustomName())
    {
        compound.setString("CustomName", this.field_190577_o);
    }

    return compound;
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:17,代码来源:TileEntityChest.java

示例5: func_190580_f

import net.minecraft.inventory.ItemStackHelper; //导入依赖的package包/类
public NBTTagCompound func_190580_f(NBTTagCompound p_190580_1_)
{
    if (!this.checkLootAndWrite(p_190580_1_))
    {
        ItemStackHelper.func_191281_a(p_190580_1_, this.field_190596_f, false);
    }

    if (this.hasCustomName())
    {
        p_190580_1_.setString("CustomName", this.field_190577_o);
    }

    if (!p_190580_1_.hasKey("Lock") && this.isLocked())
    {
        this.getLockCode().toNBT(p_190580_1_);
    }

    return p_190580_1_;
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:20,代码来源:TileEntityShulkerBox.java

示例6: writeToNBT

import net.minecraft.inventory.ItemStackHelper; //导入依赖的package包/类
public NBTTagCompound writeToNBT(NBTTagCompound compound)
{
    super.writeToNBT(compound);

    if (!this.checkLootAndWrite(compound))
    {
        ItemStackHelper.func_191282_a(compound, this.stacks);
    }

    if (this.hasCustomName())
    {
        compound.setString("CustomName", this.field_190577_o);
    }

    return compound;
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:17,代码来源:TileEntityDispenser.java

示例7: readFromNBT

import net.minecraft.inventory.ItemStackHelper; //导入依赖的package包/类
public void readFromNBT(NBTTagCompound compound)
{
    super.readFromNBT(compound);
    this.inventory = NonNullList.<ItemStack>func_191197_a(this.getSizeInventory(), ItemStack.field_190927_a);

    if (!this.checkLootAndRead(compound))
    {
        ItemStackHelper.func_191283_b(compound, this.inventory);
    }

    if (compound.hasKey("CustomName", 8))
    {
        this.field_190577_o = compound.getString("CustomName");
    }

    this.transferCooldown = compound.getInteger("TransferCooldown");
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:18,代码来源:TileEntityHopper.java

示例8: writeToNBT

import net.minecraft.inventory.ItemStackHelper; //导入依赖的package包/类
public NBTTagCompound writeToNBT(NBTTagCompound compound)
{
    super.writeToNBT(compound);

    if (!this.checkLootAndWrite(compound))
    {
        ItemStackHelper.func_191282_a(compound, this.inventory);
    }

    compound.setInteger("TransferCooldown", this.transferCooldown);

    if (this.hasCustomName())
    {
        compound.setString("CustomName", this.field_190577_o);
    }

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

示例9: readFromNBT

import net.minecraft.inventory.ItemStackHelper; //导入依赖的package包/类
@Override
public void readFromNBT(NBTTagCompound compound) {
	super.readFromNBT(compound);
	//NBTTagList nbttaglist = compound.getTagList("Items", 10);
	ItemStackHelper.loadAllItems(compound, furnaceItemStacks);
	/*this.furnaceItemStacks = new ItemStack[this.getSizeInventory()];

	for (int i = 0; i < nbttaglist.tagCount(); ++i) {
		NBTTagCompound nbttagcompound = nbttaglist.getCompoundTagAt(i);
		int j = nbttagcompound.getByte("Slot");

		if (j >= 0 && j < this.furnaceItemStacks.length)
			this.furnaceItemStacks[j] = ItemStack.loadItemStackFromNBT(nbttagcompound);
	}*/

	this.furnaceBurnTime = compound.getInteger("BurnTime");
	this.cookTime = compound.getInteger("CookTime");
	this.totalCookTime = compound.getInteger("CookTimeTotal");
	this.currentItemBurnTime = getItemBurnTime(this.furnaceItemStacks.get(1));

	if (compound.hasKey("CustomName", 8))
		this.furnaceCustomName = compound.getString("CustomName");
}
 
开发者ID:rafradek,项目名称:Mods,代码行数:24,代码来源:TileEntityAmmoFurnace.java

示例10: writeToNBT

import net.minecraft.inventory.ItemStackHelper; //导入依赖的package包/类
@Override
public NBTTagCompound writeToNBT(NBTTagCompound compound) {
	super.writeToNBT(compound);
	compound.setInteger("BurnTime", this.furnaceBurnTime);
	compound.setInteger("CookTime", this.cookTime);
	compound.setInteger("CookTimeTotal", this.totalCookTime);
	ItemStackHelper.saveAllItems(compound, furnaceItemStacks);
	/*NBTTagList nbttaglist = new NBTTagList();

	for (int i = 0; i < this.furnaceItemStacks.length; ++i)
		if (this.furnaceItemStacks[i] != null) {
			NBTTagCompound nbttagcompound = new NBTTagCompound();
			nbttagcompound.setByte("Slot", (byte) i);
			this.furnaceItemStacks[i].writeToNBT(nbttagcompound);
			nbttaglist.appendTag(nbttagcompound);
		}

	compound.setTag("Items", nbttaglist);*/

	if (this.hasCustomName())
		compound.setString("CustomName", this.furnaceCustomName);

	return compound;
}
 
开发者ID:rafradek,项目名称:Mods,代码行数:25,代码来源:TileEntityAmmoFurnace.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)
{
    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

示例12: readEntityFromNBT

import net.minecraft.inventory.ItemStackHelper; //导入依赖的package包/类
/**
    * (abstract) Protected helper method to read subclass entity data from NBT.
    */
   @SuppressWarnings("deprecation")
@Override
protected void readEntityFromNBT(NBTTagCompound compound)
   {
   	if (compound.getBoolean("CustomDisplayTile"))
       {
           Block block;

           if (compound.hasKey("DisplayTile", 8))
           {
               block = Block.getBlockFromName(compound.getString("DisplayTile"));
           }
           else
           {
               block = Block.getBlockById(compound.getInteger("DisplayTile"));
           }

           int i = compound.getInteger("DisplayData");
           this.setDisplayTile(block == null ? Blocks.AIR.getDefaultState() : block.getStateFromMeta(i));
           this.setDisplayTileOffset(compound.getInteger("DisplayOffset"));
       }
   	ItemStackHelper.loadAllItems(compound, inventory);
   }
 
开发者ID:Alec-WAM,项目名称:CrystalMod,代码行数:27,代码来源:EntityCrystalChestMinecartBase.java

示例13: readFromNBT

import net.minecraft.inventory.ItemStackHelper; //导入依赖的package包/类
@Override
public void readFromNBT(NBTTagCompound nbt){
   	if(!player.getEntityWorld().isRemote){
   		ItemStack found = findRealStack(player);
   		backpack = (!ItemStackTools.isValid(found) ? backpack : found);
   		if(ItemStackTools.isValid(backpack)){
   			nbt = backpack.getTagCompound();
   			if(!Strings.isNullOrEmpty(tagName)){
   				nbt = backpack.getTagCompound().getCompoundTag(tagName);
   			}
   			if(nbt !=null){
   				//Clear inventory before load
   				clear();
   				ItemStackHelper.loadAllItems(nbt, slots);
   				if(nbt.hasKey("UpgradeItems") && upgradeItems !=null){
   					ItemStackHelper.loadAllItems(nbt.getCompoundTag("UpgradeItems"), upgradeItems);
   				}
   			}
   		}
   	}
   }
 
开发者ID:Alec-WAM,项目名称:CrystalMod,代码行数:22,代码来源:InventoryBackpackUpgrades.java

示例14: readFromNBTNoPlayer

import net.minecraft.inventory.ItemStackHelper; //导入依赖的package包/类
@Override
public void readFromNBTNoPlayer(NBTTagCompound nbt){
   	if(ItemStackTools.isValid(backpack)){
		nbt = backpack.getTagCompound();
		if(!Strings.isNullOrEmpty(tagName)){
			nbt = backpack.getTagCompound().getCompoundTag(tagName);
		}
		if(nbt !=null){
			//Clear inventory before load
			clear();
			ItemStackHelper.loadAllItems(nbt, slots);
			if(nbt.hasKey("UpgradeItems") && upgradeItems !=null){
				ItemStackHelper.loadAllItems(nbt.getCompoundTag("UpgradeItems"), upgradeItems);
			}
		}
	}
   }
 
开发者ID:Alec-WAM,项目名称:CrystalMod,代码行数:18,代码来源:InventoryBackpackUpgrades.java

示例15: readFromNBT

import net.minecraft.inventory.ItemStackHelper; //导入依赖的package包/类
public void readFromNBT(NBTTagCompound nbt){
	if(!player.getEntityWorld().isRemote){
		ItemStack found = findRealStack(player);
		backpack = (!ItemStackTools.isValid(found) ? backpack : found);
		if(ItemStackTools.isValid(backpack)){
			nbt = backpack.getTagCompound();
			if(!Strings.isNullOrEmpty(tagName)){
				nbt = backpack.getTagCompound().getCompoundTag(tagName);
			}
			if(nbt !=null){
				//Clear inventory before load
				clear();
				ItemStackHelper.loadAllItems(nbt, slots);
			}
		}
	}
}
 
开发者ID:Alec-WAM,项目名称:CrystalMod,代码行数:18,代码来源:InventoryBackpack.java


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