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


Java Entity.getPushReaction方法代碼示例

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


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

示例1: func_190589_G

import net.minecraft.entity.Entity; //導入方法依賴的package包/類
private void func_190589_G()
{
    IBlockState iblockstate = this.world.getBlockState(this.getPos());

    if (iblockstate.getBlock() instanceof BlockShulkerBox)
    {
        EnumFacing enumfacing = (EnumFacing)iblockstate.getValue(BlockShulkerBox.field_190957_a);
        AxisAlignedBB axisalignedbb = this.func_190588_c(enumfacing).offset(this.pos);
        List<Entity> list = this.world.getEntitiesWithinAABBExcludingEntity((Entity)null, axisalignedbb);

        if (!list.isEmpty())
        {
            for (int i = 0; i < list.size(); ++i)
            {
                Entity entity = (Entity)list.get(i);

                if (entity.getPushReaction() != EnumPushReaction.IGNORE)
                {
                    double d0 = 0.0D;
                    double d1 = 0.0D;
                    double d2 = 0.0D;
                    AxisAlignedBB axisalignedbb1 = entity.getEntityBoundingBox();

                    switch (enumfacing.getAxis())
                    {
                        case X:
                            if (enumfacing.getAxisDirection() == EnumFacing.AxisDirection.POSITIVE)
                            {
                                d0 = axisalignedbb.maxX - axisalignedbb1.minX;
                            }
                            else
                            {
                                d0 = axisalignedbb1.maxX - axisalignedbb.minX;
                            }

                            d0 = d0 + 0.01D;
                            break;

                        case Y:
                            if (enumfacing.getAxisDirection() == EnumFacing.AxisDirection.POSITIVE)
                            {
                                d1 = axisalignedbb.maxY - axisalignedbb1.minY;
                            }
                            else
                            {
                                d1 = axisalignedbb1.maxY - axisalignedbb.minY;
                            }

                            d1 = d1 + 0.01D;
                            break;

                        case Z:
                            if (enumfacing.getAxisDirection() == EnumFacing.AxisDirection.POSITIVE)
                            {
                                d2 = axisalignedbb.maxZ - axisalignedbb1.minZ;
                            }
                            else
                            {
                                d2 = axisalignedbb1.maxZ - axisalignedbb.minZ;
                            }

                            d2 = d2 + 0.01D;
                    }

                    entity.moveEntity(MoverType.SHULKER_BOX, d0 * (double)enumfacing.getFrontOffsetX(), d1 * (double)enumfacing.getFrontOffsetY(), d2 * (double)enumfacing.getFrontOffsetZ());
                }
            }
        }
    }
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:71,代碼來源:TileEntityShulkerBox.java

示例2: moveCollidedEntities

import net.minecraft.entity.Entity; //導入方法依賴的package包/類
private void moveCollidedEntities(float p_184322_1_)
{
    EnumFacing enumfacing = this.extending ? this.pistonFacing : this.pistonFacing.getOpposite();
    double d0 = (double)(p_184322_1_ - this.progress);
    List<AxisAlignedBB> list = Lists.<AxisAlignedBB>newArrayList();
    this.func_190606_j().addCollisionBoxToList(this.world, BlockPos.ORIGIN, new AxisAlignedBB(BlockPos.ORIGIN), list, (Entity)null, true);

    if (!((List)list).isEmpty())
    {
        AxisAlignedBB axisalignedbb = this.func_190607_a(this.func_191515_a(list));
        List<Entity> list1 = this.world.getEntitiesWithinAABBExcludingEntity((Entity)null, this.func_190610_a(axisalignedbb, enumfacing, d0).union(axisalignedbb));

        if (!list1.isEmpty())
        {
            boolean flag = this.pistonState.getBlock() == Blocks.SLIME_BLOCK;

            for (int i = 0; i < list1.size(); ++i)
            {
                Entity entity = (Entity)list1.get(i);

                if (entity.getPushReaction() != EnumPushReaction.IGNORE)
                {
                    if (flag)
                    {
                        switch (enumfacing.getAxis())
                        {
                            case X:
                                entity.motionX = (double)enumfacing.getFrontOffsetX();
                                break;

                            case Y:
                                entity.motionY = (double)enumfacing.getFrontOffsetY();
                                break;

                            case Z:
                                entity.motionZ = (double)enumfacing.getFrontOffsetZ();
                        }
                    }

                    double d1 = 0.0D;

                    for (int j = 0; j < ((List)list).size(); ++j)
                    {
                        AxisAlignedBB axisalignedbb1 = this.func_190610_a(this.func_190607_a((AxisAlignedBB)list.get(j)), enumfacing, d0);
                        AxisAlignedBB axisalignedbb2 = entity.getEntityBoundingBox();

                        if (axisalignedbb1.intersectsWith(axisalignedbb2))
                        {
                            d1 = Math.max(d1, this.func_190612_a(axisalignedbb1, enumfacing, axisalignedbb2));

                            if (d1 >= d0)
                            {
                                break;
                            }
                        }
                    }

                    if (d1 > 0.0D)
                    {
                        d1 = Math.min(d1, d0) + 0.01D;
                        field_190613_i.set(enumfacing);
                        entity.moveEntity(MoverType.PISTON, d1 * (double)enumfacing.getFrontOffsetX(), d1 * (double)enumfacing.getFrontOffsetY(), d1 * (double)enumfacing.getFrontOffsetZ());
                        field_190613_i.set((EnumFacing)null);

                        if (!this.extending && this.shouldHeadBeRendered)
                        {
                            this.func_190605_a(entity, enumfacing, d0);
                        }
                    }
                }
            }
        }
    }
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:75,代碼來源:TileEntityPiston.java


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