• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java Chunk类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: callStage1

import net.minecraft.server.Chunk; //导入依赖的package包/类
public Chunk callStage1(QueuedChunk queuedChunk) throws RuntimeException {
    ChunkRegionLoader loader = queuedChunk.loader;
    Object[] data = loader.loadChunk(queuedChunk.world, queuedChunk.x, queuedChunk.z);

    if (data != null) {
        queuedChunk.compound = (NBTTagCompound) data[1];
        return (Chunk) data[0];
    }

    return null;
}
 
开发者ID:OvercastNetwork,项目名称:CraftBukkit,代码行数:12,代码来源:ChunkIOProvider.java


示例2: callStage2

import net.minecraft.server.Chunk; //导入依赖的package包/类
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.originalGetChunkAt(queuedChunk.x, queuedChunk.z);
        return;
    }

    queuedChunk.loader.loadEntities(chunk, queuedChunk.compound.getCompound("Level"), queuedChunk.world);
    chunk.lastSaved = queuedChunk.provider.world.getTime();
    queuedChunk.provider.chunks.put(LongHash.toLong(queuedChunk.x, queuedChunk.z), chunk);
    chunk.addEntities();

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

    Server server = queuedChunk.provider.world.getServer();
    if (server != null) {
        server.getPluginManager().callEvent(new org.bukkit.event.world.ChunkLoadEvent(chunk.bukkitChunk, false));
    }

    // Update neighbor counts
    for (int x = -2; x < 3; x++) {
        for (int z = -2; z < 3; z++) {
            if (x == 0 && z == 0) {
                continue;
            }

            Chunk neighbor = queuedChunk.provider.getChunkIfLoaded(chunk.locX + x, chunk.locZ + z);
            if (neighbor != null) {
                neighbor.setNeighborLoaded(-x, -z);
                chunk.setNeighborLoaded(x, z);
            }
        }
    }

    chunk.loadNearby(queuedChunk.provider, queuedChunk.provider, queuedChunk.x, queuedChunk.z);
}
 
开发者ID:OvercastNetwork,项目名称:CraftBukkit,代码行数:39,代码来源:ChunkIOProvider.java


示例3: callStage1

import net.minecraft.server.Chunk; //导入依赖的package包/类
public Chunk callStage1(QueuedChunk queuedChunk) throws RuntimeException {
    try {
        ChunkRegionLoader loader = queuedChunk.loader;
        Object[] data = loader.loadChunk(queuedChunk.world, queuedChunk.x, queuedChunk.z);
        
        if (data != null) {
            queuedChunk.compound = (NBTTagCompound) data[1];
            return (Chunk) data[0];
        }

        return null;
    } catch (IOException ex) {
        throw new RuntimeException(ex);
    }
}
 
开发者ID:tgnmc,项目名称:Craftbukkit,代码行数:16,代码来源:ChunkIOProvider.java


示例4: callStage2

import net.minecraft.server.Chunk; //导入依赖的package包/类
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.originalGetChunkAt(queuedChunk.x, queuedChunk.z);
        return;
    }

    queuedChunk.loader.loadEntities(chunk, queuedChunk.compound.getCompound("Level"), queuedChunk.world);
    chunk.setLastSaved(queuedChunk.provider.world.getTime());
    queuedChunk.provider.chunks.put(LongHash.toLong(queuedChunk.x, queuedChunk.z), chunk);
    chunk.addEntities();

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

    Server server = queuedChunk.provider.world.getServer();
    if (server != null) {
        server.getPluginManager().callEvent(new org.bukkit.event.world.ChunkLoadEvent(chunk.bukkitChunk, false));
    }

    // Update neighbor counts
    for (int x = -2; x < 3; x++) {
        for (int z = -2; z < 3; z++) {
            if (x == 0 && z == 0) {
                continue;
            }

            Chunk neighbor = queuedChunk.provider.getChunkIfLoaded(chunk.locX + x, chunk.locZ + z);
            if (neighbor != null) {
                neighbor.setNeighborLoaded(-x, -z);
                chunk.setNeighborLoaded(x, z);
            }
        }
    }

    chunk.loadNearby(queuedChunk.provider, queuedChunk.provider, queuedChunk.x, queuedChunk.z);
}
 
开发者ID:tgnmc,项目名称:Craftbukkit,代码行数:39,代码来源:ChunkIOProvider.java


示例5: callStage1

import net.minecraft.server.Chunk; //导入依赖的package包/类
public Chunk callStage1(QueuedChunk queuedChunk) throws RuntimeException {
    ChunkRegionLoader loader = queuedChunk.loader;
    Object[] data = loader.loadChunk(queuedChunk.world, LongHash.msw(queuedChunk.coords), LongHash.lsw(queuedChunk.coords));

    if (data != null) {
        queuedChunk.compound = (NBTTagCompound) data[1];
        return (Chunk) data[0];
    }

    return null;
}
 
开发者ID:AlmuraDev,项目名称:Almura-Server,代码行数:12,代码来源:ChunkIOProvider.java


示例6: callStage2

import net.minecraft.server.Chunk; //导入依赖的package包/类
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.getChunkAt(LongHash.msw(queuedChunk.coords), LongHash.lsw(queuedChunk.coords));
        return;
    }

    int x = LongHash.msw(queuedChunk.coords);
    int z = LongHash.lsw(queuedChunk.coords);

    // See if someone already loaded this chunk while we were working on it (API, etc)
    if (queuedChunk.provider.chunks.containsKey(queuedChunk.coords)) {
        // Make sure it isn't queued for unload, we need it
        queuedChunk.provider.unloadQueue.remove(queuedChunk.coords);
        return;
    }

    queuedChunk.loader.loadEntities(chunk, queuedChunk.compound.getCompound("Level"), queuedChunk.world);
    chunk.n = queuedChunk.provider.world.getTime();
    queuedChunk.provider.chunks.put(queuedChunk.coords, chunk);
    chunk.addEntities();

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

    Server server = queuedChunk.provider.world.getServer();
    if (server != null) {
        server.getPluginManager().callEvent(new org.bukkit.event.world.ChunkLoadEvent(chunk.bukkitChunk, false));
    }

    chunk.a(queuedChunk.provider, queuedChunk.provider, x, z);
}
 
开发者ID:AlmuraDev,项目名称:Almura-Server,代码行数:34,代码来源:ChunkIOProvider.java


示例7: activateChunkEntities

import net.minecraft.server.Chunk; //导入依赖的package包/类
/**
 * Checks for the activation state of all entities in this chunk.
 *
 * @param chunk
 */
private static void activateChunkEntities(Chunk chunk)
{
    for ( List<Entity> slice : chunk.entitySlices )
    {
        for ( Entity entity : slice )
        {
            if ( MinecraftServer.currentTick > entity.activatedTick )
            {
                if ( entity.defaultActivationState )
                {
                    entity.activatedTick = MinecraftServer.currentTick;
                    continue;
                }
                switch ( entity.activationType )
                {
                    case 1:
                        if ( monsterBB.b( entity.boundingBox ) )
                        {
                            entity.activatedTick = MinecraftServer.currentTick;
                        }
                        break;
                    case 2:
                        if ( animalBB.b( entity.boundingBox ) )
                        {
                            entity.activatedTick = MinecraftServer.currentTick;
                        }
                        break;
                    case 3:
                    default:
                        if ( miscBB.b( entity.boundingBox ) )
                        {
                            entity.activatedTick = MinecraftServer.currentTick;
                        }
                }
            }
        }
    }
}
 
开发者ID:AlmuraDev,项目名称:Almura-Server,代码行数:44,代码来源:ActivationRange.java


示例8: callStage2

import net.minecraft.server.Chunk; //导入依赖的package包/类
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.originalGetChunkAt(queuedChunk.x, queuedChunk.z);
        return;
    }

    queuedChunk.loader.loadEntities(chunk, queuedChunk.compound.getCompound("Level"), queuedChunk.world);
    chunk.lastSaved = queuedChunk.provider.world.getTime();
    queuedChunk.provider.chunks.put(LongHash.toLong(queuedChunk.x, queuedChunk.z), chunk);
    chunk.addEntities();

    if (queuedChunk.provider.chunkProvider != null) {
        queuedChunk.provider.world.timings.syncChunkLoadStructuresTimer.startTiming(); // Spigot
        queuedChunk.provider.chunkProvider.recreateStructures(queuedChunk.x, queuedChunk.z);
        queuedChunk.provider.world.timings.syncChunkLoadStructuresTimer.stopTiming(); // Spigot
    }

    Server server = queuedChunk.provider.world.getServer();
    if (server != null) {
        server.getPluginManager().callEvent(new org.bukkit.event.world.ChunkLoadEvent(chunk.bukkitChunk, false));
    }

    // Update neighbor counts
    for (int x = -2; x < 3; x++) {
        for (int z = -2; z < 3; z++) {
            if (x == 0 && z == 0) {
                continue;
            }

            Chunk neighbor = queuedChunk.provider.getChunkIfLoaded(chunk.locX + x, chunk.locZ + z);
            if (neighbor != null) {
                neighbor.setNeighborLoaded(-x, -z);
                chunk.setNeighborLoaded(x, z);
            }
        }
    }

    chunk.loadNearby(queuedChunk.provider, queuedChunk.provider, queuedChunk.x, queuedChunk.z);
}
 
开发者ID:pvginkel,项目名称:Tweakkit-Server,代码行数:41,代码来源:ChunkIOProvider.java


示例9: checkIfActive

import net.minecraft.server.Chunk; //导入依赖的package包/类
/**
 * Checks if the entity is active for this tick.
 *
 * @param entity
 * @return
 */
public static boolean checkIfActive(Entity entity)
{
    SpigotTimings.checkIfActiveTimer.startTiming();
    boolean isActive = entity.activatedTick >= MinecraftServer.currentTick || entity.defaultActivationState;

    // Should this entity tick?
    if ( !isActive )
    {
        if ( ( MinecraftServer.currentTick - entity.activatedTick - 1 ) % 20 == 0 )
        {
            // Check immunities every 20 ticks.
            if ( checkEntityImmunities( entity ) )
            {
                // Triggered some sort of immunity, give 20 full ticks before we check again.
                entity.activatedTick = MinecraftServer.currentTick + 20;
            }
            isActive = true;
        }
        // Add a little performance juice to active entities. Skip 1/4 if not immune.
    } else if ( !entity.defaultActivationState && entity.ticksLived % 4 == 0 && !checkEntityImmunities( entity ) )
    {
        isActive = false;
    }
    int x = MathHelper.floor( entity.locX );
    int z = MathHelper.floor( entity.locZ );
    // Make sure not on edge of unloaded chunk
    Chunk chunk = entity.world.getChunkIfLoaded( x >> 4, z >> 4 );
    if ( isActive && !( chunk != null && chunk.areNeighborsLoaded( 1 ) ) )
    {
        isActive = false;
    }
    SpigotTimings.checkIfActiveTimer.stopTiming();
    return isActive;
}
 
开发者ID:pvginkel,项目名称:Tweakkit-Server,代码行数:41,代码来源:ActivationRange.java


示例10: callStage2

import net.minecraft.server.Chunk; //导入依赖的package包/类
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.originalGetChunkAt(queuedChunk.x, queuedChunk.z);
        return;
    }

    queuedChunk.loader.loadEntities(chunk, queuedChunk.compound.getCompound("Level"), queuedChunk.world);
    chunk.setLastSaved(queuedChunk.provider.world.getTime());
    queuedChunk.provider.chunks.put(ChunkCoordIntPair.a(queuedChunk.x, queuedChunk.z), chunk);
    chunk.addEntities();

    if (queuedChunk.provider.chunkGenerator != null) {
        queuedChunk.provider.world.timings.syncChunkLoadStructuresTimer.startTiming(); // Spigot
        queuedChunk.provider.chunkGenerator.recreateStructures(chunk, queuedChunk.x, queuedChunk.z);
        queuedChunk.provider.world.timings.syncChunkLoadStructuresTimer.stopTiming(); // Spigot
    }

    Server server = queuedChunk.provider.world.getServer();
    if (server != null) {
        server.getPluginManager().callEvent(new org.bukkit.event.world.ChunkLoadEvent(chunk.bukkitChunk, false));
    }

    // Update neighbor counts
    for (int x = -2; x < 3; x++) {
        for (int z = -2; z < 3; z++) {
            if (x == 0 && z == 0) {
                continue;
            }

            Chunk neighbor = queuedChunk.provider.getLoadedChunkAt(chunk.locX + x, chunk.locZ + z);
            if (neighbor != null) {
                neighbor.setNeighborLoaded(-x, -z);
                chunk.setNeighborLoaded(x, z);
            }
        }
    }

    chunk.loadNearby(queuedChunk.provider, queuedChunk.provider.chunkGenerator);
}
 
开发者ID:bergerkiller,项目名称:SpigotSource,代码行数:41,代码来源:ChunkIOProvider.java


示例11: activateChunkEntities

import net.minecraft.server.Chunk; //导入依赖的package包/类
/**
 * Checks for the activation state of all entities in this chunk.
 *
 * @param chunk
 */
private static void activateChunkEntities(Chunk chunk)
{
    for ( List<Entity> slice : chunk.entitySlices )
    {
        for ( Entity entity : slice )
        {
            if ( MinecraftServer.currentTick > entity.activatedTick )
            {
                if ( entity.defaultActivationState )
                {
                    entity.activatedTick = MinecraftServer.currentTick;
                    continue;
                }
                switch ( entity.activationType )
                {
                    case 1:
                        if ( monsterBB.b( entity.getBoundingBox() ) )
                        {
                            entity.activatedTick = MinecraftServer.currentTick;
                        }
                        break;
                    case 2:
                        if ( animalBB.b( entity.getBoundingBox() ) )
                        {
                            entity.activatedTick = MinecraftServer.currentTick;
                        }
                        break;
                    case 3:
                    default:
                        if ( miscBB.b( entity.getBoundingBox() ) )
                        {
                            entity.activatedTick = MinecraftServer.currentTick;
                        }
                }
            }
        }
    }
}
 
开发者ID:bergerkiller,项目名称:SpigotSource,代码行数:44,代码来源:ActivationRange.java


示例12: getOrCreateChunk

import net.minecraft.server.Chunk; //导入依赖的package包/类
public Chunk getOrCreateChunk(int i, int i1) {
    return provider.getOrCreateChunk(i, i1);
}
 
开发者ID:OvercastNetwork,项目名称:CraftBukkit,代码行数:4,代码来源:NormalChunkGenerator.java


示例13: getChunkAt

import net.minecraft.server.Chunk; //导入依赖的package包/类
public Chunk getChunkAt(int i, int i1) {
    return provider.getChunkAt(i, i1);
}
 
开发者ID:OvercastNetwork,项目名称:CraftBukkit,代码行数:4,代码来源:NormalChunkGenerator.java


示例14: getChunkAt

import net.minecraft.server.Chunk; //导入依赖的package包/类
public Chunk getChunkAt(int x, int z) {
    return getOrCreateChunk(x, z);
}
 
开发者ID:OvercastNetwork,项目名称:CraftBukkit,代码行数:4,代码来源:CustomChunkGenerator.java


示例15: callStage3

import net.minecraft.server.Chunk; //导入依赖的package包/类
public void callStage3(QueuedChunk queuedChunk, Chunk chunk, Runnable runnable) throws RuntimeException {
    runnable.run();
}
 
开发者ID:OvercastNetwork,项目名称:CraftBukkit,代码行数:4,代码来源:ChunkIOProvider.java


示例16: syncChunkLoad

import net.minecraft.server.Chunk; //导入依赖的package包/类
public static Chunk syncChunkLoad(World world, ChunkRegionLoader loader, ChunkProviderServer provider, int x, int z) {
    return instance.getSkipQueue(new QueuedChunk(x, z, loader, world, provider));
}
 
开发者ID:OvercastNetwork,项目名称:CraftBukkit,代码行数:4,代码来源:ChunkIOExecutor.java


示例17: checkIfActive

import net.minecraft.server.Chunk; //导入依赖的package包/类
/**
 * Checks if the entity is active for this tick.
 *
 * @param entity
 * @return
 */
public static boolean checkIfActive(Entity entity)
{
    SpigotTimings.checkIfActiveTimer.startTiming();
    // Never safe to skip fireworks or entities not yet added to chunk
    // PAIL: inChunk
    if ( !entity.aa || entity instanceof EntityFireworks ) {
        SpigotTimings.checkIfActiveTimer.stopTiming();
        return true;
    }

    boolean isActive = entity.activatedTick >= MinecraftServer.currentTick || entity.defaultActivationState;

    // Should this entity tick?
    if ( !isActive )
    {
        if ( ( MinecraftServer.currentTick - entity.activatedTick - 1 ) % 20 == 0 )
        {
            // Check immunities every 20 ticks.
            if ( checkEntityImmunities( entity ) )
            {
                // Triggered some sort of immunity, give 20 full ticks before we check again.
                entity.activatedTick = MinecraftServer.currentTick + 20;
            }
            isActive = true;
        }
        // Add a little performance juice to active entities. Skip 1/4 if not immune.
    } else if ( !entity.defaultActivationState && entity.ticksLived % 4 == 0 && !checkEntityImmunities( entity ) )
    {
        isActive = false;
    }
    int x = MathHelper.floor( entity.locX );
    int z = MathHelper.floor( entity.locZ );
    // Make sure not on edge of unloaded chunk
    Chunk chunk = entity.world.getChunkIfLoaded( x >> 4, z >> 4 );
    if ( isActive && !( chunk != null && chunk.areNeighborsLoaded( 1 ) ) )
    {
        isActive = false;
    }
    SpigotTimings.checkIfActiveTimer.stopTiming();
    return isActive;
}
 
开发者ID:bergerkiller,项目名称:SpigotSource,代码行数:48,代码来源:ActivationRange.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java CucumberTagStatement类代码示例发布时间:2022-05-23
下一篇:
Java SLDParser类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap