當前位置: 首頁>>代碼示例>>Java>>正文


Java WorldSavedData類代碼示例

本文整理匯總了Java中net.minecraft.world.WorldSavedData的典型用法代碼示例。如果您正苦於以下問題:Java WorldSavedData類的具體用法?Java WorldSavedData怎麽用?Java WorldSavedData使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


WorldSavedData類屬於net.minecraft.world包,在下文中一共展示了WorldSavedData類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: saveData

import net.minecraft.world.WorldSavedData; //導入依賴的package包/類
/**
 * Saves the given MapDataBase to disk.
 */
private void saveData(WorldSavedData p_75747_1_)
{
    if (this.saveHandler != null)
    {
        try
        {
            File file1 = this.saveHandler.getMapFileFromName(p_75747_1_.mapName);

            if (file1 != null)
            {
                NBTTagCompound nbttagcompound = new NBTTagCompound();
                p_75747_1_.writeToNBT(nbttagcompound);
                NBTTagCompound nbttagcompound1 = new NBTTagCompound();
                nbttagcompound1.setTag("data", nbttagcompound);
                FileOutputStream fileoutputstream = new FileOutputStream(file1);
                CompressedStreamTools.writeCompressed(nbttagcompound1, fileoutputstream);
                fileoutputstream.close();
            }
        }
        catch (Exception exception)
        {
            exception.printStackTrace();
        }
    }
}
 
開發者ID:Notoh,項目名稱:DecompiledMinecraft,代碼行數:29,代碼來源:MapStorage.java

示例2: saveData

import net.minecraft.world.WorldSavedData; //導入依賴的package包/類
/**
 * Saves the given MapDataBase to disk.
 */
private void saveData(WorldSavedData data)
{
    if (this.saveHandler != null)
    {
        try
        {
            File file1 = this.saveHandler.getMapFileFromName(data.mapName);

            if (file1 != null)
            {
                NBTTagCompound nbttagcompound = new NBTTagCompound();
                nbttagcompound.setTag("data", data.writeToNBT(new NBTTagCompound()));
                FileOutputStream fileoutputstream = new FileOutputStream(file1);
                CompressedStreamTools.writeCompressed(nbttagcompound, fileoutputstream);
                fileoutputstream.close();
            }
        }
        catch (Exception exception)
        {
            exception.printStackTrace();
        }
    }
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:27,代碼來源:MapStorage.java

示例3: getInstance

import net.minecraft.world.WorldSavedData; //導入依賴的package包/類
public static WorldScaleData getInstance(World world)
{
    if (world != null)
    {
        WorldSavedData handler = world.getPerWorldStorage().getOrLoadData(WorldScaleData.class, ID);
        if (handler == null)
        {
            handler = new WorldScaleData();
            world.getPerWorldStorage().setData(ID, handler);
        }
        ((WorldScaleData)handler).worldObj = world;

        return (WorldScaleData) handler;
    }
    return null;
}
 
開發者ID:DaedalusGame,項目名稱:BetterWithAddons,代碼行數:17,代碼來源:WorldScaleData.java

示例4: getInstance

import net.minecraft.world.WorldSavedData; //導入依賴的package包/類
public static LegendariumData getInstance(World world)
{
    if (world != null)
    {
        WorldSavedData handler = world.getPerWorldStorage().getOrLoadData(LegendariumData.class, ID);
        if (handler == null)
        {
            handler = new LegendariumData();
            world.getPerWorldStorage().setData(ID, handler);
        }
        ((LegendariumData)handler).worldObj = world;

        return (LegendariumData) handler;
    }
    return null;
}
 
開發者ID:DaedalusGame,項目名稱:BetterWithAddons,代碼行數:17,代碼來源:TileEntityLegendarium.java

示例5: getInstance

import net.minecraft.world.WorldSavedData; //導入依賴的package包/類
public static CubeManager getInstance()
{
	WorldServer world = DimensionManager.getWorld(ModDimensions.CUBE_ID);
	if (world != null)
	{
		WorldSavedData handler = world.getPerWorldStorage().getOrLoadData(CubeManager.class, ID);
		if (handler == null)
		{
			handler = new CubeManager();
			world.getPerWorldStorage().setData(ID, handler);
		}

		return (CubeManager) handler;
	}

	return null;
}
 
開發者ID:Alec-WAM,項目名稱:CrystalMod,代碼行數:18,代碼來源:CubeManager.java

示例6: setData

import net.minecraft.world.WorldSavedData; //導入依賴的package包/類
/**
 * Assigns the given String id to the given MapDataBase, removing any existing ones of the same id.
 */
public void setData(String par1Str, WorldSavedData par2WorldSavedData)
{
    if (par2WorldSavedData == null)
    {
        throw new RuntimeException("Can\'t set null data");
    }
    else
    {
        if (this.loadedDataMap.containsKey(par1Str))
        {
            this.loadedDataList.remove(this.loadedDataMap.remove(par1Str));
        }

        this.loadedDataMap.put(par1Str, par2WorldSavedData);
        this.loadedDataList.add(par2WorldSavedData);
    }
}
 
開發者ID:MinecraftModdedClients,項目名稱:Resilience-Client-Source,代碼行數:21,代碼來源:MapStorage.java

示例7: saveData

import net.minecraft.world.WorldSavedData; //導入依賴的package包/類
/**
 * Saves the given MapDataBase to disk.
 */
private void saveData(WorldSavedData par1WorldSavedData)
{
    if (this.saveHandler != null)
    {
        try
        {
            File var2 = this.saveHandler.getMapFileFromName(par1WorldSavedData.mapName);

            if (var2 != null)
            {
                NBTTagCompound var3 = new NBTTagCompound();
                par1WorldSavedData.writeToNBT(var3);
                NBTTagCompound var4 = new NBTTagCompound();
                var4.setTag("data", var3);
                FileOutputStream var5 = new FileOutputStream(var2);
                CompressedStreamTools.writeCompressed(var4, var5);
                var5.close();
            }
        }
        catch (Exception var6)
        {
            var6.printStackTrace();
        }
    }
}
 
開發者ID:MinecraftModdedClients,項目名稱:Resilience-Client-Source,代碼行數:29,代碼來源:MapStorage.java

示例8: setData

import net.minecraft.world.WorldSavedData; //導入依賴的package包/類
public void setData(String p_75745_1_, WorldSavedData p_75745_2_)
{
    if (p_75745_2_ == null)
    {
        throw new RuntimeException("Can\'t set null data");
    }
    else
    {
        if (this.loadedDataMap.containsKey(p_75745_1_))
        {
            this.loadedDataList.remove(this.loadedDataMap.remove(p_75745_1_));
        }

        this.loadedDataMap.put(p_75745_1_, p_75745_2_);
        this.loadedDataList.add(p_75745_2_);
    }
}
 
開發者ID:xtrafrancyz,項目名稱:Cauldron,代碼行數:18,代碼來源:MapStorage.java

示例9: saveData

import net.minecraft.world.WorldSavedData; //導入依賴的package包/類
private void saveData(WorldSavedData p_75747_1_)
{
    if (this.saveHandler != null)
    {
        try
        {
            File file1 = this.saveHandler.getMapFileFromName(p_75747_1_.mapName);

            if (file1 != null)
            {
                NBTTagCompound nbttagcompound = new NBTTagCompound();
                p_75747_1_.writeToNBT(nbttagcompound);
                NBTTagCompound nbttagcompound1 = new NBTTagCompound();
                nbttagcompound1.setTag("data", nbttagcompound);
                FileOutputStream fileoutputstream = new FileOutputStream(file1);
                CompressedStreamTools.writeCompressed(nbttagcompound1, fileoutputstream);
                fileoutputstream.close();
            }
        }
        catch (Exception exception)
        {
            exception.printStackTrace();
        }
    }
}
 
開發者ID:xtrafrancyz,項目名稱:Cauldron,代碼行數:26,代碼來源:MapStorage.java

示例10: func_75747_a

import net.minecraft.world.WorldSavedData; //導入依賴的package包/類
private void func_75747_a(WorldSavedData p_75747_1_) {
   if(this.field_75751_a != null) {
      try {
         File var2 = this.field_75751_a.func_75758_b(p_75747_1_.field_76190_i);
         if(var2 != null) {
            NBTTagCompound var3 = new NBTTagCompound();
            p_75747_1_.func_76187_b(var3);
            NBTTagCompound var4 = new NBTTagCompound();
            var4.func_74766_a("data", var3);
            FileOutputStream var5 = new FileOutputStream(var2);
            CompressedStreamTools.func_74799_a(var4, var5);
            var5.close();
         }
      } catch (Exception var6) {
         var6.printStackTrace();
      }

   }
}
 
開發者ID:HATB0T,項目名稱:RuneCraftery,代碼行數:20,代碼來源:MapStorage.java

示例11: saveData

import net.minecraft.world.WorldSavedData; //導入依賴的package包/類
/**
 * Saves the given MapDataBase to disk.
 */
private void saveData(WorldSavedData par1WorldSavedData)
{
    if (this.saveHandler != null)
    {
        try
        {
            File file1 = this.saveHandler.getMapFileFromName(par1WorldSavedData.mapName);

            if (file1 != null)
            {
                NBTTagCompound nbttagcompound = new NBTTagCompound();
                par1WorldSavedData.writeToNBT(nbttagcompound);
                NBTTagCompound nbttagcompound1 = new NBTTagCompound();
                nbttagcompound1.setCompoundTag("data", nbttagcompound);
                FileOutputStream fileoutputstream = new FileOutputStream(file1);
                CompressedStreamTools.writeCompressed(nbttagcompound1, fileoutputstream);
                fileoutputstream.close();
            }
        }
        catch (Exception exception)
        {
            exception.printStackTrace();
        }
    }
}
 
開發者ID:HATB0T,項目名稱:RuneCraftery,代碼行數:29,代碼來源:MapStorage.java

示例12: setData

import net.minecraft.world.WorldSavedData; //導入依賴的package包/類
/**
 * Assigns the given String id to the given MapDataBase, removing any existing ones of the same id.
 */
public void setData(String dataIdentifier, WorldSavedData data)
{
    if (this.loadedDataMap.containsKey(dataIdentifier))
    {
        this.loadedDataList.remove(this.loadedDataMap.remove(dataIdentifier));
    }

    this.loadedDataMap.put(dataIdentifier, data);
    this.loadedDataList.add(data);
}
 
開發者ID:Notoh,項目名稱:DecompiledMinecraft,代碼行數:14,代碼來源:MapStorage.java

示例13: saveAllData

import net.minecraft.world.WorldSavedData; //導入依賴的package包/類
/**
 * Saves all dirty loaded MapDataBases to disk.
 */
public void saveAllData()
{
    for (int i = 0; i < this.loadedDataList.size(); ++i)
    {
        WorldSavedData worldsaveddata = (WorldSavedData)this.loadedDataList.get(i);

        if (worldsaveddata.isDirty())
        {
            this.saveData(worldsaveddata);
            worldsaveddata.setDirty(false);
        }
    }
}
 
開發者ID:Notoh,項目名稱:DecompiledMinecraft,代碼行數:17,代碼來源:MapStorage.java

示例14: getOrLoadData

import net.minecraft.world.WorldSavedData; //導入依賴的package包/類
@Nullable

    /**
     * Loads an existing MapDataBase corresponding to the given id from disk, instantiating the given Class, or returns
     * null if none such file exists.
     */
    public WorldSavedData getOrLoadData(Class <? extends WorldSavedData > clazz, String dataIdentifier)
    {
        return (WorldSavedData)this.loadedDataMap.get(dataIdentifier);
    }
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:11,代碼來源:SaveDataMemoryStorage.java

示例15: getInstance

import net.minecraft.world.WorldSavedData; //導入依賴的package包/類
public static TerratorialData getInstance(World world)
{
    if (world != null)
    {
        WorldSavedData handler = world.getPerWorldStorage().getOrLoadData(TerratorialData.class, ID);
        if (handler == null)
        {
            handler = new TerratorialData();
            world.getPerWorldStorage().setData(ID, handler);
        }

        return (TerratorialData) handler;
    }
    return null;
}
 
開發者ID:DaedalusGame,項目名稱:BetterWithAddons,代碼行數:16,代碼來源:TerratorialData.java


注:本文中的net.minecraft.world.WorldSavedData類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。