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


Java World.containsAnyLiquid方法代码示例

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


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

示例1: emptySpaceHere

import net.minecraft.world.World; //导入方法依赖的package包/类
private static boolean emptySpaceHere(int pX, int pY, int pZ) {
    double x = pX + 0.5, y = (double)pY, z = pZ + 0.5;
    //double r = 0.3, h = 1.8; // skeleton size
    //double r = 0.35, h = 0.5; // cave spider size
    double r = 0.3, h = 0.5; // hybrid size
    AxisAlignedBB aabb = new AxisAlignedBB(x - r, y, z - r, x + r, y + h, z + r);
    World world = getWorld();
    return getCollidingBlockAABBs(world,aabb).isEmpty() && !world.containsAnyLiquid(aabb);
}
 
开发者ID:NSExceptional,项目名称:Zombe-Modpack,代码行数:10,代码来源:Safe.java

示例2: attemptTeleport

import net.minecraft.world.World; //导入方法依赖的package包/类
/**
 * Teleports the entity to the specified location. Used for Enderman and Chorus Fruit teleportation
 */
public boolean attemptTeleport(double x, double y, double z)
{
    double d0 = this.posX;
    double d1 = this.posY;
    double d2 = this.posZ;
    this.posX = x;
    this.posY = y;
    this.posZ = z;
    boolean flag = false;
    BlockPos blockpos = new BlockPos(this);
    World world = this.world;
    Random random = this.getRNG();

    if (world.isBlockLoaded(blockpos))
    {
        boolean flag1 = false;

        while (!flag1 && blockpos.getY() > 0)
        {
            BlockPos blockpos1 = blockpos.down();
            IBlockState iblockstate = world.getBlockState(blockpos1);

            if (iblockstate.getMaterial().blocksMovement())
            {
                flag1 = true;
            }
            else
            {
                --this.posY;
                blockpos = blockpos1;
            }
        }

        if (flag1)
        {
            this.setPositionAndUpdate(this.posX, this.posY, this.posZ);

            if (world.getCollisionBoxes(this, this.getEntityBoundingBox()).isEmpty() && !world.containsAnyLiquid(this.getEntityBoundingBox()))
            {
                flag = true;
            }
        }
    }

    if (!flag)
    {
        this.setPositionAndUpdate(d0, d1, d2);
        return false;
    }
    else
    {
        int i = 128;

        for (int j = 0; j < 128; ++j)
        {
            double d6 = (double)j / 127.0D;
            float f = (random.nextFloat() - 0.5F) * 0.2F;
            float f1 = (random.nextFloat() - 0.5F) * 0.2F;
            float f2 = (random.nextFloat() - 0.5F) * 0.2F;
            double d3 = d0 + (this.posX - d0) * d6 + (random.nextDouble() - 0.5D) * (double)this.width * 2.0D;
            double d4 = d1 + (this.posY - d1) * d6 + random.nextDouble() * (double)this.height;
            double d5 = d2 + (this.posZ - d2) * d6 + (random.nextDouble() - 0.5D) * (double)this.width * 2.0D;
            world.spawnParticle(EnumParticleTypes.PORTAL, d3, d4, d5, (double)f, (double)f1, (double)f2, new int[0]);
        }

        if (this instanceof EntityCreature)
        {
            ((EntityCreature)this).getNavigator().clearPathEntity();
        }

        return true;
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:77,代码来源:EntityLivingBase.java

示例3: attemptTeleport

import net.minecraft.world.World; //导入方法依赖的package包/类
/**
 * Teleports the entity to the specified location. Used for Enderman and Chorus Fruit teleportation
 */
public boolean attemptTeleport(double x, double y, double z)
{
    double d0 = this.posX;
    double d1 = this.posY;
    double d2 = this.posZ;
    this.posX = x;
    this.posY = y;
    this.posZ = z;
    boolean flag = false;
    BlockPos blockpos = new BlockPos(this);
    World world = this.worldObj;
    Random random = this.getRNG();

    if (world.isBlockLoaded(blockpos))
    {
        boolean flag1 = false;

        while (!flag1 && blockpos.getY() > 0)
        {
            BlockPos blockpos1 = blockpos.down();
            IBlockState iblockstate = world.getBlockState(blockpos1);

            if (iblockstate.getMaterial().blocksMovement())
            {
                flag1 = true;
            }
            else
            {
                --this.posY;
                blockpos = blockpos1;
            }
        }

        if (flag1)
        {
            this.setPositionAndUpdate(this.posX, this.posY, this.posZ);

            if (world.getCollisionBoxes(this, this.getEntityBoundingBox()).isEmpty() && !world.containsAnyLiquid(this.getEntityBoundingBox()))
            {
                flag = true;
            }
        }
    }

    if (!flag)
    {
        this.setPositionAndUpdate(d0, d1, d2);
        return false;
    }
    else
    {
        int i = 128;

        for (int j = 0; j < 128; ++j)
        {
            double d6 = (double)j / 127.0D;
            float f = (random.nextFloat() - 0.5F) * 0.2F;
            float f1 = (random.nextFloat() - 0.5F) * 0.2F;
            float f2 = (random.nextFloat() - 0.5F) * 0.2F;
            double d3 = d0 + (this.posX - d0) * d6 + (random.nextDouble() - 0.5D) * (double)this.width * 2.0D;
            double d4 = d1 + (this.posY - d1) * d6 + random.nextDouble() * (double)this.height;
            double d5 = d2 + (this.posZ - d2) * d6 + (random.nextDouble() - 0.5D) * (double)this.width * 2.0D;
            world.spawnParticle(EnumParticleTypes.PORTAL, d3, d4, d5, (double)f, (double)f1, (double)f2, new int[0]);
        }

        if (this instanceof EntityCreature)
        {
            ((EntityCreature)this).getNavigator().clearPathEntity();
        }

        return true;
    }
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:77,代码来源:EntityLivingBase.java


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