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


Java Chunk类代码示例

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


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

示例1: unloadQueuedChunks

import net.minecraft.world.chunk.Chunk; //导入依赖的package包/类
/**
 * Unloads chunks that are marked to be unloaded. This is not guaranteed to unload every such chunk.
 */
public boolean unloadQueuedChunks()
{
    long i = System.currentTimeMillis();

    for (Chunk chunk : this.chunkMapping.values())
    {
        chunk.onTick(System.currentTimeMillis() - i > 5L);
    }

    if (System.currentTimeMillis() - i > 100L)
    {
        LOGGER.info("Warning: Clientside chunk ticking took {} ms", new Object[] {Long.valueOf(System.currentTimeMillis() - i)});
    }

    return false;
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:20,代码来源:ChunkProviderClient.java

示例2: getTopSolidOrLiquidBlock

import net.minecraft.world.chunk.Chunk; //导入依赖的package包/类
/**
 * Finds the highest block on the x and z coordinate that is solid or liquid, and returns its y coord.
 */
public BlockPos getTopSolidOrLiquidBlock(BlockPos pos)
{
    Chunk chunk = this.getChunkFromBlockCoords(pos);
    BlockPos blockpos;
    BlockPos blockpos1;

    for (blockpos = new BlockPos(pos.getX(), chunk.getTopFilledSegment() + 16, pos.getZ()); blockpos.getY() >= 0; blockpos = blockpos1)
    {
        blockpos1 = blockpos.down();
        Material material = chunk.getBlock(blockpos1).getMaterial();

        if (material.blocksMovement() && material != Material.leaves)
        {
            break;
        }
    }

    return blockpos;
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:23,代码来源:World.java

示例3: isBlockNormalCube

import net.minecraft.world.chunk.Chunk; //导入依赖的package包/类
/**
 * Checks if a block's material is opaque, and that it takes up a full cube
 */
public boolean isBlockNormalCube(BlockPos pos, boolean _default)
{
    if (this.isOutsideBuildHeight(pos))
    {
        return false;
    }
    else
    {
        Chunk chunk = this.chunkProvider.getLoadedChunk(pos.getX() >> 4, pos.getZ() >> 4);

        if (chunk != null && !chunk.isEmpty())
        {
            IBlockState iblockstate = this.getBlockState(pos);
            return iblockstate.getBlock().isNormalCube(iblockstate, this, pos);
        }
        else
        {
            return _default;
        }
    }
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:25,代码来源:World.java

示例4: S26PacketMapChunkBulk

import net.minecraft.world.chunk.Chunk; //导入依赖的package包/类
public S26PacketMapChunkBulk(List<Chunk> chunks)
{
    int i = chunks.size();
    this.xPositions = new int[i];
    this.zPositions = new int[i];
    this.chunksData = new S21PacketChunkData.Extracted[i];
    this.isOverworld = !((Chunk)chunks.get(0)).getWorld().provider.getHasNoSky();

    for (int j = 0; j < i; ++j)
    {
        Chunk chunk = (Chunk)chunks.get(j);
        S21PacketChunkData.Extracted s21packetchunkdata$extracted = S21PacketChunkData.func_179756_a(chunk, true, this.isOverworld, 65535);
        this.xPositions[j] = chunk.xPosition;
        this.zPositions[j] = chunk.zPosition;
        this.chunksData[j] = s21packetchunkdata$extracted;
    }
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:18,代码来源:S26PacketMapChunkBulk.java

示例5: onLivingUpdate

import net.minecraft.world.chunk.Chunk; //导入依赖的package包/类
@SubscribeEvent
public void onLivingUpdate(LivingEvent.LivingUpdateEvent event) {
    if (!(event.getEntity() instanceof EntityPlayer)) {
        return;
    }
    EntityPlayer player = (EntityPlayer) event.getEntity();
    if (player.isDead) {
        this.hueManager.adjustColor(new Color(255, 0, 0));
        return;
    }
    BlockPos pos = player.getPosition();
    Chunk chunk = this.world.getChunkFromBlockCoords(pos);
    Biome biome = chunk.getBiome(pos, this.world.getBiomeProvider());
    String color = this.biomeMap.get(biome.getRegistryName().getResourcePath());
    if (color != null) {
        this.hueManager.adjustColor(color);
    }
}
 
开发者ID:remcohaszing,项目名称:minecraft-hue,代码行数:19,代码来源:EventListener.java

示例6: provideChunk

import net.minecraft.world.chunk.Chunk; //导入依赖的package包/类
public Chunk provideChunk(int x, int z)
{
    this.rand.setSeed((long)x * 341873128712L + (long)z * 132897987541L);
    ChunkPrimer chunkprimer = new ChunkPrimer();
    this.prepareHeights(x, z, chunkprimer);
    this.buildSurfaces(x, z, chunkprimer);
    this.genNetherCaves.generate(this.world, x, z, chunkprimer);

    if (this.generateStructures)
    {
        this.genNetherBridge.generate(this.world, x, z, chunkprimer);
    }

    Chunk chunk = new Chunk(this.world, chunkprimer, x, z);
    Biome[] abiome = this.world.getBiomeProvider().getBiomes((Biome[])null, x * 16, z * 16, 16, 16);
    byte[] abyte = chunk.getBiomeArray();

    for (int i = 0; i < abyte.length; ++i)
    {
        abyte[i] = (byte)Biome.getIdForBiome(abiome[i]);
    }

    chunk.resetRelightChecks();
    return chunk;
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:26,代码来源:ChunkProviderHell.java

示例7: getChunksLowestHorizon

import net.minecraft.world.chunk.Chunk; //导入依赖的package包/类
/**
 * Gets the lowest height of the chunk where sunlight directly reaches
 */
public int getChunksLowestHorizon(int x, int z)
{
    if (x >= -30000000 && z >= -30000000 && x < 30000000 && z < 30000000)
    {
        if (!this.isChunkLoaded(x >> 4, z >> 4, true))
        {
            return 0;
        }
        else
        {
            Chunk chunk = this.getChunkFromChunkCoords(x >> 4, z >> 4);
            return chunk.getLowestHeight();
        }
    }
    else
    {
        return this.func_181545_F() + 1;
    }
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:23,代码来源:World.java

示例8: saveChunk

import net.minecraft.world.chunk.Chunk; //导入依赖的package包/类
public void saveChunk(World worldIn, Chunk chunkIn) throws MinecraftException, IOException
{
    worldIn.checkSessionLock();

    try
    {
        NBTTagCompound nbttagcompound = new NBTTagCompound();
        NBTTagCompound nbttagcompound1 = new NBTTagCompound();
        nbttagcompound.setTag("Level", nbttagcompound1);
        this.writeChunkToNBT(chunkIn, worldIn, nbttagcompound1);
        this.addChunkToPending(chunkIn.getChunkCoordIntPair(), nbttagcompound);
    }
    catch (Exception exception)
    {
        logger.error((String)"Failed to save chunk", (Throwable)exception);
    }
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:18,代码来源:AnvilChunkLoader.java

示例9: provideChunk

import net.minecraft.world.chunk.Chunk; //导入依赖的package包/类
public Chunk provideChunk(int x, int z)
{
    this.chunkX = x; this.chunkZ = z;
    this.rand.setSeed((long)x * 341873128712L + (long)z * 132897987541L);
    ChunkPrimer chunkprimer = new ChunkPrimer();
    this.biomesForGeneration = this.worldObj.getBiomeProvider().getBiomes(this.biomesForGeneration, x * 16, z * 16, 16, 16);
    this.setBlocksInChunk(x, z, chunkprimer);
    this.buildSurfaces(chunkprimer);

    if (this.mapFeaturesEnabled)
    {
        this.endCityGen.generate(this.worldObj, x, z, chunkprimer);
    }

    Chunk chunk = new Chunk(this.worldObj, chunkprimer, x, z);
    byte[] abyte = chunk.getBiomeArray();

    for (int i = 0; i < abyte.length; ++i)
    {
        abyte[i] = (byte)Biome.getIdForBiome(this.biomesForGeneration[i]);
    }

    chunk.generateSkylightMap();
    return chunk;
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:26,代码来源:ChunkProviderEnd.java

示例10: getBlockState

import net.minecraft.world.chunk.Chunk; //导入依赖的package包/类
public IBlockState getBlockState(BlockPos pos)
{
    if (pos.getY() >= 0 && pos.getY() < 256)
    {
        int i = (pos.getX() >> 4) - this.chunkX;
        int j = (pos.getZ() >> 4) - this.chunkZ;

        if (i >= 0 && i < this.chunkArray.length && j >= 0 && j < this.chunkArray[i].length)
        {
            Chunk chunk = this.chunkArray[i][j];

            if (chunk != null)
            {
                return chunk.getBlockState(pos);
            }
        }
    }

    return Blocks.AIR.getDefaultState();
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:21,代码来源:ChunkCache.java

示例11: provideChunk

import net.minecraft.world.chunk.Chunk; //导入依赖的package包/类
/**
 * Will return back a chunk, if it doesn't exist and its not a MP client it will generates all the blocks for the
 * specified chunk from the map seed and chunk seed
 */
public Chunk provideChunk(int x, int z)
{
    this.endRNG.setSeed((long)x * 341873128712L + (long)z * 132897987541L);
    ChunkPrimer chunkprimer = new ChunkPrimer();
    this.biomesForGeneration = this.endWorld.getWorldChunkManager().loadBlockGeneratorData(this.biomesForGeneration, x * 16, z * 16, 16, 16);
    this.func_180520_a(x, z, chunkprimer);
    this.func_180519_a(chunkprimer);
    Chunk chunk = new Chunk(this.endWorld, chunkprimer, x, z);
    byte[] abyte = chunk.getBiomeArray();

    for (int i = 0; i < abyte.length; ++i)
    {
        abyte[i] = (byte)this.biomesForGeneration[i].biomeID;
    }

    chunk.generateSkylightMap();
    return chunk;
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:23,代码来源:ChunkProviderEnd.java

示例12: SPacketChunkData

import net.minecraft.world.chunk.Chunk; //导入依赖的package包/类
public SPacketChunkData(Chunk p_i47124_1_, int p_i47124_2_)
{
    this.chunkX = p_i47124_1_.xPosition;
    this.chunkZ = p_i47124_1_.zPosition;
    this.loadChunk = p_i47124_2_ == 65535;
    boolean flag = p_i47124_1_.getWorld().provider.func_191066_m();
    this.buffer = new byte[this.calculateChunkSize(p_i47124_1_, flag, p_i47124_2_)];
    this.availableSections = this.extractChunkData(new PacketBuffer(this.getWriteBuffer()), p_i47124_1_, flag, p_i47124_2_);
    this.tileEntityTags = Lists.<NBTTagCompound>newArrayList();

    for (Entry<BlockPos, TileEntity> entry : p_i47124_1_.getTileEntityMap().entrySet())
    {
        BlockPos blockpos = (BlockPos)entry.getKey();
        TileEntity tileentity = (TileEntity)entry.getValue();
        int i = blockpos.getY() >> 4;

        if (this.doChunkLoad() || (p_i47124_2_ & 1 << i) != 0)
        {
            NBTTagCompound nbttagcompound = tileentity.getUpdateTag();
            this.tileEntityTags.add(nbttagcompound);
        }
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:24,代码来源:SPacketChunkData.java

示例13: onRightClickBlock

import net.minecraft.world.chunk.Chunk; //导入依赖的package包/类
@SubscribeEvent
public void onRightClickBlock(RightClickBlock event)
{
	if (event.getWorld().isRemote) { return; }		// Not doing this on client side
	if (!Main.shouldCheckInteraction()) { return; }	// Not my business

	Main.console("Block at x" + event.getPos().getX() + " y" + event.getPos().getY() + " z" + event.getPos().getZ() + " touched by player " + event.getEntityPlayer().getName() + 
			" (ID " + event.getEntityPlayer().getGameProfile().getId() + ").");

	Chunk chunk = event.getEntityPlayer().worldObj.getChunkFromBlockCoords(event.getPos());

	if (TerritoryHandler.canPlayerEditChunk(event.getEntityPlayer().worldObj, event.getEntityPlayer(), chunk))	// Checks out
	{
		Main.console("Player is allowed to interact with this chunk. Doing nothing.");
	}
	else
	{
		Main.console("Player is not allowed to interact with this chunk. Cancelling.");
		event.setCanceled(true);	// Not having it
	}
}
 
开发者ID:Domochevsky,项目名称:minecraft-territorialdealings,代码行数:22,代码来源:EventListener.java

示例14: extractChunkData

import net.minecraft.world.chunk.Chunk; //导入依赖的package包/类
public int extractChunkData(PacketBuffer p_189555_1_, Chunk p_189555_2_, boolean p_189555_3_, int p_189555_4_)
{
    int i = 0;
    ExtendedBlockStorage[] aextendedblockstorage = p_189555_2_.getBlockStorageArray();
    int j = 0;

    for (int k = aextendedblockstorage.length; j < k; ++j)
    {
        ExtendedBlockStorage extendedblockstorage = aextendedblockstorage[j];

        if (extendedblockstorage != Chunk.NULL_BLOCK_STORAGE && (!this.doChunkLoad() || !extendedblockstorage.isEmpty()) && (p_189555_4_ & 1 << j) != 0)
        {
            i |= 1 << j;
            extendedblockstorage.getData().write(p_189555_1_);
            p_189555_1_.writeBytes(extendedblockstorage.getBlocklightArray().getData());

            if (p_189555_3_)
            {
                p_189555_1_.writeBytes(extendedblockstorage.getSkylightArray().getData());
            }
        }
    }

    if (this.doChunkLoad())
    {
        p_189555_1_.writeBytes(p_189555_2_.getBiomeArray());
    }

    return i;
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:31,代码来源:SPacketChunkData.java

示例15: notifyChunk

import net.minecraft.world.chunk.Chunk; //导入依赖的package包/类
/**
 * Notify all nearby players about chunk changes
 * @param chunk Chunk to notify
 */
public void notifyChunk(Chunk chunk) {
    for (EntityPlayer player : world.playerEntities) {
        if (player instanceof EntityPlayerMP) {
            EntityPlayerMP playerMP = (EntityPlayerMP) player;
            if (    Math.abs(playerMP.chunkCoordX - chunk.xPosition) <= 32 &&
                    Math.abs(playerMP.chunkCoordZ - chunk.zPosition) <= 32) {
                playerMP.connection.sendPacket(new SPacketChunkData(chunk, 65535));
            }
        }
    }
}
 
开发者ID:ternsip,项目名称:StructPro,代码行数:16,代码来源:UWorld.java


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