当前位置: 首页>>代码示例>>Java>>正文


Java ChunkDataEvent.Save方法代码示例

本文整理汇总了Java中net.minecraftforge.event.world.ChunkDataEvent.Save方法的典型用法代码示例。如果您正苦于以下问题:Java ChunkDataEvent.Save方法的具体用法?Java ChunkDataEvent.Save怎么用?Java ChunkDataEvent.Save使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在net.minecraftforge.event.world.ChunkDataEvent的用法示例。


在下文中一共展示了ChunkDataEvent.Save方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onChunkSave

import net.minecraftforge.event.world.ChunkDataEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void onChunkSave(ChunkDataEvent.Save event) {
    Map<BlockPos, List<ISemiBlock>> map = semiBlocks.get(event.getChunk());
    if (map != null && map.size() > 0) {
        NBTTagList tagList = new NBTTagList();
        for (Map.Entry<BlockPos, List<ISemiBlock>> entry : map.entrySet()) {
            for(ISemiBlock semiBlock : entry.getValue()){
                NBTTagCompound t = new NBTTagCompound();
                semiBlock.writeToNBT(t);
                NBTUtil.setPos(t, entry.getKey());
                t.setString("type", getKeyForSemiBlock(semiBlock));
                tagList.appendTag(t);
            }
        }
        event.getData().setTag("SemiBlocks", tagList);
    }
}
 
开发者ID:TeamPneumatic,项目名称:pnc-repressurized,代码行数:18,代码来源:SemiBlockManager.java

示例2: onChunkSave

import net.minecraftforge.event.world.ChunkDataEvent; //导入方法依赖的package包/类
@SubscribeEvent
public static void onChunkSave(ChunkDataEvent.Save event) {
	if (!event.getWorld().isRemote) {
		int dim = event.getWorld().provider.getDimension();
		ChunkPos pos = event.getChunk().getPos();

		StabilityData stability = getChunkData(dim, pos);
		if (stability != StabilityData.NO_DATA) {
			event.getData().setTag(STABILITY_KEY, stability.writeToNBT());
		}

		if (!event.getChunk().isLoaded()) {
			removeChunkData(dim, pos);
		}
	}
}
 
开发者ID:the-realest-stu,项目名称:Etheric,代码行数:17,代码来源:StabilityHandler.java

示例3: saveChunk

import net.minecraftforge.event.world.ChunkDataEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void saveChunk(ChunkDataEvent.Save event) {	
	long index = Chunk2Index(event.getChunk());
	NBTTagCompound nbt = VintageTG.proxy.getChunkNbt(index); // chunkextranbt_savequeue.get(index);
	
	
	if (nbt != null) {
		event.getData().setTag("vintagecraft", nbt);
		mark(event.getChunk().xPosition, event.getChunk().zPosition, "save " + nbt.hasKey("climate"));
	} else {
		mark(event.getChunk().xPosition, event.getChunk().zPosition, "save-no nbt?");
	}
	
	
	
	if (!event.getChunk().isLoaded()) {
		mark(event.getChunk().xPosition, event.getChunk().zPosition, "removed from list");
		// TODO
		//VintageCraft.proxy.removeChunkNbt(Chunk2Index(event.getChunk()));
	}
}
 
开发者ID:tyronx,项目名称:vintagetg,代码行数:22,代码来源:VCraftWorld.java

示例4: onDataSave

import net.minecraftforge.event.world.ChunkDataEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void onDataSave(ChunkDataEvent.Save event)
{
	if (!event.world.isRemote && CWTFC_Core.getCDM(event.world) != null)
	{
		NBTTagCompound levelTag = event.getData().getCompoundTag("Level");
		int x = levelTag.getInteger("xPos");
		int z = levelTag.getInteger("zPos");
		ChunkData data = CWTFC_Core.getCDM(event.world).getData(x, z);
		
		if(data != null)
		{
			NBTTagCompound CWTFCTag = data.getTag();
			event.getData().setTag("CWTFCData", CWTFCTag);
			if(data.isUnloaded)
				CWTFC_Core.getCDM(event.world).removeData(x, z);
		}
	}
}
 
开发者ID:StrayWolfe,项目名称:Cooking-with-TFC,代码行数:20,代码来源:ChunkHandler.java

示例5: saveChunk

import net.minecraftforge.event.world.ChunkDataEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void saveChunk(ChunkDataEvent.Save event) {	
	long index = Chunk2Index(event.getChunk());
	NBTTagCompound nbt = VintageCraft.proxy.getChunkNbt(index); // chunkextranbt_savequeue.get(index);
	
	
	if (nbt != null) {
		event.getData().setTag("vintagecraft", nbt);
		mark(event.getChunk().xPosition, event.getChunk().zPosition, "save " + nbt.hasKey("climate"));
	} else {
		mark(event.getChunk().xPosition, event.getChunk().zPosition, "save-no nbt?");
	}
	
	
	
	if (!event.getChunk().isLoaded()) {
		mark(event.getChunk().xPosition, event.getChunk().zPosition, "removed from list");
		// FIXME: Make this work (seems to be causing issues at random where removed nbts were still needed)
		//VintageCraft.proxy.removeChunkNbt(Chunk2Index(event.getChunk()));
	}
}
 
开发者ID:tyronx,项目名称:vintagecraft,代码行数:22,代码来源:VCraftWorld.java

示例6: chunkSave

import net.minecraftforge.event.world.ChunkDataEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void chunkSave(ChunkDataEvent.Save event) {
	NBTTagCompound oresPlusRegen = new NBTTagCompound();
	
	int dimId = event.world.provider.dimensionId;
    NBTTagCompound oreRegenArray = new NBTTagCompound();
    ArrayList<WorldGenOre> oreGenArray = WorldGenCore.oreGenerators.get(dimId);
    if (oreGenArray != null) {
    	for (WorldGenOre oreGen : oreGenArray) {
    		oreRegenArray.setString(oreGen.getOreName(), oreGen.regenKey);
    	}
    }
    oresPlusRegen.setTag("oreRegenArray", oreRegenArray);
	oresPlusRegen.setString("ores", OresPlus.regenKeyOre);
	oresPlusRegen.setString("oil", OresPlus.regenKeyOil);
	oresPlusRegen.setString("rubberTree", OresPlus.regenKeyRubberTree);
	oresPlusRegen.setString("beehives", OresPlus.regenKeyBeehives);
	event.getData().setTag("OresPlus", oresPlusRegen);
}
 
开发者ID:TheTorbinWren,项目名称:OresPlus,代码行数:20,代码来源:OreEventHandler.java

示例7: onChunkSave

import net.minecraftforge.event.world.ChunkDataEvent; //导入方法依赖的package包/类
@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);
    }
}
 
开发者ID:MineMaarten,项目名称:PneumaticCraft,代码行数:18,代码来源:SemiBlockManager.java

示例8: onChunkSave

import net.minecraftforge.event.world.ChunkDataEvent; //导入方法依赖的package包/类
@SubscribeEvent
public static void onChunkSave(ChunkDataEvent.Save event)
{
	IChunkLevel chunkLevel = getChunkLevel(event.getChunk());
	
	if (!(chunkLevel instanceof ChunkLevel)) return;
	
	event.getData().setTag(ID.toString(), ((ChunkLevel) chunkLevel).serializeNBT());
}
 
开发者ID:TheXFactor117,项目名称:Loot-Slash-Conquer,代码行数:10,代码来源:CapabilityChunkLevel.java

示例9: onChunkSave

import net.minecraftforge.event.world.ChunkDataEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void onChunkSave(ChunkDataEvent.Save event) {
    Vec v = new Vec(event.getChunk().x, 0, event.getChunk().z);
    D d = memory.get(v);
    if (d != null) {
        Path p = tmpDir.resolve(fileName(v));
        try (DataOutputStream stream = new DataOutputStream(new BufferedOutputStream(Files.newOutputStream(p)))) {
            codec.save(stream, d);
            memory.remove(v);
        } catch (IOException e) {
            throw new UncheckedIOException(e);
        }
    }
}
 
开发者ID:kenzierocks,项目名称:HardVox,代码行数:15,代码来源:ChunkDataStore.java

示例10: onChunkDataSave

import net.minecraftforge.event.world.ChunkDataEvent; //导入方法依赖的package包/类
@SubscribeEvent
public static void onChunkDataSave(ChunkDataEvent.Save e)
{
    try
    {
        e.getData().setFloat("sif_power", PurMag.INSTANCE.sif_storage.get(GlobalChunkPos.fromChunk(e.getChunk())));
    }
    catch (Exception ex)
    {
        PurMag.INSTANCE.log.error("Can't save the SIF chunk data!", ex);
    }
}
 
开发者ID:PearXTeam,项目名称:PurificatiMagicae,代码行数:13,代码来源:SifEvents.java

示例11: onChunkSave

import net.minecraftforge.event.world.ChunkDataEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void onChunkSave(ChunkDataEvent.Save event) {
	ChunkListOfPlayers chunk = AllChunks.getChunk(event.getChunk());
	if (chunk != null) {
		NBTTagList nbt = new NBTTagList();
		AllChunks.getChunk(event.getChunk()).writeToNBT(nbt);;
		event.getData().setTag("PlayerInChunk", nbt);
	}
}
 
开发者ID:coehlrich,项目名称:chunk-logger,代码行数:10,代码来源:EventHandlerCommon.java

示例12: getChunkData

import net.minecraftforge.event.world.ChunkDataEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void getChunkData(final ChunkDataEvent.Save event) {
    final Chunk chunk = event.getChunk();
    final int i = this.chunkmap.get(new ChunkLocation(chunk.worldObj.provider.dimensionId, chunk.xPosition, chunk.zPosition));
    if (i != 0) {
        event.getData().setInteger("XU_SoulDrain", i);
    }
}
 
开发者ID:sameer,项目名称:ExtraUtilities,代码行数:9,代码来源:SpecialEventCoordinator.java

示例13: chunkSaved

import net.minecraftforge.event.world.ChunkDataEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void chunkSaved(ChunkDataEvent.Save event)
{
    Chunk chunk = event.getChunk();
    NBTTagCompound compound = event.getData();

    compound.setBoolean("terratorial_tag", true);
}
 
开发者ID:DaedalusGame,项目名称:BetterWithAddons,代码行数:9,代码来源:TerratorialHandler.java

示例14: onChunkDataSave

import net.minecraftforge.event.world.ChunkDataEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void onChunkDataSave(ChunkDataEvent.Save event)
{
    for(WorldExtension extension : worldMap.get(event.world))
        extension.saveChunkData(event.getChunk(), event.getData());
    
    if(!event.getChunk().isChunkLoaded)
        removeChunk(event.world, event.getChunk());
}
 
开发者ID:4Space,项目名称:4Space-5,代码行数:10,代码来源:WorldExtensionManager.java

示例15: handleChunkSaveEvent

import net.minecraftforge.event.world.ChunkDataEvent; //导入方法依赖的package包/类
@SubscribeEvent
 public void handleChunkSaveEvent(ChunkDataEvent.Save event) {
 	if(areAnyRetroGensEnabled()){
  	NBTTagCompound nbt = new NBTTagCompound();
event.getData().setTag(NBT_RETRO, nbt);
nbt.setBoolean(Config.retrogenID, true);
 	}
 }
 
开发者ID:Alec-WAM,项目名称:CrystalMod,代码行数:9,代码来源:CrystalModWorldGenerator.java


注:本文中的net.minecraftforge.event.world.ChunkDataEvent.Save方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。