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


Java ChunkDataEvent.Load方法代码示例

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


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

示例1: onChunkLoad

import net.minecraftforge.event.world.ChunkDataEvent; //导入方法依赖的package包/类
@SubscribeEvent
public static void onChunkLoad(ChunkDataEvent.Load event)
{
	World world = event.getWorld();
	ChunkPos chunkPos = event.getChunk().getPos();
	
	IChunkLevelHolder chunkLevelHolder = getChunkLevelHolder(world);
	ChunkLevel chunkLevel = new ChunkLevel(world, chunkPos, getAreaLevel(world, chunkPos));
	
	NBTTagCompound nbt = event.getData();
	
	if (nbt.hasKey(ID.toString(), Constants.NBT.TAG_INT))
	{
		NBTTagInt levelTag = (NBTTagInt) nbt.getTag(ID.toString());
		chunkLevel.deserializeNBT(levelTag);
	}
	
	chunkLevelHolder.setChunkLevel(null, chunkLevel);
}
 
开发者ID:TheXFactor117,项目名称:Loot-Slash-Conquer,代码行数:20,代码来源:CapabilityChunkLevel.java

示例2: onChunkLoad

import net.minecraftforge.event.world.ChunkDataEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void onChunkLoad(ChunkDataEvent.Load event) {
    try {
        if (!event.getWorld().isRemote) {
            if (event.getData().hasKey("SemiBlocks")) {
                Map<BlockPos, List<ISemiBlock>> map = getOrCreateMap(event.getChunk());
                map.clear();
                NBTTagList tagList = event.getData().getTagList("SemiBlocks", 10);
                for (int i = 0; i < tagList.tagCount(); i++) {
                    NBTTagCompound t = tagList.getCompoundTagAt(i);
                    ISemiBlock semiBlock = getSemiBlockForKey(t.getString("type"));
                    if (semiBlock != null) {
                        semiBlock.readFromNBT(t);
                        addSemiBlock(event.getWorld(), NBTUtil.getPos(t), semiBlock, event.getChunk());
                    }
                }
            }
        }
    } catch (Throwable e) {
        e.printStackTrace();
    }
}
 
开发者ID:TeamPneumatic,项目名称:pnc-repressurized,代码行数:23,代码来源:SemiBlockManager.java

示例3: onChunkLoad

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

		StabilityData stability;
		if (event.getData().hasKey(STABILITY_KEY, 10)) {
			stability = new StabilityData(event.getData().getCompoundTag(STABILITY_KEY));
		} else {
			stability = generateChunkStability(event.getWorld().rand);
		}

		addChunkData(dim, pos, stability);
	}
}
 
开发者ID:the-realest-stu,项目名称:Etheric,代码行数:17,代码来源:StabilityHandler.java

示例4: chunkLoaded

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

    if(!compound.hasKey("terratorial_tag"))
    {
        Random rand = chunk.getRandomWithSeed(chunk.getWorld().getSeed());
        if(rand.nextInt(100) < 4)
        {
            
        }

        chunk.setChunkModified();
    }
}
 
开发者ID:DaedalusGame,项目名称:BetterWithAddons,代码行数:18,代码来源:TerratorialHandler.java

示例5: loadChunk

import net.minecraftforge.event.world.ChunkDataEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void loadChunk(ChunkDataEvent.Load event) {
    Chunk chunk = event.getChunk();
    FlatChunkLayer layer = ((IExtraChunkData) chunk).getFlatLayer();
    NBTTagCompound chunkData = event.getData();
    if (!chunkData.hasKey(NBT_KEY)) return;
    NBTTagList list = chunkData.getTagList(NBT_KEY, Constants.NBT.TAG_COMPOUND);
    if (list == null || list.hasNoTags()) return;
    Coord at = new Coord(chunk.getWorld(), 0, 0, 0);
    int tagEnd = list.tagCount();
    for (int i = 0; i < tagEnd; i++) {
        NBTTagCompound tag = (NBTTagCompound) list.get(i);
        at.x = tag.getInteger("x");
        at.y = tag.getInteger("y");
        at.z = tag.getInteger("z");
        byte faceOrdinal = tag.getByte("side");
        EnumFacing face = EnumFacing.VALUES[faceOrdinal];
        FlatFace flat = construct(tag);
        if (flat != null) {
            layer.set(at, face, flat, FlatChunkLayer.FLAGS_SEAMLESS);
        }
    }
}
 
开发者ID:purpleposeidon,项目名称:Factorization,代码行数:24,代码来源:FlatMod.java

示例6: enqueueRetrogen

import net.minecraftforge.event.world.ChunkDataEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void enqueueRetrogen(ChunkDataEvent.Load event) {
    // See also: http://minecraft.curseforge.com/projects/simpleretrogen
    if (!FzConfig.enable_retrogen) {
        return;
    }
    final NBTTagCompound data = event.getData();

    final String oldKey = data.getString("fzRetro");
    if (FzConfig.retrogen_key.equals(oldKey)) {
        return;
    }
    if (event.getChunk().getWorld().isRemote) return;
    if (retrogen_active.get() == Boolean.TRUE) {
        recursively_loaded.add(event.getChunk());
        return;
    }
    if (FzConfig.retrogen_copper_geyser || FzConfig.retrogen_dark_iron) {
        retrogenQueue.add(event.getChunk());
    }
}
 
开发者ID:purpleposeidon,项目名称:Factorization,代码行数:22,代码来源:WorldgenManager.java

示例7: onChunkDataLoad

import net.minecraftforge.event.world.ChunkDataEvent; //导入方法依赖的package包/类
@SubscribeEvent
public synchronized void onChunkDataLoad(ChunkDataEvent.Load event)
{
	if(!event.world.isRemote)
	{
		if(general.enableWorldRegeneration)
		{
			NBTTagCompound loadData = event.getData();
			
			if(loadData.getInteger("MekanismWorldGen") == baseWorldGenVersion && loadData.getInteger("MekanismUserWorldGen") == general.userWorldGenVersion)
			{
				return;
			}

			ChunkCoordIntPair coordPair = event.getChunk().getChunkCoordIntPair();
			worldTickHandler.addRegenChunk(event.world.provider.dimensionId, coordPair);
		}
	}
}
 
开发者ID:Microsoft,项目名称:vsminecraft,代码行数:20,代码来源:Mekanism.java

示例8: onDataLoad

import net.minecraftforge.event.world.ChunkDataEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void onDataLoad(ChunkDataEvent.Load event)
{
	if(!event.world.isRemote)
	{
		NBTTagCompound eventTag = event.getData();
		
		if(eventTag.hasKey("CWTFCData"))
		{
			NBTTagCompound CWTFCData = eventTag.getCompoundTag("CWTFCData");
			if(CWTFC_Core.getCDM(event.world) != null)
				CWTFC_Core.getCDM(event.world).addData(event.getChunk(), new ChunkData(CWTFCData));
		}
		else
		{
			if(CWTFC_Core.getCDM(event.world) != null)
				CWTFC_Core.getCDM(event.world).addData(event.getChunk(), new ChunkData());
		}
	}
}
 
开发者ID:StrayWolfe,项目名称:Cooking-with-TFC,代码行数:21,代码来源:ChunkHandler.java

示例9: chunkLoad

import net.minecraftforge.event.world.ChunkDataEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void chunkLoad(ChunkDataEvent.Load event)
{
    int dim = event.world.provider.dimensionId;

    ChunkCoordIntPair loc = event.getChunk().getChunkCoordIntPair();

    if (!event.getData().getCompoundTag(this.getModTag()).hasKey(ConfigHandler.regenKey()) && ConfigHandler.regen())
    {
        LogHandler.log("Worlg gen was never run for chunk at " + loc);

        ArrayList<ChunkLoc> chunks = WorldTicker.chunksToGenerate.get(dim);

        if (chunks == null)
        {
            WorldTicker.chunksToGenerate.put(dim, new ArrayList<ChunkLoc>());
            chunks = WorldTicker.chunksToGenerate.get(dim);
        }

        if (chunks != null)
        {
            chunks.add(new ChunkLoc(loc.chunkXPos, loc.chunkZPos));
            WorldTicker.chunksToGenerate.put(dim, chunks);
        }
    }
}
 
开发者ID:TeamMetallurgy,项目名称:MetallurgyCore,代码行数:27,代码来源:EventHandler.java

示例10: onChunkLoad

import net.minecraftforge.event.world.ChunkDataEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void onChunkLoad(ChunkDataEvent.Load event){
    try {
        if(!event.world.isRemote) {
            if(event.getData().hasKey("SemiBlocks")) {
                Map<ChunkPosition, ISemiBlock> map = getOrCreateMap(event.getChunk());
                map.clear();
                NBTTagList tagList = event.getData().getTagList("SemiBlocks", 10);
                for(int i = 0; i < tagList.tagCount(); i++) {
                    NBTTagCompound t = tagList.getCompoundTagAt(i);
                    ISemiBlock semiBlock = getSemiBlockForKey(t.getString("type"));
                    if(semiBlock != null) {
                        semiBlock.readFromNBT(t);
                        setSemiBlock(event.world, t.getInteger("x"), t.getInteger("y"), t.getInteger("z"), semiBlock, event.getChunk());
                    }
                }
            }
        }
    } catch(Throwable e) {
        e.printStackTrace();
    }
}
 
开发者ID:MineMaarten,项目名称:PneumaticCraft,代码行数:23,代码来源:SemiBlockManager.java

示例11: onChunkDataLoad

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

示例12: onChunkLoad

import net.minecraftforge.event.world.ChunkDataEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void onChunkLoad(ChunkDataEvent.Load event) {
	if (event.getData().hasKey("PlayerInChunk")) {
		ChunkListOfPlayers chunk = new ChunkListOfPlayers(event.getChunk());
		AllChunks.addChunk(chunk);
		chunk.readFromNBT(event.getData().getTagList("PlayerInChunk", Constants.NBT.TAG_COMPOUND));
	}
}
 
开发者ID:coehlrich,项目名称:chunk-logger,代码行数:9,代码来源:EventHandlerCommon.java

示例13: loadData

import net.minecraftforge.event.world.ChunkDataEvent; //导入方法依赖的package包/类
public void loadData(final ChunkDataEvent.Load event) {
    if (ExtraUtils.enderLilyRetrogenId > 0 && event.world.provider.dimensionId == 1 && event.world instanceof WorldServer && event.getData().getInteger(WorldGenEnderLillies.retrogen) != ExtraUtils.enderLilyRetrogenId) {
        final long worldSeed = event.world.getSeed();
        final Random random = new Random(worldSeed);
        final long xSeed = random.nextLong() >> 3;
        final long zSeed = random.nextLong() >> 3;
        final long chunkSeed = xSeed * event.getChunk().xPosition + zSeed * event.getChunk().zPosition ^ worldSeed;
        random.setSeed(chunkSeed);
        gen(random, event.getChunk());
    }
}
 
开发者ID:sameer,项目名称:ExtraUtilities,代码行数:12,代码来源:WorldGenEnderLillies.java

示例14: getChunkData

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

示例15: onChunkDataLoad

import net.minecraftforge.event.world.ChunkDataEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void onChunkDataLoad(ChunkDataEvent.Load event)
{
    if(!worldMap.containsKey(event.world))
        WorldExtensionManager.onWorldLoad(event.world);
    
    createChunkExtension(event.world, event.getChunk());

    for(WorldExtension extension : worldMap.get(event.world))
        extension.loadChunkData(event.getChunk(), event.getData());
}
 
开发者ID:4Space,项目名称:4Space-5,代码行数:12,代码来源:WorldExtensionManager.java


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