Search in sources :

Example 41 with NBTTagList

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");
}
Also used : NBTTagList(net.minecraft.nbt.NBTTagList)

Example 42 with NBTTagList

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);
    }
}
Also used : NBTTagList(net.minecraft.nbt.NBTTagList) ChunkPosition(net.minecraft.world.ChunkPosition) NBTTagCompound(net.minecraft.nbt.NBTTagCompound) HashMap(java.util.HashMap) Map(java.util.Map) HashBiMap(com.google.common.collect.HashBiMap) SubscribeEvent(cpw.mods.fml.common.eventhandler.SubscribeEvent)

Example 43 with NBTTagList

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);
}
Also used : NBTTagList(net.minecraft.nbt.NBTTagList) ChunkPosition(net.minecraft.world.ChunkPosition) NBTTagCompound(net.minecraft.nbt.NBTTagCompound)

Example 44 with NBTTagList

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);
}
Also used : NBTTagList(net.minecraft.nbt.NBTTagList) NBTTagCompound(net.minecraft.nbt.NBTTagCompound) ItemStack(net.minecraft.item.ItemStack) Map(java.util.Map) HashMap(java.util.HashMap)

Example 45 with NBTTagList

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;
}
Also used : NBTTagList(net.minecraft.nbt.NBTTagList) NBTTagCompound(net.minecraft.nbt.NBTTagCompound)

Aggregations

NBTTagList (net.minecraft.nbt.NBTTagList)451 NBTTagCompound (net.minecraft.nbt.NBTTagCompound)385 ItemStack (net.minecraft.item.ItemStack)69 NBTTagString (net.minecraft.nbt.NBTTagString)42 BlockPos (net.minecraft.util.math.BlockPos)18 HashMap (java.util.HashMap)17 Map (java.util.Map)17 NotNull (org.jetbrains.annotations.NotNull)17 ArrayList (java.util.ArrayList)14 AMVector3 (am2.api.math.AMVector3)9 ChunkPosition (net.minecraft.world.ChunkPosition)9 NBTBase (net.minecraft.nbt.NBTBase)8 EntityPlayer (net.minecraft.entity.player.EntityPlayer)7 Vec3d (net.minecraft.util.math.Vec3d)7 WorldCoordinate (mods.railcraft.api.core.WorldCoordinate)6 Block (net.minecraft.block.Block)6 ItemIdentifierStack (logisticspipes.utils.item.ItemIdentifierStack)5 Entity (net.minecraft.entity.Entity)5 TileEntity (net.minecraft.tileentity.TileEntity)5 ChunkPos (net.minecraft.util.math.ChunkPos)5