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


Java CraftEventFactory.handleBlockGrowEvent方法代码示例

本文整理汇总了Java中org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockGrowEvent方法的典型用法代码示例。如果您正苦于以下问题:Java CraftEventFactory.handleBlockGrowEvent方法的具体用法?Java CraftEventFactory.handleBlockGrowEvent怎么用?Java CraftEventFactory.handleBlockGrowEvent使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.bukkit.craftbukkit.event.CraftEventFactory的用法示例。


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

示例1: a

import org.bukkit.craftbukkit.event.CraftEventFactory; //导入方法依赖的package包/类
public void a(World world, int i, int j, int k, Random random) {
    if (world.isEmpty(i, j + 1, k)) {
        int l;

        for (l = 1; world.getType(i, j - l, k) == this; ++l) {
            ;
        }

        if (l < 3) {
            int i1 = world.getData(i, j, k);

            if (i1 == 15) {
                CraftEventFactory.handleBlockGrowEvent(world, i, j + 1, k, this, 0); // CraftBukkit
                world.setData(i, j, k, 0, 4);
                this.doPhysics(world, i, j + 1, k, this);
            } else {
                world.setData(i, j, k, i1 + 1, 4);
            }
        }
    }
}
 
开发者ID:OvercastNetwork,项目名称:CraftBukkit,代码行数:22,代码来源:BlockCactus.java

示例2: a

import org.bukkit.craftbukkit.event.CraftEventFactory; //导入方法依赖的package包/类
public void a(World world, int i, int j, int k, Random random) {
    if (world.isEmpty(i, j + 1, k)) {
        int l;

        for (l = 1; world.getType(i, j - l, k) == this; ++l) {
            ;
        }

        if (l < 3) {
            int i1 = world.getData(i, j, k);

            if (i1 >= (byte) range(3, (world.growthOdds / world.spigotConfig.cactusModifier * 15) + 0.5F, 15)) { // Spigot
                CraftEventFactory.handleBlockGrowEvent(world, i, j + 1, k, this, 0); // CraftBukkit
                world.setData(i, j, k, 0, 4);
                this.doPhysics(world, i, j + 1, k, this);
            } else {
                world.setData(i, j, k, i1 + 1, 4);
            }
        }
    }
}
 
开发者ID:pvginkel,项目名称:Tweakkit-Server,代码行数:22,代码来源:BlockCactus.java

示例3: a

import org.bukkit.craftbukkit.event.CraftEventFactory; //导入方法依赖的package包/类
public void a(World world, int i, int j, int k, Random random) {
    super.a(world, i, j, k, random);
    if (world.getLightLevel(i, j + 1, k) >= 9) {
        int l = world.getData(i, j, k);

        if (l < 7) {
            float f = this.n(world, i, j, k);

            if (random.nextInt((int) (25.0F / f) + 1) == 0) {
                ++l;
                CraftEventFactory.handleBlockGrowEvent(world, i, j, k, this, l); // CraftBukkit
            }
        }
    }
}
 
开发者ID:OvercastNetwork,项目名称:CraftBukkit,代码行数:16,代码来源:BlockCrops.java

示例4: m

import org.bukkit.craftbukkit.event.CraftEventFactory; //导入方法依赖的package包/类
public void m(World world, int i, int j, int k) {
    int l = world.getData(i, j, k) + MathHelper.nextInt(world.random, 2, 5);

    if (l > 7) {
        l = 7;
    }

    CraftEventFactory.handleBlockGrowEvent(world, i, j, k, this, l); // CraftBukkit
}
 
开发者ID:OvercastNetwork,项目名称:CraftBukkit,代码行数:10,代码来源:BlockCrops.java

示例5: a

import org.bukkit.craftbukkit.event.CraftEventFactory; //导入方法依赖的package包/类
public void a(World world, int i, int j, int k, Random random) {
    if (!this.j(world, i, j, k)) {
        this.b(world, i, j, k, world.getData(i, j, k), 0);
        world.setTypeAndData(i, j, k, getById(0), 0, 2);
    } else if (world.random.nextInt(5) == 0) {
        int l = world.getData(i, j, k);
        int i1 = c(l);

        if (i1 < 2) {
            ++i1;
            // CraftBukkit
            CraftEventFactory.handleBlockGrowEvent(world, i, j, k, this, i1 << 2 | l(l));
        }
    }
}
 
开发者ID:OvercastNetwork,项目名称:CraftBukkit,代码行数:16,代码来源:BlockCocoa.java

示例6: b

import org.bukkit.craftbukkit.event.CraftEventFactory; //导入方法依赖的package包/类
public void b(World world, Random random, int i, int j, int k) {
    int l = world.getData(i, j, k);
    int i1 = BlockDirectional.l(l);
    int j1 = c(l);

    ++j1;
    CraftEventFactory.handleBlockGrowEvent(world, i, j, k, this, j1 << 2 | i1); // CraftBukkit
}
 
开发者ID:OvercastNetwork,项目名称:CraftBukkit,代码行数:9,代码来源:BlockCocoa.java

示例7: a

import org.bukkit.craftbukkit.event.CraftEventFactory; //导入方法依赖的package包/类
public void a(World world, int i, int j, int k, Random random) {
    super.a(world, i, j, k, random);
    if (world.getLightLevel(i, j + 1, k) >= 9) {
        int l = world.getData(i, j, k);

        if (l < 7) {
            float f = this.n(world, i, j, k);

            if (random.nextInt((int) (world.growthOdds / world.spigotConfig.wheatModifier * (25.0F / f)) + 1) == 0) { // Spigot
                ++l;
                CraftEventFactory.handleBlockGrowEvent(world, i, j, k, this, l); // CraftBukkit
            }
        }
    }
}
 
开发者ID:pvginkel,项目名称:Tweakkit-Server,代码行数:16,代码来源:BlockCrops.java

示例8: updateTick

import org.bukkit.craftbukkit.event.CraftEventFactory; //导入方法依赖的package包/类
public void updateTick(World p_149674_1_, int p_149674_2_, int p_149674_3_, int p_149674_4_, Random p_149674_5_)
{
    if (p_149674_1_.isAirBlock(p_149674_2_, p_149674_3_ + 1, p_149674_4_))
    {
        int l;

        for (l = 1; p_149674_1_.getBlock(p_149674_2_, p_149674_3_ - l, p_149674_4_) == this; ++l)
        {
            ;
        }

        if (l < 3)
        {
            int i1 = p_149674_1_.getBlockMetadata(p_149674_2_, p_149674_3_, p_149674_4_);

            if (i1 >= (byte) range(3, (p_149674_1_.growthOdds / p_149674_1_.getSpigotConfig().cactusModifier * 15) + 0.5F, 15))   // Spigot // Cauldron
            {
                CraftEventFactory.handleBlockGrowEvent(p_149674_1_, p_149674_2_, p_149674_3_ + 1, p_149674_4_, this, 0); // CraftBukkit
                p_149674_1_.setBlockMetadataWithNotify(p_149674_2_, p_149674_3_, p_149674_4_, 0, 4);
                this.onNeighborBlockChange(p_149674_1_, p_149674_2_, p_149674_3_ + 1, p_149674_4_, this);
            }
            else
            {
                p_149674_1_.setBlockMetadataWithNotify(p_149674_2_, p_149674_3_, p_149674_4_, i1 + 1, 4);
            }
        }
    }
}
 
开发者ID:xtrafrancyz,项目名称:Cauldron,代码行数:29,代码来源:BlockCactus.java

示例9: a

import org.bukkit.craftbukkit.event.CraftEventFactory; //导入方法依赖的package包/类
public void a(World world, int i, int j, int k, Random random) {
    super.a(world, i, j, k, random);
    if (world.getLightLevel(i, j + 1, k) >= 9) {
        float f = this.n(world, i, j, k);

        if (random.nextInt((int) (25.0F / f) + 1) == 0) {
            int l = world.getData(i, j, k);

            if (l < 7) {
                ++l;
                CraftEventFactory.handleBlockGrowEvent(world, i, j, k, this, l); // CraftBukkit
            } else {
                if (world.getType(i - 1, j, k) == this.blockFruit) {
                    return;
                }

                if (world.getType(i + 1, j, k) == this.blockFruit) {
                    return;
                }

                if (world.getType(i, j, k - 1) == this.blockFruit) {
                    return;
                }

                if (world.getType(i, j, k + 1) == this.blockFruit) {
                    return;
                }

                int i1 = random.nextInt(4);
                int j1 = i;
                int k1 = k;

                if (i1 == 0) {
                    j1 = i - 1;
                }

                if (i1 == 1) {
                    ++j1;
                }

                if (i1 == 2) {
                    k1 = k - 1;
                }

                if (i1 == 3) {
                    ++k1;
                }

                Block block = world.getType(j1, j - 1, k1);

                if (world.getType(j1, j, k1).material == Material.AIR && (block == Blocks.SOIL || block == Blocks.DIRT || block == Blocks.GRASS)) {
                    CraftEventFactory.handleBlockGrowEvent(world, j1, j, k1, this.blockFruit, 0); // CraftBukkit
                }
            }
        }
    }
}
 
开发者ID:OvercastNetwork,项目名称:CraftBukkit,代码行数:58,代码来源:BlockStem.java

示例10: b

import org.bukkit.craftbukkit.event.CraftEventFactory; //导入方法依赖的package包/类
public void b(World world, Random random, int i, int j, int k) {
    int l = 0;

    while (l < 128) {
        int i1 = i;
        int j1 = j + 1;
        int k1 = k;
        int l1 = 0;

        while (true) {
            if (l1 < l / 16) {
                i1 += random.nextInt(3) - 1;
                j1 += (random.nextInt(3) - 1) * random.nextInt(3) / 2;
                k1 += random.nextInt(3) - 1;
                if (world.getType(i1, j1 - 1, k1) == Blocks.GRASS && !world.getType(i1, j1, k1).r()) {
                    ++l1;
                    continue;
                }
            } else if (world.getType(i1, j1, k1).material == Material.AIR) {
                if (random.nextInt(8) != 0) {
                    if (Blocks.LONG_GRASS.j(world, i1, j1, k1)) {
                        CraftEventFactory.handleBlockGrowEvent(world, i1, j1, k1, Blocks.LONG_GRASS, 1); // CraftBukkit
                    }
                } else {
                    String s = world.getBiome(i1, k1).a(random, i1, j1, k1);

                    a.debug("Flower in " + world.getBiome(i1, k1).af + ": " + s);
                    BlockFlowers blockflowers = BlockFlowers.e(s);

                    if (blockflowers != null && blockflowers.j(world, i1, j1, k1)) {
                        int i2 = BlockFlowers.f(s);

                        CraftEventFactory.handleBlockGrowEvent(world, i1, j1, k1, blockflowers, i2); // CraftBukkit
                    }
                }
            }

            ++l;
            break;
        }
    }
}
 
开发者ID:OvercastNetwork,项目名称:CraftBukkit,代码行数:43,代码来源:BlockGrass.java

示例11: a

import org.bukkit.craftbukkit.event.CraftEventFactory; //导入方法依赖的package包/类
public void a(World world, int i, int j, int k, Random random) {
    super.a(world, i, j, k, random);
    if (world.getLightLevel(i, j + 1, k) >= 9) {
        float f = this.m(world, i, j, k);

        if (random.nextInt((int) (world.growthOdds / (this.id == Block.PUMPKIN_STEM.id ? world.spigotConfig.pumpkinModifier : world.spigotConfig.melonModifier) * (25.0F / f)) + 1) == 0) { // Spigot
            int l = world.getData(i, j, k);

            if (l < 7) {
                CraftEventFactory.handleBlockGrowEvent(world, i, j, k, this.id, ++l); // CraftBukkit
            } else {
                if (world.getTypeId(i - 1, j, k) == this.blockFruit.id) {
                    return;
                }

                if (world.getTypeId(i + 1, j, k) == this.blockFruit.id) {
                    return;
                }

                if (world.getTypeId(i, j, k - 1) == this.blockFruit.id) {
                    return;
                }

                if (world.getTypeId(i, j, k + 1) == this.blockFruit.id) {
                    return;
                }

                int i1 = random.nextInt(4);
                int j1 = i;
                int k1 = k;

                if (i1 == 0) {
                    j1 = i - 1;
                }

                if (i1 == 1) {
                    ++j1;
                }

                if (i1 == 2) {
                    k1 = k - 1;
                }

                if (i1 == 3) {
                    ++k1;
                }

                int l1 = world.getTypeId(j1, j - 1, k1);

                if (world.getTypeId(j1, j, k1) == 0 && (l1 == Block.SOIL.id || l1 == Block.DIRT.id || l1 == Block.GRASS.id)) {
                    CraftEventFactory.handleBlockGrowEvent(world, j1, j, k1, this.blockFruit.id, 0); // CraftBukkit
                }
            }
        }
    }
}
 
开发者ID:AlmuraDev,项目名称:Almura-Server,代码行数:57,代码来源:BlockStem.java

示例12: a

import org.bukkit.craftbukkit.event.CraftEventFactory; //导入方法依赖的package包/类
public void a(World world, int i, int j, int k, Random random) {
    super.a(world, i, j, k, random);
    if (world.getLightLevel(i, j + 1, k) >= 9) {
        float f = this.n(world, i, j, k);

        if (random.nextInt((int) (world.growthOdds / (this == Blocks.PUMPKIN_STEM? world.spigotConfig.pumpkinModifier : world.spigotConfig.melonModifier) * (25.0F / f)) + 1) == 0) { // Spigot
            int l = world.getData(i, j, k);

            if (l < 7) {
                ++l;
                CraftEventFactory.handleBlockGrowEvent(world, i, j, k, this, l); // CraftBukkit
            } else {
                if (world.getType(i - 1, j, k) == this.blockFruit) {
                    return;
                }

                if (world.getType(i + 1, j, k) == this.blockFruit) {
                    return;
                }

                if (world.getType(i, j, k - 1) == this.blockFruit) {
                    return;
                }

                if (world.getType(i, j, k + 1) == this.blockFruit) {
                    return;
                }

                int i1 = random.nextInt(4);
                int j1 = i;
                int k1 = k;

                if (i1 == 0) {
                    j1 = i - 1;
                }

                if (i1 == 1) {
                    ++j1;
                }

                if (i1 == 2) {
                    k1 = k - 1;
                }

                if (i1 == 3) {
                    ++k1;
                }

                Block block = world.getType(j1, j - 1, k1);

                if (world.getType(j1, j, k1).material == Material.AIR && (block == Blocks.SOIL || block == Blocks.DIRT || block == Blocks.GRASS)) {
                    CraftEventFactory.handleBlockGrowEvent(world, j1, j, k1, this.blockFruit, 0); // CraftBukkit
                }
            }
        }
    }
}
 
开发者ID:pvginkel,项目名称:Tweakkit-Server,代码行数:58,代码来源:BlockStem.java

示例13: updateTick

import org.bukkit.craftbukkit.event.CraftEventFactory; //导入方法依赖的package包/类
public void updateTick(World p_149674_1_, int p_149674_2_, int p_149674_3_, int p_149674_4_, Random p_149674_5_)
{
    super.updateTick(p_149674_1_, p_149674_2_, p_149674_3_, p_149674_4_, p_149674_5_);

    if (p_149674_1_.getBlockLightValue(p_149674_2_, p_149674_3_ + 1, p_149674_4_) >= 9)
    {
        float f = this.func_149875_n(p_149674_1_, p_149674_2_, p_149674_3_, p_149674_4_);

        if (p_149674_5_.nextInt((int)(p_149674_1_.growthOdds / (this == Blocks.pumpkin_stem ? p_149674_1_.getSpigotConfig().pumpkinModifier : p_149674_1_.spigotConfig.melonModifier) * (25.0F / f)) + 1) == 0)   // Spigot // Cauldron
        {
            int l = p_149674_1_.getBlockMetadata(p_149674_2_, p_149674_3_, p_149674_4_);

            if (l < 7)
            {
                ++l;
                CraftEventFactory.handleBlockGrowEvent(p_149674_1_, p_149674_2_, p_149674_3_, p_149674_4_, this, l); // CraftBukkit
            }
            else
            {
                if (p_149674_1_.getBlock(p_149674_2_ - 1, p_149674_3_, p_149674_4_) == this.field_149877_a)
                {
                    return;
                }

                if (p_149674_1_.getBlock(p_149674_2_ + 1, p_149674_3_, p_149674_4_) == this.field_149877_a)
                {
                    return;
                }

                if (p_149674_1_.getBlock(p_149674_2_, p_149674_3_, p_149674_4_ - 1) == this.field_149877_a)
                {
                    return;
                }

                if (p_149674_1_.getBlock(p_149674_2_, p_149674_3_, p_149674_4_ + 1) == this.field_149877_a)
                {
                    return;
                }

                int i1 = p_149674_5_.nextInt(4);
                int j1 = p_149674_2_;
                int k1 = p_149674_4_;

                if (i1 == 0)
                {
                    j1 = p_149674_2_ - 1;
                }

                if (i1 == 1)
                {
                    ++j1;
                }

                if (i1 == 2)
                {
                    k1 = p_149674_4_ - 1;
                }

                if (i1 == 3)
                {
                    ++k1;
                }

                Block block = p_149674_1_.getBlock(j1, p_149674_3_ - 1, k1);

                if (p_149674_1_.isAirBlock(j1, p_149674_3_, k1) && (block.canSustainPlant(p_149674_1_, j1, p_149674_3_ - 1, k1, UP, this) || block == Blocks.dirt || block == Blocks.grass))
                {
                    CraftEventFactory.handleBlockGrowEvent(p_149674_1_, j1, p_149674_3_, k1, this.field_149877_a, 0); // CraftBukkit
                }
            }
        }
    }
}
 
开发者ID:xtrafrancyz,项目名称:Cauldron,代码行数:74,代码来源:BlockStem.java


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