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


Java EntityBlockFormEvent.isCancelled方法代码示例

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


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

示例1: e

import org.bukkit.event.block.EntityBlockFormEvent; //导入方法依赖的package包/类
public void e() {
    super.e();
    int i = MathHelper.floor(this.locX);
    int j = MathHelper.floor(this.locY);
    int k = MathHelper.floor(this.locZ);

    if (this.L()) {
        this.damageEntity(DamageSource.DROWN, 1.0F);
    }

    if (this.world.getBiome(i, k).a(i, j, k) > 1.0F) {
        this.damageEntity(CraftEventFactory.MELTING, 1.0F); // CraftBukkit - DamageSource.BURN -> CraftEventFactory.MELTING
    }

    for (int l = 0; l < 4; ++l) {
        i = MathHelper.floor(this.locX + (double) ((float) (l % 2 * 2 - 1) * 0.25F));
        j = MathHelper.floor(this.locY);
        k = MathHelper.floor(this.locZ + (double) ((float) (l / 2 % 2 * 2 - 1) * 0.25F));
        if (this.world.getType(i, j, k).getMaterial() == Material.AIR && this.world.getBiome(i, k).a(i, j, k) < 0.8F && Blocks.SNOW.canPlace(this.world, i, j, k)) {
            // CraftBukkit start
            org.bukkit.block.BlockState blockState = this.world.getWorld().getBlockAt(i, j, k).getState();
            blockState.setType(CraftMagicNumbers.getMaterial(Blocks.SNOW));

            EntityBlockFormEvent event = new EntityBlockFormEvent(this.getBukkitEntity(), blockState.getBlock(), blockState);
            this.world.getServer().getPluginManager().callEvent(event);

            if(!event.isCancelled()) {
                blockState.update(true);
            }
            // CraftBukkit end
        }
    }
}
 
开发者ID:OvercastNetwork,项目名称:CraftBukkit,代码行数:34,代码来源:EntitySnowman.java

示例2: c

import org.bukkit.event.block.EntityBlockFormEvent; //导入方法依赖的package包/类
public void c() {
    super.c();
    if (this.G()) {
        this.damageEntity(DamageSource.DROWN, 1.0F);
    }

    int i = MathHelper.floor(this.locX);
    int j = MathHelper.floor(this.locZ);

    if (this.world.getBiome(i, j).j() > 1.0F) {
        this.damageEntity(CraftEventFactory.MELTING, 1.0F); // CraftBukkit - DamageSource.BURN -> CraftEventFactory.MELTING
    }

    for (i = 0; i < 4; ++i) {
        j = MathHelper.floor(this.locX + (double) ((float) (i % 2 * 2 - 1) * 0.25F));
        int k = MathHelper.floor(this.locY);
        int l = MathHelper.floor(this.locZ + (double) ((float) (i / 2 % 2 * 2 - 1) * 0.25F));

        if (this.world.getTypeId(j, k, l) == 0 && this.world.getBiome(j, l).j() < 0.8F && Block.SNOW.canPlace(this.world, j, k, l)) {
            // CraftBukkit start
            org.bukkit.block.BlockState blockState = this.world.getWorld().getBlockAt(j, k, l).getState();
            blockState.setTypeId(Block.SNOW.id);

            EntityBlockFormEvent event = new EntityBlockFormEvent(this.getBukkitEntity(), blockState.getBlock(), blockState);
            this.world.getServer().getPluginManager().callEvent(event);

            if(!event.isCancelled()) {
                blockState.update(true);
            }
            // CraftBukkit end
        }
    }
}
 
开发者ID:AlmuraDev,项目名称:Almura-Server,代码行数:34,代码来源:EntitySnowman.java

示例3: onLivingUpdate

import org.bukkit.event.block.EntityBlockFormEvent; //导入方法依赖的package包/类
public void onLivingUpdate()
{
    super.onLivingUpdate();
    int i = MathHelper.floor_double(this.posX);
    int j = MathHelper.floor_double(this.posY);
    int k = MathHelper.floor_double(this.posZ);

    if (this.isWet())
    {
        this.attackEntityFrom(DamageSource.drown, 1.0F);
    }

    if (this.worldObj.getBiomeGenForCoords(i, k).getFloatTemperature(i, j, k) > 1.0F)
    {
        this.attackEntityFrom(CraftEventFactory.MELTING, 1.0F); // CraftBukkit - DamageSource.BURN -> CraftEventFactory.MELTING
    }

    for (int l = 0; l < 4; ++l)
    {
        i = MathHelper.floor_double(this.posX + (double)((float)(l % 2 * 2 - 1) * 0.25F));
        j = MathHelper.floor_double(this.posY);
        k = MathHelper.floor_double(this.posZ + (double)((float)(l / 2 % 2 * 2 - 1) * 0.25F));

        if (this.worldObj.getBlock(i, j, k).getMaterial() == Material.air && this.worldObj.getBiomeGenForCoords(i, k).getFloatTemperature(i, j, k) < 0.8F && Blocks.snow_layer.canPlaceBlockAt(this.worldObj, i, j, k))
        {
            // CraftBukkit start
            org.bukkit.block.BlockState blockState = this.worldObj.getWorld().getBlockAt(i, j, k).getState();
            blockState.setType(CraftMagicNumbers.getMaterial(Blocks.snow_layer));
            EntityBlockFormEvent event = new EntityBlockFormEvent(this.getBukkitEntity(), blockState.getBlock(), blockState);
            this.worldObj.getServer().getPluginManager().callEvent(event);

            if (!event.isCancelled())
            {
                blockState.update(true);
            }

            // CraftBukkit end
        }
    }
}
 
开发者ID:xtrafrancyz,项目名称:Cauldron,代码行数:41,代码来源:EntitySnowman.java

示例4: a

import org.bukkit.event.block.EntityBlockFormEvent; //导入方法依赖的package包/类
public static void a(EntityLiving entityliving, World world, BlockPosition blockposition, int i) {
    if (entityliving.onGround) {
        float f = (float) Math.min(16, 2 + i);
        BlockPosition.MutableBlockPosition blockposition_mutableblockposition = new BlockPosition.MutableBlockPosition(0, 0, 0);
        Iterator iterator = BlockPosition.b(blockposition.a((double) (-f), -1.0D, (double) (-f)), blockposition.a((double) f, -1.0D, (double) f)).iterator();

        while (iterator.hasNext()) {
            BlockPosition.MutableBlockPosition blockposition_mutableblockposition1 = (BlockPosition.MutableBlockPosition) iterator.next();

            if (blockposition_mutableblockposition1.g(entityliving.locX, entityliving.locY, entityliving.locZ) <= (double) (f * f)) {
                blockposition_mutableblockposition.c(blockposition_mutableblockposition1.getX(), blockposition_mutableblockposition1.getY() + 1, blockposition_mutableblockposition1.getZ());
                IBlockData iblockdata = world.getType(blockposition_mutableblockposition);

                if (iblockdata.getBlock() == Blocks.AIR) {
                    IBlockData iblockdata1 = world.getType(blockposition_mutableblockposition1);

                    if (iblockdata1.getMaterial() == Material.WATER && ((Integer) iblockdata1.get(BlockFluids.LEVEL)).intValue() == 0 && world.a(Blocks.FROSTED_ICE, blockposition_mutableblockposition1, false, EnumDirection.DOWN, (Entity) null, (ItemStack) null)) {
                        // CraftBukkit Start - Call EntityBlockFormEvent for Frost Walker
                        org.bukkit.block.BlockState blockState = world.getWorld().getBlockAt(blockposition_mutableblockposition1.getX(), blockposition_mutableblockposition1.getY(), blockposition_mutableblockposition1.getZ()).getState();
                        blockState.setType(CraftMagicNumbers.getMaterial(Blocks.FROSTED_ICE));

                        EntityBlockFormEvent event = new EntityBlockFormEvent(entityliving.bukkitEntity, blockState.getBlock(), blockState);
                        world.getServer().getPluginManager().callEvent(event);

                        if (!event.isCancelled()) {
                            blockState.update(true);
                            world.a(blockposition_mutableblockposition1.h(), Blocks.FROSTED_ICE, MathHelper.nextInt(entityliving.getRandom(), 60, 120));
                        }
                        // CraftBukkit End
                    }
                }
            }
        }

    }
}
 
开发者ID:bergerkiller,项目名称:SpigotSource,代码行数:37,代码来源:EnchantmentFrostWalker.java

示例5: c

import org.bukkit.event.block.EntityBlockFormEvent; //导入方法依赖的package包/类
public void c() {
    super.c();
    if (this.F()) {
        this.damageEntity(DamageSource.DROWN, 1);
    }

    int i = MathHelper.floor(this.locX);
    int j = MathHelper.floor(this.locZ);

    if (this.world.getBiome(i, j).j() > 1.0F) {
        this.damageEntity(CraftEventFactory.MELTING, 1); // CraftBukkit - DamageSource.BURN -> CraftEventFactory.MELTING
    }

    for (i = 0; i < 4; ++i) {
        j = MathHelper.floor(this.locX + (double) ((float) (i % 2 * 2 - 1) * 0.25F));
        int k = MathHelper.floor(this.locY);
        int l = MathHelper.floor(this.locZ + (double) ((float) (i / 2 % 2 * 2 - 1) * 0.25F));

        if (this.world.getTypeId(j, k, l) == 0 && this.world.getBiome(j, l).j() < 0.8F && Block.SNOW.canPlace(this.world, j, k, l)) {
            // CraftBukkit start
            org.bukkit.block.BlockState blockState = this.world.getWorld().getBlockAt(j, k, l).getState();
            blockState.setTypeId(Block.SNOW.id);

            EntityBlockFormEvent event = new EntityBlockFormEvent(this.getBukkitEntity(), blockState.getBlock(), blockState);
            this.world.getServer().getPluginManager().callEvent(event);

            if(!event.isCancelled()) {
                blockState.update(true);
            }
            // CraftBukkit end
        }
    }
}
 
开发者ID:didoupimpon,项目名称:Craft-city,代码行数:34,代码来源:EntitySnowman.java

示例6: n

import org.bukkit.event.block.EntityBlockFormEvent; //导入方法依赖的package包/类
public void n() {
    super.n();
    if (!this.world.isClientSide) {
        int i = MathHelper.floor(this.locX);
        int j = MathHelper.floor(this.locY);
        int k = MathHelper.floor(this.locZ);

        if (this.ah()) {
            this.damageEntity(DamageSource.DROWN, 1.0F);
        }

        if (this.world.getBiome(new BlockPosition(i, 0, k)).a(new BlockPosition(i, j, k)) > 1.0F) {
            this.damageEntity(CraftEventFactory.MELTING, 1.0F); // CraftBukkit - DamageSource.BURN -> CraftEventFactory.MELTING
        }

        if (!this.world.getGameRules().getBoolean("mobGriefing")) {
            return;
        }

        for (int l = 0; l < 4; ++l) {
            i = MathHelper.floor(this.locX + (double) ((float) (l % 2 * 2 - 1) * 0.25F));
            j = MathHelper.floor(this.locY);
            k = MathHelper.floor(this.locZ + (double) ((float) (l / 2 % 2 * 2 - 1) * 0.25F));
            BlockPosition blockposition = new BlockPosition(i, j, k);

            if (this.world.getType(blockposition).getMaterial() == Material.AIR && this.world.getBiome(new BlockPosition(i, 0, k)).a(blockposition) < 0.8F && Blocks.SNOW_LAYER.canPlace(this.world, blockposition)) {
                // CraftBukkit start
                org.bukkit.block.BlockState blockState = this.world.getWorld().getBlockAt(i, j, k).getState();
                blockState.setType(CraftMagicNumbers.getMaterial(Blocks.SNOW_LAYER));

                EntityBlockFormEvent event = new EntityBlockFormEvent(this.getBukkitEntity(), blockState.getBlock(), blockState);
                this.world.getServer().getPluginManager().callEvent(event);

                if(!event.isCancelled()) {
                    blockState.update(true);
                }
                // CraftBukkit end
            }
        }
    }

}
 
开发者ID:bergerkiller,项目名称:SpigotSource,代码行数:43,代码来源:EntitySnowman.java


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