Java 类net.minecraft.world.gen.feature.WorldGenEndIsland 实例源码

项目:Backmemed    文件:TileEntityEndGateway.java   
private void findExitPortal()
{
    Vec3d vec3d = (new Vec3d((double)this.getPos().getX(), 0.0D, (double)this.getPos().getZ())).normalize();
    Vec3d vec3d1 = vec3d.scale(1024.0D);

    for (int i = 16; getChunk(this.world, vec3d1).getTopFilledSegment() > 0 && i-- > 0; vec3d1 = vec3d1.add(vec3d.scale(-16.0D)))
    {
        LOG.debug("Skipping backwards past nonempty chunk at {}", new Object[] {vec3d1});
    }

    for (int j = 16; getChunk(this.world, vec3d1).getTopFilledSegment() == 0 && j-- > 0; vec3d1 = vec3d1.add(vec3d.scale(16.0D)))
    {
        LOG.debug("Skipping forward past empty chunk at {}", new Object[] {vec3d1});
    }

    LOG.debug("Found chunk at {}", new Object[] {vec3d1});
    Chunk chunk = getChunk(this.world, vec3d1);
    this.exitPortal = findSpawnpointInChunk(chunk);

    if (this.exitPortal == null)
    {
        this.exitPortal = new BlockPos(vec3d1.xCoord + 0.5D, 75.0D, vec3d1.zCoord + 0.5D);
        LOG.debug("Failed to find suitable block, settling on {}", new Object[] {this.exitPortal});
        (new WorldGenEndIsland()).generate(this.world, new Random(this.exitPortal.toLong()), this.exitPortal);
    }
    else
    {
        LOG.debug("Found block at {}", new Object[] {this.exitPortal});
    }

    this.exitPortal = findHighestBlock(this.world, this.exitPortal, 16, true);
    LOG.debug("Creating portal at {}", new Object[] {this.exitPortal});
    this.exitPortal = this.exitPortal.up(10);
    this.createExitPortal(this.exitPortal);
    this.markDirty();
}
项目:CustomWorldGen    文件:TileEntityEndGateway.java   
private void findExitPortal()
{
    Vec3d vec3d = (new Vec3d((double)this.getPos().getX(), 0.0D, (double)this.getPos().getZ())).normalize();
    Vec3d vec3d1 = vec3d.scale(1024.0D);

    for (int i = 16; getChunk(this.worldObj, vec3d1).getTopFilledSegment() > 0 && i-- > 0; vec3d1 = vec3d1.add(vec3d.scale(-16.0D)))
    {
        LOG.debug("Skipping backwards past nonempty chunk at {}", new Object[] {vec3d1});
    }

    for (int j = 16; getChunk(this.worldObj, vec3d1).getTopFilledSegment() == 0 && j-- > 0; vec3d1 = vec3d1.add(vec3d.scale(16.0D)))
    {
        LOG.debug("Skipping forward past empty chunk at {}", new Object[] {vec3d1});
    }

    LOG.debug("Found chunk at {}", new Object[] {vec3d1});
    Chunk chunk = getChunk(this.worldObj, vec3d1);
    this.exitPortal = findSpawnpointInChunk(chunk);

    if (this.exitPortal == null)
    {
        this.exitPortal = new BlockPos(vec3d1.xCoord + 0.5D, 75.0D, vec3d1.zCoord + 0.5D);
        LOG.debug("Failed to find suitable block, settling on {}", new Object[] {this.exitPortal});
        (new WorldGenEndIsland()).generate(this.worldObj, new Random(this.exitPortal.toLong()), this.exitPortal);
    }
    else
    {
        LOG.debug("Found block at {}", new Object[] {this.exitPortal});
    }

    this.exitPortal = findHighestBlock(this.worldObj, this.exitPortal, 16, true);
    LOG.debug("Creating portal at {}", new Object[] {this.exitPortal});
    this.exitPortal = this.exitPortal.up(10);
    this.createExitPortal(this.exitPortal);
    this.markDirty();
}