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


Java ChunkProviderServer类代码示例

本文整理汇总了Java中net.minecraft.world.gen.ChunkProviderServer的典型用法代码示例。如果您正苦于以下问题:Java ChunkProviderServer类的具体用法?Java ChunkProviderServer怎么用?Java ChunkProviderServer使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: logLoadOnRequest

import net.minecraft.world.gen.ChunkProviderServer; //导入依赖的package包/类
private static void logLoadOnRequest(ChunkProviderServer provider, int x, int z)
{
    long currentTick = MinecraftServer.getServer().getTickCounter();
    long lastAccessed = provider.lastAccessed(x, z);
    long diff = currentTick - lastAccessed;
    logInfo(" Last accessed: {0, number} Current Tick: {1, number} [{2, number}]", lastAccessed, currentTick, diff);
    logInfo(" Finding Spawn Point: {0}", provider.worldObj.findingSpawnPoint);
    logInfo(" Load chunk on request: {0}", provider.loadChunkOnProvideRequest);
    logInfo(" Calling Forge Tick: {0}", MinecraftServer.callingForgeTick);
    logInfo(" Load chunk on forge tick: {0}", MinecraftServer.cauldronConfig.loadChunkOnForgeTick.getValue());
    long providerTickDiff = currentTick - provider.initialTick;
    if (providerTickDiff <= 100)
    {
        logInfo(" Current Tick - Initial Tick: {0, number}", providerTickDiff);
    }
}
 
开发者ID:UraniumMC,项目名称:Uranium,代码行数:17,代码来源:CauldronHooks.java

示例2: unloadChunk

import net.minecraft.world.gen.ChunkProviderServer; //导入依赖的package包/类
public boolean unloadChunk(ItemStack stack) {
	if (!stack.hasTagCompound()) return false;
	NBTTagCompound tag = stack.getTagCompound();
	if (tag.getBoolean("ignoreClick")) {
		tag.removeTag("ignoreClick");
		stack.setTagCompound(tag);
		return false;
	}
	
	int worldId = tag.getInteger("world");
	int x = tag.getInteger("x");
	int z = tag.getInteger("z");
	World world = DimensionManager.getWorld(worldId);
	if (world==null) return false;
	
	IChunkProvider provider = world.getChunkProvider();
	Chunk chunk = provider.getLoadedChunk(x, z);
	if (chunk==null) return false;
	if (provider instanceof ChunkProviderServer) {
		((ChunkProviderServer) provider).queueUnload(chunk);
		return true;
	} else {
		return false;
	}
}
 
开发者ID:elytra,项目名称:Thermionics,代码行数:26,代码来源:ItemChunkUnloader.java

示例3: queueChunkLoad

import net.minecraft.world.gen.ChunkProviderServer; //导入依赖的package包/类
public static void queueChunkLoad(World world, AnvilChunkLoader loader, ChunkProviderServer provider, int x, int z, Runnable runnable)
{
    QueuedChunk key = new QueuedChunk(x, z, world);
    ChunkIOProvider task = tasks.get(key);
    if (task == null)
    {
        task = new ChunkIOProvider(key, loader, provider);
        task.addCallback(runnable); // Add before calling execute for thread safety
        tasks.put(key, task);
        pool.execute(task);
    }
    else
    {
        task.addCallback(runnable);
    }
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:17,代码来源:ChunkIOExecutor.java

示例4: invalidate

import net.minecraft.world.gen.ChunkProviderServer; //导入依赖的package包/类
@Override
public void invalidate()
{
    super.invalidate();
    if (this.reference != null)
    {
        ChunkProviderServer provider = this.reference.getChunkProvider();
        int sX = this.getStart().getX() / 16 - GEN_RANGE;
        int sZ = this.getStart().getZ() / 16 - GEN_RANGE;
        int eX = this.getEnd().getX() / 16 + GEN_RANGE;
        int eZ = this.getEnd().getZ() / 16 + GEN_RANGE;
        for (int x = sX; x <= eX; x++)
            for (int z = sZ; z <= eZ; z++)
                if (provider.chunkExists(x, z))
                    provider.unload(provider.getLoadedChunk(x, z));
    }
}
 
开发者ID:LexManos,项目名称:VoidUtils,代码行数:18,代码来源:TileEntityQuarry.java

示例5: loadChunks

import net.minecraft.world.gen.ChunkProviderServer; //导入依赖的package包/类
public void loadChunks()
{
    if (this.worldObj.isRemote)
        return;

    this.reference = DimensionManager.getWorld(VoidUtils.DIM);
    if (this.reference == null)
    {
        DimensionManager.initDimension(VoidUtils.DIM);
        this.reference = DimensionManager.getWorld(VoidUtils.DIM);
    }

    //We need to load the chunk, and the chunks around it before we start copying, so that the chunk gets decorated.
    ChunkProviderServer provider = this.reference.getChunkProvider();
    int sX = this.getStart().getX() / 16 - GEN_RANGE;
    int sZ = this.getStart().getZ() / 16 - GEN_RANGE;
    int eX = this.getEnd().getX() / 16 + GEN_RANGE;
    int eZ = this.getEnd().getZ() / 16 + GEN_RANGE;
    for (int x = sX; x <= eX; x++)
        for (int z = sZ; z <= eZ; z++)
            provider.loadChunk(x, z);
}
 
开发者ID:LexManos,项目名称:VoidUtils,代码行数:23,代码来源:TileEntityQuarry.java

示例6: loadChunksAround

import net.minecraft.world.gen.ChunkProviderServer; //导入依赖的package包/类
private void loadChunksAround(int x, int z, int i, ChunkProviderServer cp)
{
    cp.loadChunk(x >> 4, z >> 4);
    if ((x + i) >> 4 != x >> 4)
    {
        cp.loadChunk((x + i) >> 4, z >> 4);
        if ((z + i) >> 4 != z >> 4)
        {
            cp.loadChunk(x >> 4, (z + i) >> 4);
            cp.loadChunk((x + i) >> 4, (z + i) >> 4);
        }
    }
    else if ((z + i) >> 4 != z >> 4)
    {
        cp.loadChunk(x >> 4, (z + i) >> 4);
    }
}
 
开发者ID:4Space,项目名称:4Space-5,代码行数:18,代码来源:TeleportTypeAsteroids.java

示例7: providePlayerChunk

import net.minecraft.world.gen.ChunkProviderServer; //导入依赖的package包/类
public boolean providePlayerChunk(boolean canGenerate) {
    if (!this.loading) {
        if (this.providingChunk != null) {
            return true;
        } else {
            ChunkProviderServer chunkProvider = this.blockSystem.getChunkProvider();
            int x = this.chunkPosition.chunkXPos;
            int z = this.chunkPosition.chunkZPos;
            if (canGenerate) {
                this.providingChunk = (BlockSystemChunk) chunkProvider.provideChunk(x, z);
            } else {
                this.providingChunk = (BlockSystemChunk) chunkProvider.loadChunk(x, z);
            }
        }
    }
    return false;
}
 
开发者ID:gegy1000,项目名称:BlockSystems,代码行数:18,代码来源:BlockSystemPlayerTracker.java

示例8: nucleusLoadChunkForce

import net.minecraft.world.gen.ChunkProviderServer; //导入依赖的package包/类
private void nucleusLoadChunkForce(int x, int z) {
    Chunk chunk = this.loadChunkFromFile(x, z);

    if (chunk == null)
    {
        long i = ChunkPos.chunkXZ2Int(x, z);

        try
        {
            chunk = this.chunkGenerator.provideChunk(x, z);
        }
        catch (Throwable throwable)
        {
            CrashReport crashreport = CrashReport.makeCrashReport(throwable, "Exception generating new chunk");
            CrashReportCategory crashreportcategory = crashreport.makeCategory("Chunk to be generated");
            crashreportcategory.addCrashSection("Location", String.format("%d,%d", new Object[] {Integer.valueOf(x), Integer.valueOf(z)}));
            crashreportcategory.addCrashSection("Position hash", Long.valueOf(i));
            crashreportcategory.addCrashSection("Generator", this.chunkGenerator);
            throw new ReportedException(crashreport);
        }
    }

    this.id2ChunkMap.put(ChunkPos.chunkXZ2Int(x, z), chunk);
    chunk.onChunkLoad();
    chunk.populateChunk((ChunkProviderServer)(Object) this, this.chunkGenerator);
}
 
开发者ID:NucleusPowered,项目名称:NucleusMixins,代码行数:27,代码来源:MixinChunkProviderServer.java

示例9: saveChunkData

import net.minecraft.world.gen.ChunkProviderServer; //导入依赖的package包/类
private static void saveChunkData(ChunkProviderServer chunkProviderServer, Chunk chunkIn)
{
    try
    {
        chunkIn.setLastSaveTime(chunkIn.getWorld().getTotalWorldTime());
        chunkProviderServer.chunkLoader.saveChunk(chunkIn.getWorld(), chunkIn);
    }
    catch (IOException ioexception)
    {
        //LOGGER.error((String)"Couldn\'t save chunk", (Throwable)ioexception);
    }
    catch (MinecraftException minecraftexception)
    {
        //LOGGER.error((String)"Couldn\'t save chunk; already in use by another instance of Minecraft?", (Throwable)minecraftexception);
    }
    try
    {
        chunkProviderServer.chunkLoader.saveExtraChunkData(chunkIn.getWorld(), chunkIn);
    }
    catch (Exception exception)
    {
        //LOGGER.error((String)"Couldn\'t save entities", (Throwable)exception);
    }
}
 
开发者ID:MinecraftPortCentral,项目名称:GriefPrevention,代码行数:25,代码来源:BlockUtils.java

示例10: populate

import net.minecraft.world.gen.ChunkProviderServer; //导入依赖的package包/类
@Override
public void populate(IChunkProvider chunkprovider, int chunkX, int chunkZ) {
	checkUnpopulatedQueue(chunkprovider);
	
	if (chunkprovider instanceof ChunkProviderServer) {
		// Don't populate if not all direct neighbours have been populated
		// Instead put on queue
		if(!shouldPopulate((ChunkProviderServer)chunkprovider, chunkX, chunkZ)) {
			synchronized (VCraftWorld.instance.unpopulatedChunks) {
				VCraftWorld.instance.unpopulatedChunks.add(new BlockPos(chunkX, 0, chunkZ));	
			}
			
			VCraftWorld.instance.setChunkNBT(chunkX, chunkZ, "vcraftpopulated", false);	
			return;
		}

		populateNow(chunkprovider, chunkX, chunkZ);
	}
}
 
开发者ID:tyronx,项目名称:vintagecraft,代码行数:20,代码来源:ChunkProviderGenerateVC.java

示例11: findNearestStructure

import net.minecraft.world.gen.ChunkProviderServer; //导入依赖的package包/类
@Override
public Coord findNearestStructure(VanillaStructure type, Coord pos) {
	
	ChunkProviderServer chunkProvider = ((WorldServer)world).getChunkProvider();
	String structureName = VanillaStructure.getName(type);
	
	BlockPos structurebp = null;
	
	try{
		structurebp = chunkProvider.getNearestStructurePos(world, structureName, pos.getBlockPos(), false);	
	} catch(NullPointerException e){
		// happens for some reason if structure type is disabled in Chunk Generator Settings
	}
	
	if(structurebp == null) return null;
	
	return new Coord(structurebp);		
}
 
开发者ID:Greymerk,项目名称:minecraft-roguelike,代码行数:19,代码来源:WorldEditor.java

示例12: logChunkLoad

import net.minecraft.world.gen.ChunkProviderServer; //导入依赖的package包/类
public static void logChunkLoad(ChunkProviderServer provider, String msg, int x, int z, boolean logLoadOnRequest)
{
    if (MinecraftServer.cauldronConfig.chunkLoadLogging.getValue())
    {
        logInfo("{0} Chunk At [{1}] ({2}, {3})", msg, provider.worldObj.provider.dimensionId, x, z);
        if (logLoadOnRequest)
        {
            logLoadOnRequest(provider, x, z);
        }
        logStack();
    }
}
 
开发者ID:UraniumMC,项目名称:Uranium,代码行数:13,代码来源:CauldronHooks.java

示例13: logChunkUnload

import net.minecraft.world.gen.ChunkProviderServer; //导入依赖的package包/类
public static void logChunkUnload(ChunkProviderServer provider, int x, int z, String msg)
{
    if (MinecraftServer.cauldronConfig.chunkUnloadLogging.getValue())
    {
        logInfo("{0} [{1}] ({2}, {3})", msg, provider.worldObj.provider.dimensionId, x, z);
        long currentTick = MinecraftServer.getServer().getTickCounter();
        long lastAccessed = provider.lastAccessed(x, z);
        long diff = currentTick - lastAccessed;
        logInfo(" Last accessed: {0, number} Current Tick: {1, number} [{2, number}]", lastAccessed, currentTick, diff);
    }
}
 
开发者ID:UraniumMC,项目名称:Uranium,代码行数:12,代码来源:CauldronHooks.java

示例14: createChunkProvider

import net.minecraft.world.gen.ChunkProviderServer; //导入依赖的package包/类
/**
 * Creates the chunk provider for this world. Called in the constructor. Retrieves provider from worldProvider?
 */
protected IChunkProvider createChunkProvider()
{
    IChunkLoader ichunkloader = this.saveHandler.getChunkLoader(this.provider);
    this.theChunkProviderServer = new ChunkProviderServer(this, ichunkloader, this.provider.createChunkGenerator());
    return this.theChunkProviderServer;
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:10,代码来源:WorldServer.java

示例15: getChunkProvider

import net.minecraft.world.gen.ChunkProviderServer; //导入依赖的package包/类
@Override
public ChunkProviderServer getChunkProvider() {
	if (m_proxyWorld != null && Util.isPrefixInCallStack(m_modPrefix)) {
		return m_proxyWorld.getChunkProvider();
	} else if (m_realWorld != null) {
		return m_realWorld.getChunkProvider();
	} else {
		return super.getChunkProvider();
	}
}
 
开发者ID:orbwoi,项目名称:UniversalRemote,代码行数:11,代码来源:WorldServerProxy.java


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