use of net.minecraft.nbt.NBTTagList in project PneumaticCraft by MineMaarten.
the class SemiBlockLogistics method readFromNBT.
@Override
public void readFromNBT(NBTTagCompound tag) {
super.readFromNBT(tag);
TileEntityBase.readInventoryFromNBT(tag, filters, "filters");
NBTTagList tagList = tag.getTagList("fluidFilters", 10);
for (int i = 0; i < tagList.tagCount(); i++) {
fluidFilters[tagList.getCompoundTagAt(i).getInteger("index")].readFromNBT(tagList.getCompoundTagAt(i));
}
invisible = tag.getBoolean("invisible");
}
use of net.minecraft.nbt.NBTTagList in project PneumaticCraft by MineMaarten.
the class SemiBlockManager method onChunkSave.
@SubscribeEvent
public void onChunkSave(ChunkDataEvent.Save event) {
Map<ChunkPosition, ISemiBlock> map = semiBlocks.get(event.getChunk());
if (map != null && map.size() > 0) {
NBTTagList tagList = new NBTTagList();
for (Map.Entry<ChunkPosition, ISemiBlock> entry : map.entrySet()) {
NBTTagCompound t = new NBTTagCompound();
entry.getValue().writeToNBT(t);
t.setInteger("x", entry.getKey().chunkPosX);
t.setInteger("y", entry.getKey().chunkPosY);
t.setInteger("z", entry.getKey().chunkPosZ);
t.setString("type", getKeyForSemiBlock(entry.getValue()));
tagList.appendTag(t);
}
event.getData().setTag("SemiBlocks", tagList);
}
}
use of net.minecraft.nbt.NBTTagList in project PneumaticCraft by MineMaarten.
the class GlobalVariableManager method readFromNBT.
@Override
public void readFromNBT(NBTTagCompound tag) {
globalVars.clear();
NBTTagList list = tag.getTagList("globalVars", 10);
for (int i = 0; i < list.tagCount(); i++) {
NBTTagCompound t = list.getCompoundTagAt(i);
globalVars.put(t.getString("varName"), new ChunkPosition(t.getInteger("x"), t.getInteger("y"), t.getInteger("z")));
}
readItemVars(tag, globalItemVars);
}
use of net.minecraft.nbt.NBTTagList in project PneumaticCraft by MineMaarten.
the class GlobalVariableManager method writeItemVars.
public void writeItemVars(NBTTagCompound tag, Map<String, ItemStack> map) {
NBTTagList list = new NBTTagList();
for (Map.Entry<String, ItemStack> entry : globalItemVars.entrySet()) {
NBTTagCompound t = new NBTTagCompound();
t.setString("varName", entry.getKey());
NBTTagCompound itemTag = new NBTTagCompound();
entry.getValue().writeToNBT(itemTag);
t.setTag("item", itemTag);
list.appendTag(t);
}
tag.setTag("globalItemVars", list);
}
use of net.minecraft.nbt.NBTTagList in project PneumaticCraft by MineMaarten.
the class RemoteLayout method toNBT.
public NBTTagCompound toNBT(int guiLeft, int guiTop) {
NBTTagCompound tag = new NBTTagCompound();
NBTTagList tagList = new NBTTagList();
for (ActionWidget actionWidget : actionWidgets) {
tagList.appendTag(actionWidget.toNBT(guiLeft, guiTop));
}
tag.setTag("actionWidgets", tagList);
return tag;
}
Aggregations