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