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