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


Java CraftEventFactory.blockDamage方法代码示例

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


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

示例1: func_145775_I

import org.bukkit.craftbukkit.event.CraftEventFactory; //导入方法依赖的package包/类
protected void func_145775_I()
{
    int i = MathHelper.floor_double(this.boundingBox.minX + 0.001D);
    int j = MathHelper.floor_double(this.boundingBox.minY + 0.001D);
    int k = MathHelper.floor_double(this.boundingBox.minZ + 0.001D);
    int l = MathHelper.floor_double(this.boundingBox.maxX - 0.001D);
    int i1 = MathHelper.floor_double(this.boundingBox.maxY - 0.001D);
    int j1 = MathHelper.floor_double(this.boundingBox.maxZ - 0.001D);

    if (this.worldObj.checkChunksExist(i, j, k, l, i1, j1))
    {
        for (int k1 = i; k1 <= l; ++k1)
        {
            for (int l1 = j; l1 <= i1; ++l1)
            {
                for (int i2 = k; i2 <= j1; ++i2)
                {
                    Block block = this.worldObj.getBlock(k1, l1, i2);

                    try
                    {
                        // Cauldron start - damage hook for custom blocks
                        CraftEventFactory.blockDamage = this.worldObj.getWorld().getBlockAt(k1, l1, i2);
                        block.onEntityCollidedWithBlock(this.worldObj, k1, l1, i2, this);
                        CraftEventFactory.blockDamage = null;
                        // Cauldron end
                    }
                    catch (Throwable throwable)
                    {
                        CrashReport crashreport = CrashReport.makeCrashReport(throwable, "Colliding entity with block");
                        CrashReportCategory crashreportcategory = crashreport.makeCategory("Block being collided with");
                        CrashReportCategory.func_147153_a(crashreportcategory, k1, l1, i2, block, this.worldObj.getBlockMetadata(k1, l1, i2));
                        throw new ReportedException(crashreport);
                    }
                }
            }
        }
    }
}
 
开发者ID:xtrafrancyz,项目名称:Cauldron,代码行数:40,代码来源:Entity.java

示例2: a

import org.bukkit.craftbukkit.event.CraftEventFactory; //导入方法依赖的package包/类
public void a(World world, int i, int j, int k, Entity entity) {
    CraftEventFactory.blockDamage = world.getWorld().getBlockAt(i, j, k); // CraftBukkit
    entity.damageEntity(DamageSource.CACTUS, 1.0F);
    CraftEventFactory.blockDamage = null; // CraftBukkit
}
 
开发者ID:OvercastNetwork,项目名称:CraftBukkit,代码行数:6,代码来源:BlockCactus.java


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