Search in sources :

Example 91 with CompoundNBT

use of net.minecraft.nbt.CompoundNBT in project BluePower by Qmunity.

the class TileMachineBase method load.

@Override
public void load(BlockState state, CompoundNBT compound) {
    super.load(state, compound);
    ListNBT nbttaglist = compound.getList("ItemBuffer", 10);
    for (int i = 0; i < nbttaglist.size(); ++i) {
        CompoundNBT nbttagcompound1 = nbttaglist.getCompound(i);
        internalItemStackBuffer.add(TubeStack.loadFromNBT(nbttagcompound1));
    }
}
Also used : ListNBT(net.minecraft.nbt.ListNBT) CompoundNBT(net.minecraft.nbt.CompoundNBT)

Example 92 with CompoundNBT

use of net.minecraft.nbt.CompoundNBT in project BluePower by Qmunity.

the class TileMachineBase method save.

@Override
public CompoundNBT save(CompoundNBT compound) {
    super.save(compound);
    ListNBT nbttaglist = new ListNBT();
    for (TubeStack tubeStack : internalItemStackBuffer) {
        if (tubeStack != null) {
            CompoundNBT nbttagcompound1 = new CompoundNBT();
            tubeStack.writeToNBT(nbttagcompound1);
            nbttaglist.add(nbttagcompound1);
        }
    }
    compound.put("ItemBuffer", nbttaglist);
    return compound;
}
Also used : ListNBT(net.minecraft.nbt.ListNBT) CompoundNBT(net.minecraft.nbt.CompoundNBT) TubeStack(com.bluepowermod.container.stack.TubeStack)

Example 93 with CompoundNBT

use of net.minecraft.nbt.CompoundNBT in project BluePower by Qmunity.

the class TileDeployer method save.

/**
 * This function gets called whenever the world/chunk is saved
 */
@Override
public CompoundNBT save(CompoundNBT tCompound) {
    super.save(tCompound);
    for (int i = 0; i < 9; i++) {
        CompoundNBT tc = new CompoundNBT();
        inventory.get(i).save(tc);
        tCompound.put("inventory" + i, tc);
    }
    return tCompound;
}
Also used : CompoundNBT(net.minecraft.nbt.CompoundNBT)

Example 94 with CompoundNBT

use of net.minecraft.nbt.CompoundNBT in project BluePower by Qmunity.

the class TileDeployer method load.

/**
 * This function gets called whenever the world/chunk loads
 */
@Override
public void load(BlockState blockState, CompoundNBT tCompound) {
    super.load(blockState, tCompound);
    for (int i = 0; i < 9; i++) {
        CompoundNBT tc = tCompound.getCompound("inventory" + i);
        inventory.set(i, ItemStack.of(tc));
    }
}
Also used : CompoundNBT(net.minecraft.nbt.CompoundNBT)

Example 95 with CompoundNBT

use of net.minecraft.nbt.CompoundNBT in project BluePower by Qmunity.

the class TileManager method load.

/**
 * This function gets called whenever the world/chunk loads
 */
@Override
public void load(BlockState blockState, CompoundNBT tCompound) {
    super.load(blockState, tCompound);
    for (int i = 0; i < 24; i++) {
        CompoundNBT tc = tCompound.getCompound("inventory" + i);
        inventory.set(i, ItemStack.of(tc));
    }
    filterColor = TubeColor.values()[tCompound.getByte("filterColor")];
    mode = tCompound.getByte("mode");
    priority = tCompound.getByte("priority");
    fuzzySetting = tCompound.getByte("fuzzySetting");
}
Also used : CompoundNBT(net.minecraft.nbt.CompoundNBT)

Aggregations

CompoundNBT (net.minecraft.nbt.CompoundNBT)119 ItemStack (net.minecraft.item.ItemStack)33 ListNBT (net.minecraft.nbt.ListNBT)15 Nonnull (javax.annotation.Nonnull)12 PlayerEntity (net.minecraft.entity.player.PlayerEntity)10 ResourceLocation (net.minecraft.util.ResourceLocation)8 BlockPos (net.minecraft.util.math.BlockPos)8 TileEntity (net.minecraft.tileentity.TileEntity)7 StringTextComponent (net.minecraft.util.text.StringTextComponent)7 TranslationTextComponent (net.minecraft.util.text.TranslationTextComponent)6 DimensionType (net.minecraft.world.dimension.DimensionType)6 TileBPMultipart (com.bluepowermod.tile.TileBPMultipart)5 Block (net.minecraft.block.Block)5 BlockState (net.minecraft.block.BlockState)5 ArrayList (java.util.ArrayList)4 ServerPlayerEntity (net.minecraft.entity.player.ServerPlayerEntity)4 SUpdateTileEntityPacket (net.minecraft.network.play.server.SUpdateTileEntityPacket)4 LongItemStack (com.cjm721.overloaded.storage.stacks.intint.LongItemStack)3 Nullable (javax.annotation.Nullable)3 IItemProvider (net.minecraft.util.IItemProvider)3