use of net.minecraft.nbt.NBTTagList in project MineFactoryReloaded by powercrystals.
the class TileEntityRedNetLogic method writeToNBT.
@Override
public void writeToNBT(NBTTagCompound nbttagcompound) {
super.writeToNBT(nbttagcompound);
NBTTagList circuits = new NBTTagList();
for (int c = 0; c < _circuits.length; c++) {
NBTTagCompound circuit = new NBTTagCompound();
circuit.setString("circuit", _circuits[c].getClass().getName());
NBTTagList inputPins = new NBTTagList();
for (int p = 0; p < _pinMappingInputs[c].length; p++) {
NBTTagCompound pin = new NBTTagCompound();
pin.setInteger("buffer", _pinMappingInputs[c][p].buffer);
pin.setInteger("pin", _pinMappingInputs[c][p].pin);
inputPins.appendTag(pin);
}
circuit.setTag("inputPins", inputPins);
NBTTagList outputPins = new NBTTagList();
for (int p = 0; p < _pinMappingOutputs[c].length; p++) {
NBTTagCompound pin = new NBTTagCompound();
pin.setInteger("buffer", _pinMappingOutputs[c][p].buffer);
pin.setInteger("pin", _pinMappingOutputs[c][p].pin);
outputPins.appendTag(pin);
}
circuit.setTag("outputPins", outputPins);
NBTTagCompound circuitState = new NBTTagCompound();
_circuits[c].writeToNBT(circuitState);
circuit.setTag("state", circuitState);
circuits.appendTag(circuit);
}
nbttagcompound.setTag("circuits", circuits);
nbttagcompound.setIntArray("upgrades", _upgradeLevel);
nbttagcompound.setIntArray("vars", _buffers[13]);
}
use of net.minecraft.nbt.NBTTagList in project MineFactoryReloaded by powercrystals.
the class TileEntityFactoryPowered method writeToNBT.
@Override
public void writeToNBT(NBTTagCompound tag) {
super.writeToNBT(tag);
tag.setInteger("energyStored", _energyStored);
tag.setInteger("workDone", _workDone);
tag.setInteger("ueBuffer", _ueBuffer);
NBTTagCompound pp = new NBTTagCompound();
_powerProvider.writeToNBT(pp);
tag.setCompoundTag("powerProvider", pp);
if (failedDrops != null) {
NBTTagList nbttaglist = new NBTTagList();
for (ItemStack item : failedDrops) {
NBTTagCompound nbttagcompound1 = new NBTTagCompound();
item.writeToNBT(nbttagcompound1);
nbttaglist.appendTag(nbttagcompound1);
}
tag.setTag("DropItems", nbttaglist);
}
}
use of net.minecraft.nbt.NBTTagList in project ImmersiveEngineering by BluSunrize.
the class MultiFluidTank method writeToNBT.
public NBTTagCompound writeToNBT(NBTTagCompound nbt) {
NBTTagList tagList = new NBTTagList();
for (FluidStack fs : this.fluids) if (fs != null)
tagList.appendTag(fs.writeToNBT(new NBTTagCompound()));
nbt.setTag("fluids", tagList);
return nbt;
}
use of net.minecraft.nbt.NBTTagList in project ImmersiveEngineering by BluSunrize.
the class TConstructHelper method sendAlloyForMelting.
public static void sendAlloyForMelting(FluidStack output, Object... input) {
assert (input.length % 2 == 0);
FluidStack[] inputStacks = new FluidStack[input.length / 2];
for (int i = 0; i < inputStacks.length; i++) if (input[i * 2] instanceof String && input[i * 2 + 1] instanceof Integer) {
Fluid f = FluidRegistry.getFluid((String) input[i * 2]);
if (f != null)
inputStacks[i] = new FluidStack(f, (Integer) input[i * 2 + 1]);
}
NBTTagList tagList = new NBTTagList();
tagList.appendTag(output.writeToNBT(new NBTTagCompound()));
for (FluidStack stack : inputStacks) if (stack != null)
tagList.appendTag(stack.writeToNBT(new NBTTagCompound()));
NBTTagCompound message = new NBTTagCompound();
message.setTag("alloy", tagList);
// FMLInterModComms.sendMessage("tconstruct", "alloy", message);
// For some reason IMC on this is broken? So direct interaction is required. Oh well.
TinkerRegistry.registerAlloy(output, inputStacks);
}
use of net.minecraft.nbt.NBTTagList in project ImmersiveEngineering by BluSunrize.
the class Utils method writeInventory.
public static NBTTagList writeInventory(Collection<ItemStack> inv) {
NBTTagList invList = new NBTTagList();
byte slot = 0;
for (ItemStack s : inv) {
if (s != null) {
NBTTagCompound itemTag = new NBTTagCompound();
itemTag.setByte("Slot", slot);
s.writeToNBT(itemTag);
invList.appendTag(itemTag);
}
slot++;
}
return invList;
}
Aggregations