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


Java ItemStackHelper.loadAllItems方法代码示例

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


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

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

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

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

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

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

示例6: generateChessBoard

import net.minecraft.inventory.ItemStackHelper; //导入方法依赖的package包/类
private void generateChessBoard(World world, BlockPos pos, EntityLivingBase placer, ItemStack stack) {
  BlockPos a8 = pos.add(A8_CENTER_OFFSET);
  UUID gameId = UUID.randomUUID();
  NBTTagCompound c = stack.getTagCompound();

  IBlockState whiteBlock = null;
  IBlockState blackBlock = null;

  if (c != null) {
    NonNullList<ItemStack> list = NonNullList.<ItemStack>withSize(2, ItemStack.EMPTY);
    ItemStackHelper.loadAllItems(c, list);
    whiteBlock = getBlockState(world, pos, placer, list.get(0));
    blackBlock = getBlockState(world, pos, placer, list.get(1));
  }
  new ChessGameGenerator(world, a8, pos, gameId, whiteBlock, blackBlock).generate();

  setGameDataToTileEntity(world, pos, a8, gameId);
}
 
开发者ID:ToroCraft,项目名称:ToroChess,代码行数:19,代码来源:BlockChessControl.java

示例7: readFromNBT

import net.minecraft.inventory.ItemStackHelper; //导入方法依赖的package包/类
@Override
public void readFromNBT(final NBTTagCompound tag)
{
    super.readFromNBT(tag);

    if (tag.hasKey("steamTank"))
        this.steamTank.readFromNBT(tag.getCompoundTag("steamTank"));
    if (tag.hasKey("fluidTank"))
        this.fluidTank.readFromNBT(tag.getCompoundTag("fluidTank"));

    this.heat = tag.getFloat("heat");
    this.maxHeat = tag.getFloat("maxHeat");

    this.completed = tag.getBoolean("completed");
    this.lastPos = BlockPos.fromLong(tag.getLong("lastPos"));
    this.tickBeforeHarvest = tag.getInteger("tickBeforeHarvest");

    ItemStackHelper.loadAllItems(tag.getCompoundTag("tempVarious"), this.tempVarious);
    this.tempSludge = new ItemStack(tag.getCompoundTag("tempSludge"));
}
 
开发者ID:OPMCorp,项目名称:Qbar,代码行数:21,代码来源:TileSmallMiningDrill.java

示例8: readFromNBT

import net.minecraft.inventory.ItemStackHelper; //导入方法依赖的package包/类
@Override
public void readFromNBT(final NBTTagCompound tag)
{
    super.readFromNBT(tag);

    this.isCraftTabProperty.setValue(tag.getBoolean("isCraftTab"));

    final NonNullList<ItemStack> tmpCraft = NonNullList.withSize(9, ItemStack.EMPTY);
    ItemStackHelper.loadAllItems(tag.getCompoundTag("craftTag"), tmpCraft);

    final NonNullList<ItemStack> tmpFilter = NonNullList.withSize(9, ItemStack.EMPTY);
    ItemStackHelper.loadAllItems(tag.getCompoundTag("filterTag"), tmpFilter);

    for (int i = 0; i < 9; i++)
    {
        this.craftStacks.set(i, tmpCraft.get(i));
        this.filterStacks.set(i, tmpFilter.get(i));
    }
}
 
开发者ID:OPMCorp,项目名称:Qbar,代码行数:20,代码来源:TileKeypunch.java

示例9: readFromNBT

import net.minecraft.inventory.ItemStackHelper; //导入方法依赖的package包/类
@Override
public void readFromNBT(NBTTagCompound parentNBTTagCompound)
{
	 super.readFromNBT(parentNBTTagCompound);
        this.inventory = NonNullList.<ItemStack>withSize(this.getSizeInventory(), ItemStack.EMPTY);

        if (!this.checkLootAndRead(parentNBTTagCompound))
        {
            ItemStackHelper.loadAllItems(parentNBTTagCompound, this.inventory);
        }

        if (parentNBTTagCompound.hasKey("CustomName", 8))
        {
            this.customName = parentNBTTagCompound.getString("CustomName");
        }
}
 
开发者ID:TEAMModding,项目名称:KalStuff,代码行数:17,代码来源:TileEntityChickenNest.java

示例10: readFromNBT

import net.minecraft.inventory.ItemStackHelper; //导入方法依赖的package包/类
@Override
public void readFromNBT(NBTTagCompound c) {
  super.readFromNBT(c);
  processor.readFromNBT(c.getCompoundTag(NBT_PROCESSOR));

  codeItemStacks = NonNullList.<ItemStack>withSize(this.getSizeInventory(), ItemStack.EMPTY);
  ItemStackHelper.loadAllItems(c, codeItemStacks);

  loadTime = c.getShort(NBT_LOAD_TIME);

  if (c.hasKey(NBT_CUSTOM_NAME, 8)) {
    this.customName = c.getString(NBT_CUSTOM_NAME);
  }
}
 
开发者ID:ToroCraft,项目名称:Minecoprocessors,代码行数:15,代码来源:TileEntityMinecoprocessor.java

示例11: readFromFixedNBT

import net.minecraft.inventory.ItemStackHelper; //导入方法依赖的package包/类
@Override
protected void readFromFixedNBT (NBTTagCompound tag) {
    super.readFromFixedNBT(tag);

    furnaceItemStacks = NonNullList.withSize(getSizeInventory(), ItemStack.EMPTY);
    ItemStackHelper.loadAllItems(tag, furnaceItemStacks);

    furnaceBurnTime = tag.getShort("BurnTime");
    cookTime = tag.getShort("CookTime");
    totalCookTime = tag.getShort("CookTimeTotal");
    currentItemBurnTime = getItemBurnTime(furnaceItemStacks.get(SLOT_FUEL));
}
 
开发者ID:jaquadro,项目名称:GardenStuff,代码行数:13,代码来源:TileBloomeryFurnace.java

示例12: readFromNBT

import net.minecraft.inventory.ItemStackHelper; //导入方法依赖的package包/类
@Override
public void readFromNBT(NBTTagCompound tag)
{
    super.readFromNBT(tag);
    this.contents = NonNullList.withSize(this.getSizeInventory(), ItemStack.EMPTY);
    ItemStackHelper.loadAllItems(tag, this.contents);

    this.previousRedstoneState = tag.getBoolean("powered");

    tracks.clear();
    int size = tag.getInteger("trackCount");
    for(int i = 0; i < size; i++)
    {
        TrackFile file = AbcLibrary.getTrack(tag.getString("track_" + i));
        if(file != null)
        {
            tracks.add(file);
        }
    }
    size = tag.getInteger("playedCount");
    for(int i = 0; i < size; i++)
    {
        playedTracks.add(tag.getString("played_" + i));
    }

    bandName = tag.getString("bandName");
    syncPlay = tag.getBoolean("syncPlay");
    syncTrack = tag.getBoolean("syncTrack");
    repeat = tag.getInteger("repeat");
    shuffle = tag.getBoolean("shuffle");

    playlistIndex = MathHelper.clamp(tag.getInteger("playlistIndex"), 0, tracks.size());
}
 
开发者ID:iChun,项目名称:Clef,代码行数:34,代码来源:TileEntityInstrumentPlayer.java

示例13: readFromNBTNoPlayer

import net.minecraft.inventory.ItemStackHelper; //导入方法依赖的package包/类
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);
	}
}
  }
 
开发者ID:Alec-WAM,项目名称:CrystalMod,代码行数:14,代码来源:InventoryBackpack.java

示例14: readFromStack

import net.minecraft.inventory.ItemStackHelper; //导入方法依赖的package包/类
public void readFromStack(ItemStack stack){
	NBTTagCompound nbt = ItemNBTHelper.getCompound(stack);
	if(nbt.hasKey(NBT_INVENTORY)){
		NBTTagCompound invNBT = nbt.getCompoundTag(NBT_INVENTORY);
		ItemStackHelper.loadAllItems(invNBT, inventory);
	}
}
 
开发者ID:Alec-WAM,项目名称:CrystalMod,代码行数:8,代码来源:TileEntityCaseBase.java

示例15: readFromNBT

import net.minecraft.inventory.ItemStackHelper; //导入方法依赖的package包/类
@Override
public void readFromNBT(NBTTagCompound compound) {
	super.readFromNBT(compound);
	this.chestContents = NonNullList.<ItemStack>withSize(this.getSizeInventory(), ItemStack.EMPTY);
	ItemStackHelper.loadAllItems(compound, this.chestContents);
	if (compound.hasKey("CustomName", 8)) {
		this.customName = compound.getString("CustomName");
	}
}
 
开发者ID:tom5454,项目名称:Toms-Mod,代码行数:10,代码来源:TileEntityLimitableChest.java


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