Java Code Examples for net.minecraft.world.World.getSeaLevel()

The following are Jave code examples for showing how to use getSeaLevel() of the net.minecraft.world.World class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
Example 1
Project: Backmemed   File: StructureMineshaftStart.java   Source Code and License Vote up 6 votes
public StructureMineshaftStart(World p_i47149_1_, Random p_i47149_2_, int p_i47149_3_, int p_i47149_4_, MapGenMineshaft.Type p_i47149_5_)
{
    super(p_i47149_3_, p_i47149_4_);
    this.mineShaftType = p_i47149_5_;
    StructureMineshaftPieces.Room structuremineshaftpieces$room = new StructureMineshaftPieces.Room(0, p_i47149_2_, (p_i47149_3_ << 4) + 2, (p_i47149_4_ << 4) + 2, this.mineShaftType);
    this.components.add(structuremineshaftpieces$room);
    structuremineshaftpieces$room.buildComponent(structuremineshaftpieces$room, this.components, p_i47149_2_);
    this.updateBoundingBox();

    if (p_i47149_5_ == MapGenMineshaft.Type.MESA)
    {
        int i = -5;
        int j = p_i47149_1_.getSeaLevel() - this.boundingBox.maxY + this.boundingBox.getYSize() / 2 - -5;
        this.boundingBox.offset(0, j, 0);

        for (StructureComponent structurecomponent : this.components)
        {
            structurecomponent.offset(0, j, 0);
        }
    }
    else
    {
        this.markAvailableHeight(p_i47149_1_, p_i47149_2_, 10);
    }
}
 
Example 2
Project: Backmemed   File: StructureOceanMonumentPieces.java   Source Code and License Vote up 6 votes
protected void generateWaterBox(World p_181655_1_, StructureBoundingBox p_181655_2_, int p_181655_3_, int p_181655_4_, int p_181655_5_, int p_181655_6_, int p_181655_7_, int p_181655_8_, boolean p_181655_9_)
{
    for (int i = p_181655_4_; i <= p_181655_7_; ++i)
    {
        for (int j = p_181655_3_; j <= p_181655_6_; ++j)
        {
            for (int k = p_181655_5_; k <= p_181655_8_; ++k)
            {
                if (!p_181655_9_ || this.getBlockStateFromPos(p_181655_1_, j, i, k, p_181655_2_).getMaterial() != Material.AIR)
                {
                    if (this.getYWithOffset(i) >= p_181655_1_.getSeaLevel())
                    {
                        this.setBlockState(p_181655_1_, Blocks.AIR.getDefaultState(), j, i, k, p_181655_2_);
                    }
                    else
                    {
                        this.setBlockState(p_181655_1_, WATER, j, i, k, p_181655_2_);
                    }
                }
            }
        }
    }
}
 
Example 3
Project: Backmemed   File: StructureStart.java   Source Code and License Vote up 6 votes
/**
 * offsets the structure Bounding Boxes up to a certain height, typically 63 - 10
 */
protected void markAvailableHeight(World worldIn, Random rand, int p_75067_3_)
{
    int i = worldIn.getSeaLevel() - p_75067_3_;
    int j = this.boundingBox.getYSize() + 1;

    if (j < i)
    {
        j += rand.nextInt(i - j);
    }

    int k = j - this.boundingBox.maxY;
    this.boundingBox.offset(0, k, 0);

    for (StructureComponent structurecomponent : this.components)
    {
        structurecomponent.offset(0, k, 0);
    }
}
 
Example 4
Project: CustomWorldGen   File: StructureMineshaftStart.java   Source Code and License Vote up 6 votes
public StructureMineshaftStart(World p_i47149_1_, Random p_i47149_2_, int p_i47149_3_, int p_i47149_4_, MapGenMineshaft.Type p_i47149_5_)
{
    super(p_i47149_3_, p_i47149_4_);
    this.mineShaftType = p_i47149_5_;
    StructureMineshaftPieces.Room structuremineshaftpieces$room = new StructureMineshaftPieces.Room(0, p_i47149_2_, (p_i47149_3_ << 4) + 2, (p_i47149_4_ << 4) + 2, this.mineShaftType);
    this.components.add(structuremineshaftpieces$room);
    structuremineshaftpieces$room.buildComponent(structuremineshaftpieces$room, this.components, p_i47149_2_);
    this.updateBoundingBox();

    if (p_i47149_5_ == MapGenMineshaft.Type.MESA)
    {
        int i = -5;
        int j = p_i47149_1_.getSeaLevel() - this.boundingBox.maxY + this.boundingBox.getYSize() / 2 - -5;
        this.boundingBox.offset(0, j, 0);

        for (StructureComponent structurecomponent : this.components)
        {
            structurecomponent.offset(0, j, 0);
        }
    }
    else
    {
        this.markAvailableHeight(p_i47149_1_, p_i47149_2_, 10);
    }
}
 
Example 5
Project: CustomWorldGen   File: StructureOceanMonumentPieces.java   Source Code and License Vote up 6 votes
protected void generateWaterBox(World p_181655_1_, StructureBoundingBox p_181655_2_, int p_181655_3_, int p_181655_4_, int p_181655_5_, int p_181655_6_, int p_181655_7_, int p_181655_8_, boolean p_181655_9_)
{
    for (int i = p_181655_4_; i <= p_181655_7_; ++i)
    {
        for (int j = p_181655_3_; j <= p_181655_6_; ++j)
        {
            for (int k = p_181655_5_; k <= p_181655_8_; ++k)
            {
                if (!p_181655_9_ || this.getBlockStateFromPos(p_181655_1_, j, i, k, p_181655_2_).getMaterial() != Material.AIR)
                {
                    if (this.getYWithOffset(i) >= p_181655_1_.getSeaLevel())
                    {
                        this.setBlockState(p_181655_1_, Blocks.AIR.getDefaultState(), j, i, k, p_181655_2_);
                    }
                    else
                    {
                        this.setBlockState(p_181655_1_, WATER, j, i, k, p_181655_2_);
                    }
                }
            }
        }
    }
}
 
Example 6
Project: CustomWorldGen   File: StructureStart.java   Source Code and License Vote up 6 votes
/**
 * offsets the structure Bounding Boxes up to a certain height, typically 63 - 10
 */
protected void markAvailableHeight(World worldIn, Random rand, int p_75067_3_)
{
    int i = worldIn.getSeaLevel() - p_75067_3_;
    int j = this.boundingBox.getYSize() + 1;

    if (j < i)
    {
        j += rand.nextInt(i - j);
    }

    int k = j - this.boundingBox.maxY;
    this.boundingBox.offset(0, k, 0);

    for (StructureComponent structurecomponent : this.components)
    {
        structurecomponent.offset(0, k, 0);
    }
}
 
Example 7
Project: ThermionicsWorld   File: GeneratorMagmaSpike.java   Source Code and License Vote up 5 votes
@Nullable
public static BlockPos findNonSpikeSurface(World world, BlockPos start) {
	BlockPos pos = start;
	while (pos.getY()>world.getSeaLevel()) {
		if (isNonSpikeSurface(world, pos)) return pos;
		pos = pos.down();
	}
	
	return null;
}
 
Example 8
Project: ThermionicsWorld   File: NeoHellGenerators.java   Source Code and License Vote up 5 votes
@Nullable
public static BlockPos findSurface(World world, BlockPos start) {
	BlockPos pos = start;
	while (pos.getY()>world.getSeaLevel()) {
		if (NeoHellGenerators.isSurface(world, pos)) return pos;
		pos = pos.down();
	}
	
	return null;
}