當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。