Java 类net.minecraft.inventory.ItemStackHelper 实例源码

项目:Backmemed    文件:EntityMinecartContainer.java   
/**
 * (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);
    }
}
项目:Backmemed    文件:EntityMinecartContainer.java   
/**
 * (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);
    }
}
项目:Backmemed    文件:InventoryPlayer.java   
/**
 * 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;
}
项目:Backmemed    文件:TileEntityChest.java   
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;
}
项目:Backmemed    文件:TileEntityShulkerBox.java   
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_;
}
项目:Backmemed    文件:TileEntityDispenser.java   
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;
}
项目:Backmemed    文件:TileEntityHopper.java   
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");
}
项目:Backmemed    文件:TileEntityHopper.java   
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;
}
项目:Mods    文件:TileEntityAmmoFurnace.java   
@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");
}
项目:Mods    文件:TileEntityAmmoFurnace.java   
@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;
}
项目:CustomWorldGen    文件:InventoryPlayer.java   
/**
 * 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;
}
项目:CrystalMod    文件:EntityCrystalChestMinecartBase.java   
/**
    * (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);
   }
项目:CrystalMod    文件:InventoryBackpackUpgrades.java   
@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);
                }
            }
        }
    }
   }
项目:CrystalMod    文件:InventoryBackpackUpgrades.java   
@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);
            }
        }
    }
   }
项目:CrystalMod    文件:InventoryBackpack.java   
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);
            }
        }
    }
}
项目:ToroChess    文件:BlockChessControl.java   
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);
}
项目:Qbar    文件:TileSmallMiningDrill.java   
@Override
public NBTTagCompound writeToNBT(final NBTTagCompound tag)
{
    super.writeToNBT(tag);

    tag.setTag("steamTank", this.steamTank.writeToNBT(new NBTTagCompound()));
    tag.setTag("fluidTank", this.fluidTank.writeToNBT(new NBTTagCompound()));

    tag.setFloat("heat", this.heat);
    tag.setFloat("maxHeat", this.maxHeat);

    tag.setBoolean("completed", this.isCompleted());
    tag.setLong("lastPos", this.lastPos.toLong());
    tag.setInteger("tickBeforeHarvest", this.tickBeforeHarvest);

    tag.setTag("tempVarious", ItemStackHelper.saveAllItems(new NBTTagCompound(), this.tempVarious));
    tag.setTag("tempSludge", this.tempSludge.writeToNBT(new NBTTagCompound()));
    return tag;
}
项目:Qbar    文件:TileSmallMiningDrill.java   
@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"));
}
项目:Qbar    文件:TileKeypunch.java   
@Override
public NBTTagCompound writeToNBT(final NBTTagCompound tag)
{
    super.writeToNBT(tag);

    tag.setBoolean("isCraftTab", this.isCraftTabProperty.getValue());

    final NBTTagCompound craftTag = new NBTTagCompound();
    ItemStackHelper.saveAllItems(craftTag, (NonNullList<ItemStack>) this.craftStacks.getModifiableValue());
    tag.setTag("craftTag", craftTag);

    final NBTTagCompound filterTag = new NBTTagCompound();
    ItemStackHelper.saveAllItems(filterTag, (NonNullList<ItemStack>) this.filterStacks.getModifiableValue());
    tag.setTag("filterTag", filterTag);

    return tag;
}
项目:Qbar    文件:TileKeypunch.java   
@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));
    }
}
项目:UniversalCoins    文件:TilePowerReceiver.java   
@Override
public NBTTagCompound writeToNBT(NBTTagCompound tagCompound) {
    super.writeToNBT(tagCompound);
    NBTTagList itemList = new NBTTagList();
    ItemStackHelper.saveAllItems(tagCompound, this.inventory);
    tagCompound.setLong("coinSum", coinSum);
    tagCompound.setInteger("feLevel", feLevel);
    tagCompound.setInteger("feOutput", feOutput);
    tagCompound.setLong("wfeLevel", wfeLevel);
    tagCompound.setString("blockOwner", blockOwner);
    if (orientation != null) {
        tagCompound.setInteger("orientation", orientation.ordinal());
    }
    tagCompound.setBoolean("publicAccess", publicAccess);

    return tagCompound;
}
项目:UniversalCoins    文件:TilePackager.java   
@Override
public NBTTagCompound writeToNBT(NBTTagCompound tagCompound) {
    super.writeToNBT(tagCompound);
    NBTTagList itemList = new NBTTagList();
    ItemStackHelper.saveAllItems(tagCompound, this.inventory);
    tagCompound.setLong("coinSum", coinSum);
    tagCompound.setBoolean("cardAvailable", cardAvailable);
    tagCompound.setString("customName", customName);
    tagCompound.setBoolean("inUse", inUse);
    tagCompound.setInteger("packageSize", packageSize);
    tagCompound.setString("packageTarget", packageTarget);
    tagCompound.setInteger("smallPrice", packageCost[0]);
    tagCompound.setInteger("medPrice", packageCost[1]);
    tagCompound.setInteger("largePrice", packageCost[2]);

    return tagCompound;
}
项目:Culinary-Cultivation    文件:TileEntitySeparator.java   
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++;
    }
}
项目:KalStuff    文件:TileEntityChickenNest.java   
@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");
        }
}
项目:ExpandedRailsMod    文件:InventoryPlayer.java   
/**
 * 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;
}
项目:AbyssalCraft    文件:TileEntityEnergyDepositioner.java   
@Override
public NBTTagCompound writeToNBT(NBTTagCompound nbttagcompound)
{
    super.writeToNBT(nbttagcompound);
    nbttagcompound.setInteger("ActivationTimer", activationTimer);
    nbttagcompound.setInteger("Tolerance", tolerance);
    nbttagcompound.setFloat("PotEnergy", energy);
    PEUtils.writeManipulatorNBT(this, nbttagcompound);
    ItemStackHelper.saveAllItems(nbttagcompound, containerItemStacks);
    nbttagcompound.setInteger("ProcessingTime", processingTime);
    NBTTagCompound nbtItem = new NBTTagCompound();
    if(!processingStack.isEmpty())
        processingStack.writeToNBT(nbtItem);
    nbttagcompound.setTag("ProcessingStack", nbtItem);

    return nbttagcompound;
}
项目:Minecoprocessors    文件:TileEntityMinecoprocessor.java   
@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);
  }
}
项目:Minecoprocessors    文件:TileEntityMinecoprocessor.java   
@Override
public NBTTagCompound writeToNBT(NBTTagCompound cIn) {
  NBTTagCompound c = super.writeToNBT(cIn);
  c.setTag(NBT_PROCESSOR, processor.writeToNBT());

  c.setShort(NBT_LOAD_TIME, (short) loadTime);
  ItemStackHelper.saveAllItems(c, codeItemStacks);

  if (this.hasCustomName()) {
    c.setString(NBT_CUSTOM_NAME, this.customName);
  }

  return c;
}
项目:GardenStuff    文件:TileBloomeryFurnace.java   
@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));
}
项目:GardenStuff    文件:TileBloomeryFurnace.java   
@Override
protected NBTTagCompound writeToFixedNBT (NBTTagCompound tag) {
    tag = super.writeToFixedNBT(tag);

    tag.setShort("BurnTime", (short)furnaceBurnTime);
    tag.setShort("CookTime", (short)cookTime);
    tag.setShort("CookTimeTotal", (short)totalCookTime);

    ItemStackHelper.saveAllItems(tag, furnaceItemStacks);

    return tag;
}
项目:Clef    文件:TileEntityInstrumentPlayer.java   
@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());
}
项目:Clef    文件:TileEntityInstrumentPlayer.java   
@Nullable
@Override
public ItemStack decrStackSize(int index, int count)
{
    ItemStack itemstack = ItemStackHelper.getAndSplit(this.contents, index, count);

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

    return itemstack;
}
项目:SimpleTubes    文件:TileDisplacer.java   
@Override
public ItemStack decrStackSize(int index, int count) {
    ItemStack itemstack = ItemStackHelper.getAndSplit(inventory, index, count);

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

    return itemstack;
}
项目:Backmemed    文件:TileEntityChest.java   
public void readFromNBT(NBTTagCompound compound)
{
    super.readFromNBT(compound);
    this.chestContents = NonNullList.<ItemStack>func_191197_a(this.getSizeInventory(), ItemStack.field_190927_a);

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

    if (compound.hasKey("CustomName", 8))
    {
        this.field_190577_o = compound.getString("CustomName");
    }
}
项目:Backmemed    文件:TileEntityBrewingStand.java   
public void readFromNBT(NBTTagCompound compound)
{
    super.readFromNBT(compound);
    this.brewingItemStacks = NonNullList.<ItemStack>func_191197_a(this.getSizeInventory(), ItemStack.field_190927_a);
    ItemStackHelper.func_191283_b(compound, this.brewingItemStacks);
    this.brewTime = compound.getShort("BrewTime");

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

    this.fuel = compound.getByte("Fuel");
}
项目:Backmemed    文件:TileEntityBrewingStand.java   
public NBTTagCompound writeToNBT(NBTTagCompound compound)
{
    super.writeToNBT(compound);
    compound.setShort("BrewTime", (short)this.brewTime);
    ItemStackHelper.func_191282_a(compound, this.brewingItemStacks);

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

    compound.setByte("Fuel", (byte)this.fuel);
    return compound;
}
项目:Backmemed    文件:TileEntityShulkerBox.java   
public void func_190586_e(NBTTagCompound p_190586_1_)
{
    this.field_190596_f = NonNullList.<ItemStack>func_191197_a(this.getSizeInventory(), ItemStack.field_190927_a);

    if (!this.checkLootAndRead(p_190586_1_) && p_190586_1_.hasKey("Items", 9))
    {
        ItemStackHelper.func_191283_b(p_190586_1_, this.field_190596_f);
    }

    if (p_190586_1_.hasKey("CustomName", 8))
    {
        this.field_190577_o = p_190586_1_.getString("CustomName");
    }
}
项目:Backmemed    文件:TileEntityDispenser.java   
public void readFromNBT(NBTTagCompound compound)
{
    super.readFromNBT(compound);
    this.stacks = NonNullList.<ItemStack>func_191197_a(this.getSizeInventory(), ItemStack.field_190927_a);

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

    if (compound.hasKey("CustomName", 8))
    {
        this.field_190577_o = compound.getString("CustomName");
    }
}
项目:Backmemed    文件:TileEntityHopper.java   
/**
 * 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;
}
项目:Backmemed    文件:TileEntityLockableLoot.java   
/**
 * 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;
}