Java Code Examples for net.minecraft.world.World.loadItemData()

The following are Jave code examples for showing how to use loadItemData() of the net.minecraft.world.World class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
Example 1
Project: DecompiledMinecraft   File: MapGenStructure.java   Source Code and License Vote up 5 votes
private void func_143027_a(World worldIn)
{
    if (this.structureData == null)
    {
        this.structureData = (MapGenStructureData)worldIn.loadItemData(MapGenStructureData.class, this.getStructureName());

        if (this.structureData == null)
        {
            this.structureData = new MapGenStructureData(this.getStructureName());
            worldIn.setItemData(this.getStructureName(), this.structureData);
        }
        else
        {
            NBTTagCompound nbttagcompound = this.structureData.getTagCompound();

            for (String s : nbttagcompound.getKeySet())
            {
                NBTBase nbtbase = nbttagcompound.getTag(s);

                if (nbtbase.getId() == 10)
                {
                    NBTTagCompound nbttagcompound1 = (NBTTagCompound)nbtbase;

                    if (nbttagcompound1.hasKey("ChunkX") && nbttagcompound1.hasKey("ChunkZ"))
                    {
                        int i = nbttagcompound1.getInteger("ChunkX");
                        int j = nbttagcompound1.getInteger("ChunkZ");
                        StructureStart structurestart = MapGenStructureIO.getStructureStart(nbttagcompound1, worldIn);

                        if (structurestart != null)
                        {
                            this.structureMap.put(Long.valueOf(ChunkCoordIntPair.chunkXZ2Int(i, j)), structurestart);
                        }
                    }
                }
            }
        }
    }
}
 
Example 2
Project: DecompiledMinecraft   File: MapGenStructure.java   Source Code and License Vote up 5 votes
private void func_143027_a(World worldIn)
{
    if (this.structureData == null)
    {
        this.structureData = (MapGenStructureData)worldIn.loadItemData(MapGenStructureData.class, this.getStructureName());

        if (this.structureData == null)
        {
            this.structureData = new MapGenStructureData(this.getStructureName());
            worldIn.setItemData(this.getStructureName(), this.structureData);
        }
        else
        {
            NBTTagCompound nbttagcompound = this.structureData.getTagCompound();

            for (String s : nbttagcompound.getKeySet())
            {
                NBTBase nbtbase = nbttagcompound.getTag(s);

                if (nbtbase.getId() == 10)
                {
                    NBTTagCompound nbttagcompound1 = (NBTTagCompound)nbtbase;

                    if (nbttagcompound1.hasKey("ChunkX") && nbttagcompound1.hasKey("ChunkZ"))
                    {
                        int i = nbttagcompound1.getInteger("ChunkX");
                        int j = nbttagcompound1.getInteger("ChunkZ");
                        StructureStart structurestart = MapGenStructureIO.getStructureStart(nbttagcompound1, worldIn);

                        if (structurestart != null)
                        {
                            this.structureMap.put(Long.valueOf(ChunkCoordIntPair.chunkXZ2Int(i, j)), structurestart);
                        }
                    }
                }
            }
        }
    }
}
 
Example 3
Project: Backmemed   File: MapGenStructure.java   Source Code and License Vote up 5 votes
protected void initializeStructureData(World worldIn)
{
    if (this.structureData == null)
    {
        this.structureData = (MapGenStructureData)worldIn.loadItemData(MapGenStructureData.class, this.getStructureName());

        if (this.structureData == null)
        {
            this.structureData = new MapGenStructureData(this.getStructureName());
            worldIn.setItemData(this.getStructureName(), this.structureData);
        }
        else
        {
            NBTTagCompound nbttagcompound = this.structureData.getTagCompound();

            for (String s : nbttagcompound.getKeySet())
            {
                NBTBase nbtbase = nbttagcompound.getTag(s);

                if (nbtbase.getId() == 10)
                {
                    NBTTagCompound nbttagcompound1 = (NBTTagCompound)nbtbase;

                    if (nbttagcompound1.hasKey("ChunkX") && nbttagcompound1.hasKey("ChunkZ"))
                    {
                        int i = nbttagcompound1.getInteger("ChunkX");
                        int j = nbttagcompound1.getInteger("ChunkZ");
                        StructureStart structurestart = MapGenStructureIO.getStructureStart(nbttagcompound1, worldIn);

                        if (structurestart != null)
                        {
                            this.structureMap.put(ChunkPos.asLong(i, j), structurestart);
                        }
                    }
                }
            }
        }
    }
}
 
Example 4
Project: BaseClient   File: MapGenStructure.java   Source Code and License Vote up 4 votes
private void func_143027_a(World worldIn)
{
    if (this.structureData == null)
    {
        if (Reflector.ForgeWorld_getPerWorldStorage.exists())
        {
            MapStorage mapstorage = (MapStorage)Reflector.call(worldIn, Reflector.ForgeWorld_getPerWorldStorage, new Object[0]);
            this.structureData = (MapGenStructureData)mapstorage.loadData(MapGenStructureData.class, this.getStructureName());
        }
        else
        {
            this.structureData = (MapGenStructureData)worldIn.loadItemData(MapGenStructureData.class, this.getStructureName());
        }

        if (this.structureData == null)
        {
            this.structureData = new MapGenStructureData(this.getStructureName());

            if (Reflector.ForgeWorld_getPerWorldStorage.exists())
            {
                MapStorage mapstorage1 = (MapStorage)Reflector.call(worldIn, Reflector.ForgeWorld_getPerWorldStorage, new Object[0]);
                mapstorage1.setData(this.getStructureName(), this.structureData);
            }
            else
            {
                worldIn.setItemData(this.getStructureName(), this.structureData);
            }
        }
        else
        {
            NBTTagCompound nbttagcompound1 = this.structureData.getTagCompound();

            for (String s : nbttagcompound1.getKeySet())
            {
                NBTBase nbtbase = nbttagcompound1.getTag(s);

                if (nbtbase.getId() == 10)
                {
                    NBTTagCompound nbttagcompound = (NBTTagCompound)nbtbase;

                    if (nbttagcompound.hasKey("ChunkX") && nbttagcompound.hasKey("ChunkZ"))
                    {
                        int i = nbttagcompound.getInteger("ChunkX");
                        int j = nbttagcompound.getInteger("ChunkZ");
                        StructureStart structurestart = MapGenStructureIO.getStructureStart(nbttagcompound, worldIn);

                        if (structurestart != null)
                        {
                            this.structureMap.put(Long.valueOf(ChunkCoordIntPair.chunkXZ2Int(i, j)), structurestart);
                            this.structureLongMap.add(ChunkCoordIntPair.chunkXZ2Int(i, j), structurestart);
                        }
                    }
                }
            }
        }
    }
}
 
Example 5
Project: BaseClient   File: MapGenStructure.java   Source Code and License Vote up 4 votes
private void func_143027_a(World worldIn)
{
    if (this.structureData == null)
    {
        if (Reflector.ForgeWorld_getPerWorldStorage.exists())
        {
            MapStorage mapstorage = (MapStorage)Reflector.call(worldIn, Reflector.ForgeWorld_getPerWorldStorage, new Object[0]);
            this.structureData = (MapGenStructureData)mapstorage.loadData(MapGenStructureData.class, this.getStructureName());
        }
        else
        {
            this.structureData = (MapGenStructureData)worldIn.loadItemData(MapGenStructureData.class, this.getStructureName());
        }

        if (this.structureData == null)
        {
            this.structureData = new MapGenStructureData(this.getStructureName());

            if (Reflector.ForgeWorld_getPerWorldStorage.exists())
            {
                MapStorage mapstorage1 = (MapStorage)Reflector.call(worldIn, Reflector.ForgeWorld_getPerWorldStorage, new Object[0]);
                mapstorage1.setData(this.getStructureName(), this.structureData);
            }
            else
            {
                worldIn.setItemData(this.getStructureName(), this.structureData);
            }
        }
        else
        {
            NBTTagCompound nbttagcompound1 = this.structureData.getTagCompound();

            for (String s : nbttagcompound1.getKeySet())
            {
                NBTBase nbtbase = nbttagcompound1.getTag(s);

                if (nbtbase.getId() == 10)
                {
                    NBTTagCompound nbttagcompound = (NBTTagCompound)nbtbase;

                    if (nbttagcompound.hasKey("ChunkX") && nbttagcompound.hasKey("ChunkZ"))
                    {
                        int i = nbttagcompound.getInteger("ChunkX");
                        int j = nbttagcompound.getInteger("ChunkZ");
                        StructureStart structurestart = MapGenStructureIO.getStructureStart(nbttagcompound, worldIn);

                        if (structurestart != null)
                        {
                            this.structureMap.put(Long.valueOf(ChunkCoordIntPair.chunkXZ2Int(i, j)), structurestart);
                            this.structureLongMap.add(ChunkCoordIntPair.chunkXZ2Int(i, j), structurestart);
                        }
                    }
                }
            }
        }
    }
}
 
Example 6
Project: Backmemed   File: ItemMap.java   Source Code and License Vote up 4 votes
@Nullable
public static MapData loadMapData(int mapId, World worldIn)
{
    String s = "map_" + mapId;
    return (MapData)worldIn.loadItemData(MapData.class, s);
}