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);
}
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);
}
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());
}
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());
});
}
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);
}
}
}
Aggregations