Search in sources :

Example 81 with CompoundNBT

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

the class TileBPMicroblock method getUpdatePacket.

@Override
public SUpdateTileEntityPacket getUpdatePacket() {
    CompoundNBT nbtTag = new CompoundNBT();
    save(nbtTag);
    return new SUpdateTileEntityPacket(getBlockPos(), 1, nbtTag);
}
Also used : CompoundNBT(net.minecraft.nbt.CompoundNBT) SUpdateTileEntityPacket(net.minecraft.network.play.server.SUpdateTileEntityPacket)

Example 82 with CompoundNBT

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

the class TileAlloyFurnace method load.

/**
 ************* BASIC TE FUNCTIONS *************
 */
/**
 * 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));
    }
    fuelInventory = ItemStack.of(tCompound.getCompound("fuelInventory"));
    outputInventory = ItemStack.of(tCompound.getCompound("outputInventory"));
}
Also used : CompoundNBT(net.minecraft.nbt.CompoundNBT)

Example 83 with CompoundNBT

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

the class TileBuffer 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 < 20; i++) {
        CompoundNBT tc = new CompoundNBT();
        allInventories.get(i).save(tc);
        tCompound.put("inventory" + i, tc);
    }
    return tCompound;
}
Also used : CompoundNBT(net.minecraft.nbt.CompoundNBT)

Example 84 with CompoundNBT

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

the class TileBuffer 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 < 20; i++) {
        CompoundNBT tc = tCompound.getCompound("inventory" + i);
        allInventories.set(i, ItemStack.of(tc));
    }
}
Also used : CompoundNBT(net.minecraft.nbt.CompoundNBT)

Example 85 with CompoundNBT

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

the class TileEjector 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)

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