當前位置: 首頁>>代碼示例>>Java>>正文


Java IBlockState.addCollisionBoxToList方法代碼示例

本文整理匯總了Java中net.minecraft.block.state.IBlockState.addCollisionBoxToList方法的典型用法代碼示例。如果您正苦於以下問題:Java IBlockState.addCollisionBoxToList方法的具體用法?Java IBlockState.addCollisionBoxToList怎麽用?Java IBlockState.addCollisionBoxToList使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在net.minecraft.block.state.IBlockState的用法示例。


在下文中一共展示了IBlockState.addCollisionBoxToList方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: func_190609_a

import net.minecraft.block.state.IBlockState; //導入方法依賴的package包/類
public void func_190609_a(World p_190609_1_, BlockPos p_190609_2_, AxisAlignedBB p_190609_3_, List<AxisAlignedBB> p_190609_4_, @Nullable Entity p_190609_5_)
{
    if (!this.extending && this.shouldHeadBeRendered)
    {
        this.pistonState.withProperty(BlockPistonBase.EXTENDED, Boolean.valueOf(true)).addCollisionBoxToList(p_190609_1_, p_190609_2_, p_190609_3_, p_190609_4_, p_190609_5_, false);
    }

    EnumFacing enumfacing = (EnumFacing)field_190613_i.get();

    if ((double)this.progress >= 1.0D || enumfacing != (this.extending ? this.pistonFacing : this.pistonFacing.getOpposite()))
    {
        int i = p_190609_4_.size();
        IBlockState iblockstate;

        if (this.shouldPistonHeadBeRendered())
        {
            iblockstate = Blocks.PISTON_HEAD.getDefaultState().withProperty(BlockPistonExtension.FACING, this.pistonFacing).withProperty(BlockPistonExtension.SHORT, Boolean.valueOf(this.extending != 1.0F - this.progress < 0.25F));
        }
        else
        {
            iblockstate = this.pistonState;
        }

        float f = this.getExtendedProgress(this.progress);
        double d0 = (double)((float)this.pistonFacing.getFrontOffsetX() * f);
        double d1 = (double)((float)this.pistonFacing.getFrontOffsetY() * f);
        double d2 = (double)((float)this.pistonFacing.getFrontOffsetZ() * f);
        iblockstate.addCollisionBoxToList(p_190609_1_, p_190609_2_, p_190609_3_.offset(-d0, -d1, -d2), p_190609_4_, p_190609_5_, true);

        for (int j = i; j < p_190609_4_.size(); ++j)
        {
            p_190609_4_.set(j, ((AxisAlignedBB)p_190609_4_.get(j)).offset(d0, d1, d2));
        }
    }
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:36,代碼來源:TileEntityPiston.java

示例2: func_191504_a

import net.minecraft.block.state.IBlockState; //導入方法依賴的package包/類
private boolean func_191504_a(@Nullable Entity p_191504_1_, AxisAlignedBB p_191504_2_, boolean p_191504_3_, @Nullable List<AxisAlignedBB> p_191504_4_)
{
    int i = MathHelper.floor(p_191504_2_.minX) - 1;
    int j = MathHelper.ceil(p_191504_2_.maxX) + 1;
    int k = MathHelper.floor(p_191504_2_.minY) - 1;
    int l = MathHelper.ceil(p_191504_2_.maxY) + 1;
    int i1 = MathHelper.floor(p_191504_2_.minZ) - 1;
    int j1 = MathHelper.ceil(p_191504_2_.maxZ) + 1;
    WorldBorder worldborder = this.getWorldBorder();
    boolean flag = p_191504_1_ != null && p_191504_1_.isOutsideBorder();
    boolean flag1 = p_191504_1_ != null && this.func_191503_g(p_191504_1_);
    IBlockState iblockstate = Blocks.STONE.getDefaultState();
    BlockPos.PooledMutableBlockPos blockpos$pooledmutableblockpos = BlockPos.PooledMutableBlockPos.retain();

    try
    {
        for (int k1 = i; k1 < j; ++k1)
        {
            for (int l1 = i1; l1 < j1; ++l1)
            {
                boolean flag2 = k1 == i || k1 == j - 1;
                boolean flag3 = l1 == i1 || l1 == j1 - 1;

                if ((!flag2 || !flag3) && this.isBlockLoaded(blockpos$pooledmutableblockpos.setPos(k1, 64, l1)))
                {
                    for (int i2 = k; i2 < l; ++i2)
                    {
                        if (!flag2 && !flag3 || i2 != l - 1)
                        {
                            if (p_191504_3_)
                            {
                                if (k1 < -30000000 || k1 >= 30000000 || l1 < -30000000 || l1 >= 30000000)
                                {
                                    boolean lvt_21_1_ = true;
                                    return lvt_21_1_;
                                }
                            }
                            else if (p_191504_1_ != null && flag == flag1)
                            {
                                p_191504_1_.setOutsideBorder(!flag1);
                            }

                            blockpos$pooledmutableblockpos.setPos(k1, i2, l1);
                            IBlockState iblockstate1;

                            if (!p_191504_3_ && !worldborder.contains(blockpos$pooledmutableblockpos) && flag1)
                            {
                                iblockstate1 = iblockstate;
                            }
                            else
                            {
                                iblockstate1 = this.getBlockState(blockpos$pooledmutableblockpos);
                            }

                            iblockstate1.addCollisionBoxToList(this, blockpos$pooledmutableblockpos, p_191504_2_, p_191504_4_, p_191504_1_, false);

                            if (p_191504_3_ && !p_191504_4_.isEmpty())
                            {
                                boolean flag5 = true;
                                return flag5;
                            }
                        }
                    }
                }
            }
        }
    }
    finally
    {
        blockpos$pooledmutableblockpos.release();
    }

    return !p_191504_4_.isEmpty();
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:75,代碼來源:World.java

示例3: getBoatGlide

import net.minecraft.block.state.IBlockState; //導入方法依賴的package包/類
/**
 * Decides how much the boat should be gliding on the land (based on any slippery blocks)
 */
public float getBoatGlide()
{
    AxisAlignedBB axisalignedbb = this.getEntityBoundingBox();
    AxisAlignedBB axisalignedbb1 = new AxisAlignedBB(axisalignedbb.minX, axisalignedbb.minY - 0.001D, axisalignedbb.minZ, axisalignedbb.maxX, axisalignedbb.minY, axisalignedbb.maxZ);
    int i = MathHelper.floor(axisalignedbb1.minX) - 1;
    int j = MathHelper.ceil(axisalignedbb1.maxX) + 1;
    int k = MathHelper.floor(axisalignedbb1.minY) - 1;
    int l = MathHelper.ceil(axisalignedbb1.maxY) + 1;
    int i1 = MathHelper.floor(axisalignedbb1.minZ) - 1;
    int j1 = MathHelper.ceil(axisalignedbb1.maxZ) + 1;
    List<AxisAlignedBB> list = Lists.<AxisAlignedBB>newArrayList();
    float f = 0.0F;
    int k1 = 0;
    BlockPos.PooledMutableBlockPos blockpos$pooledmutableblockpos = BlockPos.PooledMutableBlockPos.retain();

    try
    {
        for (int l1 = i; l1 < j; ++l1)
        {
            for (int i2 = i1; i2 < j1; ++i2)
            {
                int j2 = (l1 != i && l1 != j - 1 ? 0 : 1) + (i2 != i1 && i2 != j1 - 1 ? 0 : 1);

                if (j2 != 2)
                {
                    for (int k2 = k; k2 < l; ++k2)
                    {
                        if (j2 <= 0 || k2 != k && k2 != l - 1)
                        {
                            blockpos$pooledmutableblockpos.setPos(l1, k2, i2);
                            IBlockState iblockstate = this.world.getBlockState(blockpos$pooledmutableblockpos);
                            iblockstate.addCollisionBoxToList(this.world, blockpos$pooledmutableblockpos, axisalignedbb1, list, this, false);

                            if (!list.isEmpty())
                            {
                                f += iblockstate.getBlock().slipperiness;
                                ++k1;
                            }

                            list.clear();
                        }
                    }
                }
            }
        }
    }
    finally
    {
        blockpos$pooledmutableblockpos.release();
    }

    return f / (float)k1;
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:57,代碼來源:EntityBoat.java

示例4: getCollisionBoxes

import net.minecraft.block.state.IBlockState; //導入方法依賴的package包/類
public List<AxisAlignedBB> getCollisionBoxes(AxisAlignedBB bb)
{
    List<AxisAlignedBB> list = Lists.<AxisAlignedBB>newArrayList();
    int i = MathHelper.floor_double(bb.minX) - 1;
    int j = MathHelper.ceiling_double_int(bb.maxX) + 1;
    int k = MathHelper.floor_double(bb.minY) - 1;
    int l = MathHelper.ceiling_double_int(bb.maxY) + 1;
    int i1 = MathHelper.floor_double(bb.minZ) - 1;
    int j1 = MathHelper.ceiling_double_int(bb.maxZ) + 1;
    BlockPos.PooledMutableBlockPos blockpos$pooledmutableblockpos = BlockPos.PooledMutableBlockPos.retain();

    for (int k1 = i; k1 < j; ++k1)
    {
        for (int l1 = i1; l1 < j1; ++l1)
        {
            int i2 = (k1 != i && k1 != j - 1 ? 0 : 1) + (l1 != i1 && l1 != j1 - 1 ? 0 : 1);

            if (i2 != 2 && this.isBlockLoaded(blockpos$pooledmutableblockpos.setPos(k1, 64, l1)))
            {
                for (int j2 = k; j2 < l; ++j2)
                {
                    if (i2 <= 0 || j2 != k && j2 != l - 1)
                    {
                        blockpos$pooledmutableblockpos.setPos(k1, j2, l1);
                        IBlockState iblockstate;

                        if (k1 >= -30000000 && k1 < 30000000 && l1 >= -30000000 && l1 < 30000000)
                        {
                            iblockstate = this.getBlockState(blockpos$pooledmutableblockpos);
                        }
                        else
                        {
                            iblockstate = Blocks.BEDROCK.getDefaultState();
                        }

                        iblockstate.addCollisionBoxToList(this, blockpos$pooledmutableblockpos, bb, list, (Entity)null);
                    }
                }
            }
        }
    }

    blockpos$pooledmutableblockpos.release();
    return list;
}
 
開發者ID:F1r3w477,項目名稱:CustomWorldGen,代碼行數:46,代碼來源:World.java

示例5: collidesWithAnyBlock

import net.minecraft.block.state.IBlockState; //導入方法依賴的package包/類
/**
 * Returns true if the given bbox collides with any block.
 */
public boolean collidesWithAnyBlock(AxisAlignedBB bbox)
{
    List<AxisAlignedBB> list = Lists.<AxisAlignedBB>newArrayList();
    int i = MathHelper.floor_double(bbox.minX) - 1;
    int j = MathHelper.ceiling_double_int(bbox.maxX) + 1;
    int k = MathHelper.floor_double(bbox.minY) - 1;
    int l = MathHelper.ceiling_double_int(bbox.maxY) + 1;
    int i1 = MathHelper.floor_double(bbox.minZ) - 1;
    int j1 = MathHelper.ceiling_double_int(bbox.maxZ) + 1;
    BlockPos.PooledMutableBlockPos blockpos$pooledmutableblockpos = BlockPos.PooledMutableBlockPos.retain();

    try
    {
        for (int k1 = i; k1 < j; ++k1)
        {
            for (int l1 = i1; l1 < j1; ++l1)
            {
                int i2 = (k1 != i && k1 != j - 1 ? 0 : 1) + (l1 != i1 && l1 != j1 - 1 ? 0 : 1);

                if (i2 != 2 && this.isBlockLoaded(blockpos$pooledmutableblockpos.setPos(k1, 64, l1)))
                {
                    for (int j2 = k; j2 < l; ++j2)
                    {
                        if (i2 <= 0 || j2 != k && j2 != l - 1)
                        {
                            blockpos$pooledmutableblockpos.setPos(k1, j2, l1);

                            if (k1 < -30000000 || k1 >= 30000000 || l1 < -30000000 || l1 >= 30000000)
                            {
                                boolean flag1 = true;
                                return flag1;
                            }

                            IBlockState iblockstate = this.getBlockState(blockpos$pooledmutableblockpos);
                            iblockstate.addCollisionBoxToList(this, blockpos$pooledmutableblockpos, bbox, list, (Entity)null);

                            if (!list.isEmpty())
                            {
                                boolean flag = true;
                                return flag;
                            }
                        }
                    }
                }
            }
        }

        return false;
    }
    finally
    {
        blockpos$pooledmutableblockpos.release();
    }
}
 
開發者ID:F1r3w477,項目名稱:CustomWorldGen,代碼行數:58,代碼來源:World.java

示例6: getBoatGlide

import net.minecraft.block.state.IBlockState; //導入方法依賴的package包/類
/**
 * Decides how much the boat should be gliding on the land (based on any slippery blocks)
 */
public float getBoatGlide()
{
    AxisAlignedBB axisalignedbb = this.getEntityBoundingBox();
    AxisAlignedBB axisalignedbb1 = new AxisAlignedBB(axisalignedbb.minX, axisalignedbb.minY - 0.001D, axisalignedbb.minZ, axisalignedbb.maxX, axisalignedbb.minY, axisalignedbb.maxZ);
    int i = MathHelper.floor_double(axisalignedbb1.minX) - 1;
    int j = MathHelper.ceiling_double_int(axisalignedbb1.maxX) + 1;
    int k = MathHelper.floor_double(axisalignedbb1.minY) - 1;
    int l = MathHelper.ceiling_double_int(axisalignedbb1.maxY) + 1;
    int i1 = MathHelper.floor_double(axisalignedbb1.minZ) - 1;
    int j1 = MathHelper.ceiling_double_int(axisalignedbb1.maxZ) + 1;
    List<AxisAlignedBB> list = Lists.<AxisAlignedBB>newArrayList();
    float f = 0.0F;
    int k1 = 0;
    BlockPos.PooledMutableBlockPos blockpos$pooledmutableblockpos = BlockPos.PooledMutableBlockPos.retain();

    try
    {
        for (int l1 = i; l1 < j; ++l1)
        {
            for (int i2 = i1; i2 < j1; ++i2)
            {
                int j2 = (l1 != i && l1 != j - 1 ? 0 : 1) + (i2 != i1 && i2 != j1 - 1 ? 0 : 1);

                if (j2 != 2)
                {
                    for (int k2 = k; k2 < l; ++k2)
                    {
                        if (j2 <= 0 || k2 != k && k2 != l - 1)
                        {
                            blockpos$pooledmutableblockpos.setPos(l1, k2, i2);
                            IBlockState iblockstate = this.worldObj.getBlockState(blockpos$pooledmutableblockpos);
                            iblockstate.addCollisionBoxToList(this.worldObj, blockpos$pooledmutableblockpos, axisalignedbb1, list, this);

                            if (!list.isEmpty())
                            {
                                f += iblockstate.getBlock().slipperiness;
                                ++k1;
                            }

                            list.clear();
                        }
                    }
                }
            }
        }
    }
    finally
    {
        blockpos$pooledmutableblockpos.release();
    }

    return f / (float)k1;
}
 
開發者ID:F1r3w477,項目名稱:CustomWorldGen,代碼行數:57,代碼來源:EntityBoat.java


注:本文中的net.minecraft.block.state.IBlockState.addCollisionBoxToList方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。