Search in sources :

Example 51 with NBTTagCompound

use of net.minecraft.nbt.NBTTagCompound in project LogisticsPipes by RS485.

the class LPBCTileGenericPipe method writeToNBT_LP.

@Override
public void writeToNBT_LP(NBTTagCompound nbt) {
    NBTTagCompound bcNBT = new NBTTagCompound();
    for (int i = 0; i < ForgeDirection.VALID_DIRECTIONS.length; i++) {
        final String key = "redstoneInputSide[" + i + "]";
        bcNBT.setByte(key, (byte) redstoneInputSide[i]);
    }
    pipe.writeToNBT(bcNBT);
    sideProperties.writeToNBT(bcNBT);
    nbt.setTag("BC_Pipe_NBT", bcNBT);
}
Also used : NBTTagCompound(net.minecraft.nbt.NBTTagCompound)

Example 52 with NBTTagCompound

use of net.minecraft.nbt.NBTTagCompound in project LogisticsPipes by RS485.

the class LPRoutedBCTravelingItem method saveToExtraNBTData.

public void saveToExtraNBTData() {
    if (routingInformation == null) {
        return;
    }
    NBTTagCompound nbt = getExtraData();
    NBTTagCompound info = new NBTTagCompound();
    routingInformation.writeToNBT(info);
    nbt.setTag("LPRoutingInformation", info);
}
Also used : NBTTagCompound(net.minecraft.nbt.NBTTagCompound)

Example 53 with NBTTagCompound

use of net.minecraft.nbt.NBTTagCompound in project LogisticsPipes by RS485.

the class LogisticsRoutingBoardRobot method writeSelfToNBT.

@Override
public void writeSelfToNBT(NBTTagCompound nbt) {
    super.writeSelfToNBT(nbt);
    nbt.setInteger("LP_Item_Size", items.size());
    int count = 0;
    for (LPTravelingItemServer stack : items) {
        NBTTagCompound nbt_Sub = new NBTTagCompound();
        stack.writeToNBT(nbt_Sub);
        nbt.setTag("LP_Item_" + count++, nbt_Sub);
    }
    if (targetStationPos != null) {
        targetStationPos.writeToNBT("targetStationPos_", nbt);
    }
    nbt.setByte("targetStationSide", (byte) targetStationSide.ordinal());
}
Also used : NBTTagCompound(net.minecraft.nbt.NBTTagCompound) LPTravelingItemServer(logisticspipes.transport.LPTravelingItem.LPTravelingItemServer)

Example 54 with NBTTagCompound

use of net.minecraft.nbt.NBTTagCompound in project LogisticsPipes by RS485.

the class LPDataIOWrapperTest method testNBTTagCompound.

@Test
public void testNBTTagCompound() throws Exception {
    NBTTagCompound tag = new NBTTagCompound();
    tag.setBoolean("bool", true);
    tag.setByte("byte", (byte) 127);
    tag.setByteArray("byteArray", new byte[] { -1, 127, 0, 12 });
    tag.setDouble("double", 0.12D);
    tag.setFloat("float", 0.13F);
    tag.setIntArray("intArray", new int[] { Integer.MIN_VALUE, 0, Integer.MAX_VALUE, -1 });
    tag.setInteger("int", 12);
    tag.setLong("long", -1);
    tag.setShort("short", (short) 15);
    tag.setString("string", "text");
    tag.setTag("tag", new NBTTagCompound());
    byte[] data = LPDataIOWrapper.collectData(output -> output.writeNBTTagCompound(tag));
    LPDataIOWrapper.provideData(data, input -> {
        assertEquals(tag, input.readNBTTagCompound());
        assertEquals(BUFFER_EMPTY_MSG, 0, ((LPDataIOWrapper) input).localBuffer.readableBytes());
    });
}
Also used : NBTTagCompound(net.minecraft.nbt.NBTTagCompound) Test(org.junit.Test)

Example 55 with NBTTagCompound

use of net.minecraft.nbt.NBTTagCompound in project OpenLights by PC-Logix.

the class ManagedEnvironment method save.

@Override
public void save(final NBTTagCompound nbt) {
    if (node() != null) {
        // client (for example keyboard and screen/text buffer).
        if (node().address() == null) {
            li.cil.oc.api.Network.joinNewNetwork(node());
            final NBTTagCompound nodeTag = new NBTTagCompound();
            node().save(nodeTag);
            nbt.setTag("node", nodeTag);
            node().remove();
        } else {
            final NBTTagCompound nodeTag = new NBTTagCompound();
            node().save(nodeTag);
            nbt.setTag("node", nodeTag);
        }
    }
}
Also used : NBTTagCompound(net.minecraft.nbt.NBTTagCompound)

Aggregations

NBTTagCompound (net.minecraft.nbt.NBTTagCompound)3985 NBTTagList (net.minecraft.nbt.NBTTagList)1052 ItemStack (net.minecraft.item.ItemStack)883 BlockPos (net.minecraft.util.math.BlockPos)229 TileEntity (net.minecraft.tileentity.TileEntity)173 SideOnly (net.minecraftforge.fml.relauncher.SideOnly)148 ArrayList (java.util.ArrayList)99 Block (net.minecraft.block.Block)98 ResourceLocation (net.minecraft.util.ResourceLocation)96 IBlockState (net.minecraft.block.state.IBlockState)92 EntityPlayer (net.minecraft.entity.player.EntityPlayer)81 NBTTagString (net.minecraft.nbt.NBTTagString)79 Nonnull (javax.annotation.Nonnull)74 Map (java.util.Map)71 UUID (java.util.UUID)69 NBTBase (net.minecraft.nbt.NBTBase)66 HashMap (java.util.HashMap)64 EnumFacing (net.minecraft.util.EnumFacing)61 NotNull (org.jetbrains.annotations.NotNull)60 Item (net.minecraft.item.Item)55