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


Java Entity.moveEntity方法代码示例

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


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

示例1: func_190605_a

import net.minecraft.entity.Entity; //导入方法依赖的package包/类
private void func_190605_a(Entity p_190605_1_, EnumFacing p_190605_2_, double p_190605_3_)
{
    AxisAlignedBB axisalignedbb = p_190605_1_.getEntityBoundingBox();
    AxisAlignedBB axisalignedbb1 = Block.FULL_BLOCK_AABB.offset(this.pos);

    if (axisalignedbb.intersectsWith(axisalignedbb1))
    {
        EnumFacing enumfacing = p_190605_2_.getOpposite();
        double d0 = this.func_190612_a(axisalignedbb1, enumfacing, axisalignedbb) + 0.01D;
        double d1 = this.func_190612_a(axisalignedbb1, enumfacing, axisalignedbb.func_191500_a(axisalignedbb1)) + 0.01D;

        if (Math.abs(d0 - d1) < 0.01D)
        {
            d0 = Math.min(d0, p_190605_3_) + 0.01D;
            field_190613_i.set(p_190605_2_);
            p_190605_1_.moveEntity(MoverType.PISTON, d0 * (double)enumfacing.getFrontOffsetX(), d0 * (double)enumfacing.getFrontOffsetY(), d0 * (double)enumfacing.getFrontOffsetZ());
            field_190613_i.set((EnumFacing)null);
        }
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:21,代码来源:TileEntityPiston.java

示例2: launchWithSlimeBlock

import net.minecraft.entity.Entity; //导入方法依赖的package包/类
private void launchWithSlimeBlock(float p_145863_1_, float p_145863_2_)
{
    if (this.extending)
    {
        p_145863_1_ = 1.0F - p_145863_1_;
    }
    else
    {
        --p_145863_1_;
    }

    AxisAlignedBB axisalignedbb = Blocks.piston_extension.getBoundingBox(this.worldObj, this.pos, this.pistonState, p_145863_1_, this.pistonFacing);

    if (axisalignedbb != null)
    {
        List<Entity> list = this.worldObj.getEntitiesWithinAABBExcludingEntity((Entity)null, axisalignedbb);

        if (!list.isEmpty())
        {
            this.field_174933_k.addAll(list);

            for (Entity entity : this.field_174933_k)
            {
                if (this.pistonState.getBlock() == Blocks.slime_block && this.extending)
                {
                    switch (this.pistonFacing.getAxis())
                    {
                        case X:
                            entity.motionX = (double)this.pistonFacing.getFrontOffsetX();
                            break;

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

                        case Z:
                            entity.motionZ = (double)this.pistonFacing.getFrontOffsetZ();
                    }
                }
                else
                {
                    entity.moveEntity((double)(p_145863_2_ * (float)this.pistonFacing.getFrontOffsetX()), (double)(p_145863_2_ * (float)this.pistonFacing.getFrontOffsetY()), (double)(p_145863_2_ * (float)this.pistonFacing.getFrontOffsetZ()));
                }
            }

            this.field_174933_k.clear();
        }
    }
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:50,代码来源:TileEntityPiston.java

示例3: processVehicleMove

import net.minecraft.entity.Entity; //导入方法依赖的package包/类
public void processVehicleMove(CPacketVehicleMove packetIn)
{
    PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.playerEntity.getServerWorld());

    if (isMoveVehiclePacketInvalid(packetIn))
    {
        this.kickPlayerFromServer("Invalid move vehicle packet received");
    }
    else
    {
        Entity entity = this.playerEntity.getLowestRidingEntity();

        if (entity != this.playerEntity && entity.getControllingPassenger() == this.playerEntity && entity == this.lowestRiddenEnt)
        {
            WorldServer worldserver = this.playerEntity.getServerWorld();
            double d0 = entity.posX;
            double d1 = entity.posY;
            double d2 = entity.posZ;
            double d3 = packetIn.getX();
            double d4 = packetIn.getY();
            double d5 = packetIn.getZ();
            float f = packetIn.getYaw();
            float f1 = packetIn.getPitch();
            double d6 = d3 - this.lowestRiddenX;
            double d7 = d4 - this.lowestRiddenY;
            double d8 = d5 - this.lowestRiddenZ;
            double d9 = entity.motionX * entity.motionX + entity.motionY * entity.motionY + entity.motionZ * entity.motionZ;
            double d10 = d6 * d6 + d7 * d7 + d8 * d8;

            if (d10 - d9 > 100.0D && (!this.serverController.isSinglePlayer() || !this.serverController.getServerOwner().equals(entity.getName())))
            {
                LOGGER.warn("{} (vehicle of {}) moved too quickly! {},{},{}", new Object[] {entity.getName(), this.playerEntity.getName(), Double.valueOf(d6), Double.valueOf(d7), Double.valueOf(d8)});
                this.netManager.sendPacket(new SPacketMoveVehicle(entity));
                return;
            }

            boolean flag = worldserver.getCollisionBoxes(entity, entity.getEntityBoundingBox().contract(0.0625D)).isEmpty();
            d6 = d3 - this.lowestRiddenX1;
            d7 = d4 - this.lowestRiddenY1 - 1.0E-6D;
            d8 = d5 - this.lowestRiddenZ1;
            entity.moveEntity(MoverType.PLAYER, d6, d7, d8);
            double d11 = d7;
            d6 = d3 - entity.posX;
            d7 = d4 - entity.posY;

            if (d7 > -0.5D || d7 < 0.5D)
            {
                d7 = 0.0D;
            }

            d8 = d5 - entity.posZ;
            d10 = d6 * d6 + d7 * d7 + d8 * d8;
            boolean flag1 = false;

            if (d10 > 0.0625D)
            {
                flag1 = true;
                LOGGER.warn("{} moved wrongly!", new Object[] {entity.getName()});
            }

            entity.setPositionAndRotation(d3, d4, d5, f, f1);
            boolean flag2 = worldserver.getCollisionBoxes(entity, entity.getEntityBoundingBox().contract(0.0625D)).isEmpty();

            if (flag && (flag1 || !flag2))
            {
                entity.setPositionAndRotation(d0, d1, d2, f, f1);
                this.netManager.sendPacket(new SPacketMoveVehicle(entity));
                return;
            }

            this.serverController.getPlayerList().serverUpdateMovingPlayer(this.playerEntity);
            this.playerEntity.addMovementStat(this.playerEntity.posX - d0, this.playerEntity.posY - d1, this.playerEntity.posZ - d2);
            this.vehicleFloating = d11 >= -0.03125D && !this.serverController.isFlightAllowed() && !worldserver.checkBlockCollision(entity.getEntityBoundingBox().expandXyz(0.0625D).addCoord(0.0D, -0.55D, 0.0D));
            this.lowestRiddenX1 = entity.posX;
            this.lowestRiddenY1 = entity.posY;
            this.lowestRiddenZ1 = entity.posZ;
        }
    }
}
 
开发者ID:NSExceptional,项目名称:Zombe-Modpack,代码行数:80,代码来源:NetHandlerPlayServer.java

示例4: 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

示例5: 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

示例6: processVehicleMove

import net.minecraft.entity.Entity; //导入方法依赖的package包/类
public void processVehicleMove(CPacketVehicleMove packetIn)
{
    PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.playerEntity.getServerWorld());

    if (isMoveVehiclePacketInvalid(packetIn))
    {
        this.kickPlayerFromServer("Invalid move vehicle packet received");
    }
    else
    {
        Entity entity = this.playerEntity.getLowestRidingEntity();

        if (entity != this.playerEntity && entity.getControllingPassenger() == this.playerEntity && entity == this.lowestRiddenEnt)
        {
            WorldServer worldserver = this.playerEntity.getServerWorld();
            double d0 = entity.posX;
            double d1 = entity.posY;
            double d2 = entity.posZ;
            double d3 = packetIn.getX();
            double d4 = packetIn.getY();
            double d5 = packetIn.getZ();
            float f = packetIn.getYaw();
            float f1 = packetIn.getPitch();
            double d6 = d3 - this.lowestRiddenX;
            double d7 = d4 - this.lowestRiddenY;
            double d8 = d5 - this.lowestRiddenZ;
            double d9 = entity.motionX * entity.motionX + entity.motionY * entity.motionY + entity.motionZ * entity.motionZ;
            double d10 = d6 * d6 + d7 * d7 + d8 * d8;

            if (d10 - d9 > 100.0D && (!this.serverController.isSinglePlayer() || !this.serverController.getServerOwner().equals(entity.getName())))
            {
                LOGGER.warn("{} (vehicle of {}) moved too quickly! {},{},{}", new Object[] {entity.getName(), this.playerEntity.getName(), Double.valueOf(d6), Double.valueOf(d7), Double.valueOf(d8)});
                this.netManager.sendPacket(new SPacketMoveVehicle(entity));
                return;
            }

            boolean flag = worldserver.getCollisionBoxes(entity, entity.getEntityBoundingBox().contract(0.0625D)).isEmpty();
            d6 = d3 - this.lowestRiddenX1;
            d7 = d4 - this.lowestRiddenY1 - 1.0E-6D;
            d8 = d5 - this.lowestRiddenZ1;
            entity.moveEntity(d6, d7, d8);
            double d11 = d7;
            d6 = d3 - entity.posX;
            d7 = d4 - entity.posY;

            if (d7 > -0.5D || d7 < 0.5D)
            {
                d7 = 0.0D;
            }

            d8 = d5 - entity.posZ;
            d10 = d6 * d6 + d7 * d7 + d8 * d8;
            boolean flag1 = false;

            if (d10 > 0.0625D)
            {
                flag1 = true;
                LOGGER.warn("{} moved wrongly!", new Object[] {entity.getName()});
            }

            entity.setPositionAndRotation(d3, d4, d5, f, f1);
            boolean flag2 = worldserver.getCollisionBoxes(entity, entity.getEntityBoundingBox().contract(0.0625D)).isEmpty();

            if (flag && (flag1 || !flag2))
            {
                entity.setPositionAndRotation(d0, d1, d2, f, f1);
                this.netManager.sendPacket(new SPacketMoveVehicle(entity));
                return;
            }

            this.serverController.getPlayerList().serverUpdateMountedMovingPlayer(this.playerEntity);
            this.playerEntity.addMovementStat(this.playerEntity.posX - d0, this.playerEntity.posY - d1, this.playerEntity.posZ - d2);
            this.vehicleFloating = d11 >= -0.03125D && !this.serverController.isFlightAllowed() && !worldserver.checkBlockCollision(entity.getEntityBoundingBox().expandXyz(0.0625D).addCoord(0.0D, -0.55D, 0.0D));
            this.lowestRiddenX1 = entity.posX;
            this.lowestRiddenY1 = entity.posY;
            this.lowestRiddenZ1 = entity.posZ;
        }
    }
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:80,代码来源:NetHandlerPlayServer.java


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