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


Java ChunkCache类代码示例

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


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

示例1: getCache

import net.minecraft.world.ChunkCache; //导入依赖的package包/类
public static IBlockAccess getCache(Collection<BlockPos> area, World world) {
    if (area.size() == 0) return world;
    int minX, minY, minZ, maxX, maxY, maxZ;
    Iterator<BlockPos> iterator = area.iterator();
    BlockPos p = iterator.next();
    minX = maxX = p.getX();
    minY = maxY = p.getY();
    minZ = maxZ = p.getZ();
    while (iterator.hasNext()) {
        p = iterator.next();
        minX = Math.min(minX, p.getX());
        minY = Math.min(minY, p.getY());
        minZ = Math.min(minZ, p.getZ());
        maxX = Math.max(maxX, p.getX());
        maxY = Math.max(maxY, p.getY());
        maxZ = Math.max(maxZ, p.getZ());
    }
    return new ChunkCache(world, new BlockPos(minX, minY, minZ), new BlockPos(maxX, maxY, maxZ), 0);
}
 
开发者ID:TeamPneumatic,项目名称:pnc-repressurized,代码行数:20,代码来源:ProgWidgetAreaItemBase.java

示例2: getPathToPos

import net.minecraft.world.ChunkCache; //导入依赖的package包/类
/**
 * Returns path to given BlockPos
 */
public PathEntity getPathToPos(BlockPos pos)
{
    if (!this.canNavigate())
    {
        return null;
    }
    else
    {
        float f = this.getPathSearchRange();
        this.worldObj.theProfiler.startSection("pathfind");
        BlockPos blockpos = new BlockPos(this.theEntity);
        int i = (int)(f + 8.0F);
        ChunkCache chunkcache = new ChunkCache(this.worldObj, blockpos.add(-i, -i, -i), blockpos.add(i, i, i), 0);
        PathEntity pathentity = this.pathFinder.createEntityPathTo(chunkcache, this.theEntity, pos, f);
        this.worldObj.theProfiler.endSection();
        return pathentity;
    }
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:22,代码来源:PathNavigate.java

示例3: getPathToEntityLiving

import net.minecraft.world.ChunkCache; //导入依赖的package包/类
/**
 * Returns the path to the given EntityLiving. Args : entity
 */
public PathEntity getPathToEntityLiving(Entity entityIn)
{
    if (!this.canNavigate())
    {
        return null;
    }
    else
    {
        float f = this.getPathSearchRange();
        this.worldObj.theProfiler.startSection("pathfind");
        BlockPos blockpos = (new BlockPos(this.theEntity)).up();
        int i = (int)(f + 16.0F);
        ChunkCache chunkcache = new ChunkCache(this.worldObj, blockpos.add(-i, -i, -i), blockpos.add(i, i, i), 0);
        PathEntity pathentity = this.pathFinder.createEntityPathTo(chunkcache, this.theEntity, entityIn, f);
        this.worldObj.theProfiler.endSection();
        return pathentity;
    }
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:22,代码来源:PathNavigate.java

示例4: getPathToPos

import net.minecraft.world.ChunkCache; //导入依赖的package包/类
/**
 * Returns path to given BlockPos
 */
@Nullable
public Path getPathToPos(BlockPos pos)
{
    if (!this.canNavigate())
    {
        return null;
    }
    else if (this.currentPath != null && !this.currentPath.isFinished() && pos.equals(this.targetPos))
    {
        return this.currentPath;
    }
    else
    {
        this.targetPos = pos;
        float f = this.getPathSearchRange();
        this.worldObj.theProfiler.startSection("pathfind");
        BlockPos blockpos = new BlockPos(this.theEntity);
        int i = (int)(f + 8.0F);
        ChunkCache chunkcache = new ChunkCache(this.worldObj, blockpos.add(-i, -i, -i), blockpos.add(i, i, i), 0);
        Path path = this.pathFinder.findPath(chunkcache, this.theEntity, this.targetPos, f);
        this.worldObj.theProfiler.endSection();
        return path;
    }
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:28,代码来源:PathNavigate.java

示例5: getWorld

import net.minecraft.world.ChunkCache; //导入依赖的package包/类
public static World getWorld(IBlockAccess world)
{
       if (world instanceof World)
       	return (World) world;
       
       if (world instanceof ChunkCache)
	try
       {
		Field f = (Field) reflectionCache.get(20);
        if (f == null)
        {
            Class c = Class.forName("net.minecraft.world.ChunkCache");
            f = c.getDeclaredField(getNameDynamic(KEY_FIELD_CHUNKCACHE_WORLDOBJ));
            f.setAccessible(true);
            reflectionCache.put(20, f);
        }
        
        return (World) f.get(world);
       }
       catch (Throwable t)
       {
           t.printStackTrace();
       }
	
	return null;
}
 
开发者ID:4Space,项目名称:4Space-5,代码行数:27,代码来源:VersionUtil.java

示例6: getNodeForPassableBlock

import net.minecraft.world.ChunkCache; //导入依赖的package包/类
protected Node getNodeForPassableBlock(World world, ChunkCache cache, BlockPos pos, PathFinderSettings settings) {
    int fallCount = 0;
    Node node = null;
    while (node == null) {
        fallCount = fallCount + 1;
        BlockPos posBelow = pos.add(0, -fallCount, 0);
        IBlockState stateBelow = cache.getBlockState(posBelow);
        if(!this.isValidPosition(posBelow)) {
            node = new Node.Doom(world, pos);
        }  else if(!this.isPassableBlock(cache, posBelow, stateBelow)) {
            if (this.canStandOnBlock(cache, posBelow, stateBelow, settings)) {
                node = new Node.Fall(world, pos);
            } else if(this.isSwimmableLiquid(stateBelow)) {
                node = settings.canSwim() ? new Node.Swim(world, pos) : new Node.Doom(world, pos);
            }
        }
    }
    if(node instanceof Node.Doom) {
        return node;
    } else {
        return fallCount <= settings.maxFallHeight() ? node : new Node.Doom(world, pos);
    }
}
 
开发者ID:InfinityRaider,项目名称:SettlerCraft,代码行数:24,代码来源:NodeCreator.java

示例7: getPathToPos

import net.minecraft.world.ChunkCache; //导入依赖的package包/类
/**
 * Returns path to given BlockPos
 */
public PathEntity getPathToPos(BlockPos pos) {
    if (!this.canNavigate()) {
        return null;
    } else if (this.currentPath != null && !this.currentPath.isFinished() && pos.equals(this.field_188564_r)) {
        return this.currentPath;
    } else {
        this.field_188564_r = pos;
        float f = this.getPathSearchRange();
        this.worldObj.profiler.startSection("pathfind");
        BlockPos blockpos = new BlockPos(this.theEntity);
        int i = (int)(f + 8.0F);
        ChunkCache chunkcache = new ChunkCache(this.worldObj, blockpos.add(-i, -i, -i), blockpos.add(i, i, i), 0);
        PathEntity pathentity = this.pathFinder.findPathToPos(chunkcache, this.theEntity, this.field_188564_r, f);
        this.worldObj.profiler.endSection();
        return pathentity;
    }
}
 
开发者ID:InfinityRaider,项目名称:SettlerCraft,代码行数:21,代码来源:PathNavigate.java

示例8: getPathToEntityLiving

import net.minecraft.world.ChunkCache; //导入依赖的package包/类
/**
 * Returns the path to the given EntityLiving. Args : entity
 */
public PathEntity getPathToEntityLiving(Entity entityIn) {
    if (!this.canNavigate()) {
        return null;
    } else {
        BlockPos blockpos = new BlockPos(entityIn);
        if (this.currentPath != null && !this.currentPath.isFinished() && blockpos.equals(this.field_188564_r)) {
            return this.currentPath;
        } else {
            this.field_188564_r = blockpos;
            float f = this.getPathSearchRange();
            this.worldObj.profiler.startSection("pathfind");
            BlockPos blockpos1 = (new BlockPos(this.theEntity)).up();
            int i = (int)(f + 16.0F);
            ChunkCache chunkcache = new ChunkCache(this.worldObj, blockpos1.add(-i, -i, -i), blockpos1.add(i, i, i), 0);
            PathEntity pathentity = this.pathFinder.findPathToEntity(chunkcache, this.theEntity, entityIn, f);
            this.worldObj.profiler.endSection();
            return pathentity;
        }
    }
}
 
开发者ID:InfinityRaider,项目名称:SettlerCraft,代码行数:24,代码来源:PathNavigate.java

示例9: getMixedBrightnessForBlockWithColor

import net.minecraft.world.ChunkCache; //导入依赖的package包/类
public static int getMixedBrightnessForBlockWithColor(IBlockAccess blockAccess, int x, int y, int z) {
    int l;
    Block block = blockAccess.getBlock(x, y, z);
    if (blockAccess instanceof World)
        l = CLWorldHelper.getLightBrightnessForSkyBlocksWithColor((World) blockAccess, x, y, z, block.getLightValue(blockAccess, x, y, z));
    else
        l = CLChunkCacheHelper.getLightBrightnessForSkyBlocksWithColor((ChunkCache) blockAccess, x, y, z, block.getLightValue(blockAccess, x, y, z));

    if (l == 0 && block instanceof BlockSlab) {
        --y;
        block = blockAccess.getBlock(x, y, z);
        if (blockAccess instanceof World)
            return CLWorldHelper.getLightBrightnessForSkyBlocksWithColor((World) blockAccess, x, y, z, block.getLightValue(blockAccess, x, y, z));
        else
            return CLChunkCacheHelper.getLightBrightnessForSkyBlocksWithColor((ChunkCache) blockAccess, x, y, z, block.getLightValue(blockAccess, x, y, z));
    } else {
        return l;
    }
}
 
开发者ID:AnDwHaT5,项目名称:PixelUtilities,代码行数:20,代码来源:CLBlockHelper.java

示例10: getLightBrightnessForSkyBlocksWithColor

import net.minecraft.world.ChunkCache; //导入依赖的package包/类
public static int getLightBrightnessForSkyBlocksWithColor(ChunkCache instance, int x, int y, int z, int lightValue) {
    int skyBrightness = instance.getSkyBlockTypeBrightness(EnumSkyBlock.Sky, x, y, z);
    int blockBrightness = instance.getSkyBlockTypeBrightness(EnumSkyBlock.Block, x, y, z);

    lightValue = ((lightValue & 15) |
            ((lightValue & 480) >> 1) |
            ((lightValue & 15360) >> 2) |
            ((lightValue & 491520) >> 3));

    blockBrightness = ((blockBrightness & 15) |
            ((blockBrightness & 480) >> 1) |
            ((blockBrightness & 15360) >> 2) |
            ((blockBrightness & 491520) >> 3));

    if (blockBrightness < lightValue) {
        blockBrightness = lightValue;
    }

    return skyBrightness << 20 | blockBrightness << 4;
}
 
开发者ID:AnDwHaT5,项目名称:PixelUtilities,代码行数:21,代码来源:CLChunkCacheHelper.java

示例11: getTileEntitySafely

import net.minecraft.world.ChunkCache; //导入依赖的package包/类
/**
 * Returns the tile of the specified class, returns null if it is the wrong type or does not exist.
 * Avoids creating new tile entities when using a ChunkCache (off the main thread).
 * see {@link BlockFlowerPot#getActualState(IBlockState, IBlockAccess, BlockPos)}
 */
@Nullable
public static <T extends TileEntity> T getTileEntitySafely(IBlockAccess world, BlockPos pos, Class<T> tileClass)
{
    TileEntity te;

    if (world instanceof ChunkCache)
    {
        ChunkCache chunkCache = (ChunkCache) world;
        te = chunkCache.getTileEntity(pos, Chunk.EnumCreateEntityType.CHECK);
    }
    else
    {
        te = world.getTileEntity(pos);
    }

    if (tileClass.isInstance(te))
    {
        return tileClass.cast(te);
    }
    else
    {
        return null;
    }
}
 
开发者ID:maruohon,项目名称:enderutilities,代码行数:30,代码来源:BlockEnderUtilities.java

示例12: func_72865_a

import net.minecraft.world.ChunkCache; //导入依赖的package包/类
public PathEntity func_72865_a(Entity p_72865_1_, Entity p_72865_2_, float p_72865_3_, boolean p_72865_4_, boolean p_72865_5_, boolean p_72865_6_, boolean p_72865_7_) {
   this.field_72984_F.func_76320_a("pathfind");
   int var8 = MathHelper.func_76128_c(p_72865_1_.field_70165_t);
   int var9 = MathHelper.func_76128_c(p_72865_1_.field_70163_u + 1.0D);
   int var10 = MathHelper.func_76128_c(p_72865_1_.field_70161_v);
   int var11 = (int)(p_72865_3_ + 16.0F);
   int var12 = var8 - var11;
   int var13 = var9 - var11;
   int var14 = var10 - var11;
   int var15 = var8 + var11;
   int var16 = var9 + var11;
   int var17 = var10 + var11;
   ChunkCache var18 = new ChunkCache(this, var12, var13, var14, var15, var16, var17, 0);
   PathEntity var19 = (new PathFinder(var18, p_72865_4_, p_72865_5_, p_72865_6_, p_72865_7_)).func_75856_a(p_72865_1_, p_72865_2_, p_72865_3_);
   this.field_72984_F.func_76319_b();
   return var19;
}
 
开发者ID:HATB0T,项目名称:RuneCraftery,代码行数:18,代码来源:World.java

示例13: func_72844_a

import net.minecraft.world.ChunkCache; //导入依赖的package包/类
public PathEntity func_72844_a(Entity p_72844_1_, int p_72844_2_, int p_72844_3_, int p_72844_4_, float p_72844_5_, boolean p_72844_6_, boolean p_72844_7_, boolean p_72844_8_, boolean p_72844_9_) {
   this.field_72984_F.func_76320_a("pathfind");
   int var10 = MathHelper.func_76128_c(p_72844_1_.field_70165_t);
   int var11 = MathHelper.func_76128_c(p_72844_1_.field_70163_u);
   int var12 = MathHelper.func_76128_c(p_72844_1_.field_70161_v);
   int var13 = (int)(p_72844_5_ + 8.0F);
   int var14 = var10 - var13;
   int var15 = var11 - var13;
   int var16 = var12 - var13;
   int var17 = var10 + var13;
   int var18 = var11 + var13;
   int var19 = var12 + var13;
   ChunkCache var20 = new ChunkCache(this, var14, var15, var16, var17, var18, var19, 0);
   PathEntity var21 = (new PathFinder(var20, p_72844_6_, p_72844_7_, p_72844_8_, p_72844_9_)).func_75859_a(p_72844_1_, p_72844_2_, p_72844_3_, p_72844_4_, p_72844_5_);
   this.field_72984_F.func_76319_b();
   return var21;
}
 
开发者ID:HATB0T,项目名称:RuneCraftery,代码行数:18,代码来源:World.java

示例14: getCache

import net.minecraft.world.ChunkCache; //导入依赖的package包/类
public static IBlockAccess getCache(Collection<ChunkPosition> area, World world){
    if(area.size() == 0) return world;
    int minX, minY, minZ, maxX, maxY, maxZ;
    Iterator<ChunkPosition> iterator = area.iterator();
    ChunkPosition p = iterator.next();
    minX = maxX = p.chunkPosX;
    minY = maxY = p.chunkPosY;
    minZ = maxZ = p.chunkPosZ;
    while(iterator.hasNext()) {
        p = iterator.next();
        minX = Math.min(minX, p.chunkPosX);
        minY = Math.min(minY, p.chunkPosY);
        minZ = Math.min(minZ, p.chunkPosZ);
        maxX = Math.max(maxX, p.chunkPosX);
        maxY = Math.max(maxY, p.chunkPosY);
        maxZ = Math.max(maxZ, p.chunkPosZ);
    }
    return new ChunkCache(world, minX, minY, minZ, maxX, maxY, maxZ, 0);
}
 
开发者ID:MineMaarten,项目名称:PneumaticCraft,代码行数:20,代码来源:ProgWidgetAreaItemBase.java

示例15: worldObjgetEntityPathToXYZ

import net.minecraft.world.ChunkCache; //导入依赖的package包/类
private PathEntity worldObjgetEntityPathToXYZ(Entity par1Entity, int par2, int par3, int par4, float par5, boolean par6, boolean par7,
											  boolean par8, boolean par9)
{
	int l = MathHelper.floor_double(par1Entity.posX);
	int i1 = MathHelper.floor_double(par1Entity.posY);
	int j1 = MathHelper.floor_double(par1Entity.posZ);
	int k1 = (int) (par5 + 8.0F);
	int l1 = l - k1;
	int i2 = i1 - k1;
	int j2 = j1 - k1;
	int k2 = l + k1;
	int l2 = i1 + k1;
	int i3 = j1 + k1;
	ChunkCache chunkcache = new ChunkCache(worldObj, l1, i2, j2, k2, l2, i3, 0);
	PathEntity pathentity = (new PathFinder(chunkcache, par6, par7, par8, par9)).createEntityPathTo(par1Entity, par2, par3, par4, par5);
	return pathentity;
}
 
开发者ID:Ubiquitous-Spice,项目名称:Modjam-3,代码行数:18,代码来源:SwarmPathNavigate.java


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