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

The following are Jave code examples for showing how to use func_190526_b() 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: MapGenMineshaft.java   Source Code and License Vote up 5 votes
public BlockPos getClosestStrongholdPos(World worldIn, BlockPos pos, boolean p_180706_3_)
{
    int i = 1000;
    int j = pos.getX() >> 4;
    int k = pos.getZ() >> 4;

    for (int l = 0; l <= 1000; ++l)
    {
        for (int i1 = -l; i1 <= l; ++i1)
        {
            boolean flag = i1 == -l || i1 == l;

            for (int j1 = -l; j1 <= l; ++j1)
            {
                boolean flag1 = j1 == -l || j1 == l;

                if (flag || flag1)
                {
                    int k1 = j + i1;
                    int l1 = k + j1;
                    this.rand.setSeed((long)(k1 ^ l1) ^ worldIn.getSeed());
                    this.rand.nextInt();

                    if (this.canSpawnStructureAtCoords(k1, l1) && (!p_180706_3_ || !worldIn.func_190526_b(k1, l1)))
                    {
                        return new BlockPos((k1 << 4) + 8, 64, (l1 << 4) + 8);
                    }
                }
            }
        }
    }

    return null;
}
 
Example 2
Project: Backmemed   File: MapGenNetherBridge.java   Source Code and License Vote up 5 votes
public BlockPos getClosestStrongholdPos(World worldIn, BlockPos pos, boolean p_180706_3_)
{
    int i = 1000;
    int j = pos.getX() >> 4;
    int k = pos.getZ() >> 4;

    for (int l = 0; l <= 1000; ++l)
    {
        for (int i1 = -l; i1 <= l; ++i1)
        {
            boolean flag = i1 == -l || i1 == l;

            for (int j1 = -l; j1 <= l; ++j1)
            {
                boolean flag1 = j1 == -l || j1 == l;

                if (flag || flag1)
                {
                    int k1 = j + i1;
                    int l1 = k + j1;

                    if (this.canSpawnStructureAtCoords(k1, l1) && (!p_180706_3_ || !worldIn.func_190526_b(k1, l1)))
                    {
                        return new BlockPos((k1 << 4) + 8, 64, (l1 << 4) + 8);
                    }
                }
            }
        }
    }

    return null;
}
 
Example 3
Project: Backmemed   File: MapGenStructure.java   Source Code and License Vote up 4 votes
protected static BlockPos func_191069_a(World p_191069_0_, MapGenStructure p_191069_1_, BlockPos p_191069_2_, int p_191069_3_, int p_191069_4_, int p_191069_5_, boolean p_191069_6_, int p_191069_7_, boolean p_191069_8_)
{
    int i = p_191069_2_.getX() >> 4;
    int j = p_191069_2_.getZ() >> 4;
    int k = 0;

    for (Random random = new Random(); k <= p_191069_7_; ++k)
    {
        for (int l = -k; l <= k; ++l)
        {
            boolean flag = l == -k || l == k;

            for (int i1 = -k; i1 <= k; ++i1)
            {
                boolean flag1 = i1 == -k || i1 == k;

                if (flag || flag1)
                {
                    int j1 = i + p_191069_3_ * l;
                    int k1 = j + p_191069_3_ * i1;

                    if (j1 < 0)
                    {
                        j1 -= p_191069_3_ - 1;
                    }

                    if (k1 < 0)
                    {
                        k1 -= p_191069_3_ - 1;
                    }

                    int l1 = j1 / p_191069_3_;
                    int i2 = k1 / p_191069_3_;
                    Random random1 = p_191069_0_.setRandomSeed(l1, i2, p_191069_5_);
                    l1 = l1 * p_191069_3_;
                    i2 = i2 * p_191069_3_;

                    if (p_191069_6_)
                    {
                        l1 = l1 + (random1.nextInt(p_191069_3_ - p_191069_4_) + random1.nextInt(p_191069_3_ - p_191069_4_)) / 2;
                        i2 = i2 + (random1.nextInt(p_191069_3_ - p_191069_4_) + random1.nextInt(p_191069_3_ - p_191069_4_)) / 2;
                    }
                    else
                    {
                        l1 = l1 + random1.nextInt(p_191069_3_ - p_191069_4_);
                        i2 = i2 + random1.nextInt(p_191069_3_ - p_191069_4_);
                    }

                    MapGenBase.func_191068_a(p_191069_0_.getSeed(), random, l1, i2);
                    random.nextInt();

                    if (p_191069_1_.canSpawnStructureAtCoords(l1, i2))
                    {
                        if (!p_191069_8_ || !p_191069_0_.func_190526_b(l1, i2))
                        {
                            return new BlockPos((l1 << 4) + 8, 64, (i2 << 4) + 8);
                        }
                    }
                    else if (k == 0)
                    {
                        break;
                    }
                }
            }

            if (k == 0)
            {
                break;
            }
        }
    }

    return null;
}