Java Code Examples for net.minecraft.world.chunk.Chunk#setLastSaveTime()

The following examples show how to use net.minecraft.world.chunk.Chunk#setLastSaveTime() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ChunkIOProvider.java    From Kettle with GNU General Public License v3.0 6 votes vote down vote up
public void callStage2(QueuedChunk queuedChunk, Chunk chunk) throws RuntimeException {
    if (chunk == null) {
        // If the chunk loading failed just do it synchronously (may generate)
        queuedChunk.provider.provideChunk(queuedChunk.x, queuedChunk.z);
        return;
    }

    queuedChunk.loader.loadEntities(queuedChunk.world, queuedChunk.compound.getCompoundTag("Level"), chunk);
    chunk.setLastSaveTime(queuedChunk.provider.world.getTotalWorldTime());
    queuedChunk.provider.id2ChunkMap.put(ChunkPos.asLong(queuedChunk.x, queuedChunk.z), chunk);
    chunk.onLoad();

    if (queuedChunk.provider.chunkGenerator != null) {
        queuedChunk.provider.chunkGenerator.recreateStructures(chunk, queuedChunk.x, queuedChunk.z);
    }

    chunk.populateCB(queuedChunk.provider, queuedChunk.provider.chunkGenerator, false);
}
 
Example 2
Source File: BlockUtils.java    From GriefPrevention with MIT License 6 votes vote down vote up
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);
    }
}