Java Code Examples for net.minecraft.entity.Entity#moveEntity()

The following examples show how to use net.minecraft.entity.Entity#moveEntity() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TileEntityElevatorBase.java    From PneumaticCraft with GNU General Public License v3.0 6 votes vote down vote up
private void movePlayerDown(){
    if(!worldObj.isRemote) return;

    AxisAlignedBB aabb = AxisAlignedBB.getBoundingBox(xCoord, yCoord + 1, zCoord, xCoord + 1, yCoord + oldExtension + 1.05F, zCoord + 1);
    List<Entity> entityList = worldObj.getEntitiesWithinAABBExcludingEntity(null, aabb);
    for(Entity entity : entityList) {
        if(entity instanceof EntityPlayer) {
            //   moveEntityToCenter(entity);
            double posX = entity.posX;
            double posZ = entity.posZ;
            if(posX >= xCoord && posX < xCoord + 1 && posZ >= zCoord && posZ < zCoord + 1) {
                entity.motionX *= 0.6;
                entity.motionZ *= 0.6;
                entity.moveEntity(0, extension - oldExtension + 0.001F, 0);
            }
        }
    }
}
 
Example 2
Source File: TeleporterMagicLand.java    From mobycraft with Apache License 2.0 5 votes vote down vote up
public void placeInPortal(Entity entity, float rotationYaw) {

		int i = MathHelper.floor_double(entity.posX);
		int j = MathHelper.floor_double(entity.posY) - 1;
		int k = MathHelper.floor_double(entity.posZ);
		byte b0 = 1;
		byte b1 = 0;

		for (int l = -2; l <= 2; ++l) {
			for (int i1 = -2; i1 <= 2; ++i1) {
				for (int j1 = -1; j < 3; ++j1) {
					int k1 = i + i1 * b0 + l * b1;
					int l1 = j + j1;
					int i2 = k + i1 * b1 - l * b0;
					boolean flag = j1 < 0;
				}
			}
		}

		entity.setLocationAndAngles((double) i, ((double) j) + 2, (double) k,
				entity.rotationYaw, 0.0F);
		entity.motionX = entity.motionY = entity.motionZ = 0.0D;
		
		while (entity.worldObj.getBlockState(entity.getPosition()).getBlock().isFullCube()) {
			entity.moveEntity(0, 1, 0);
		}

	}
 
Example 3
Source File: MovingStructure.java    From Framez with GNU General Public License v3.0 5 votes vote down vote up
private void moveEntity(Entity entity) {

        Vec3d pos = getMovement().transform(new Vec3d(entity.posX, entity.posY, entity.posZ), 1).clone()
                .sub(new Vec3d(entity.posX, entity.posY, entity.posZ)).mul(1 / (1 / getSpeed() - 1));
        pos.setY(Math.max(pos.getY(), 0));

        entity.motionY = Math.max(entity.motionY, 0) + pos.getY();

        if (!(entity instanceof EntityPlayer) || !(entity.isSneaking()))
            entity.moveEntity(pos.getX(), 0, pos.getZ());

        entity.onGround = true;
        entity.fallDistance = 0;
    }
 
Example 4
Source File: TileEntityElevatorBase.java    From PneumaticCraft with GNU General Public License v3.0 5 votes vote down vote up
private void moveEntities(float moveBy){
    AxisAlignedBB aabb = AxisAlignedBB.getBoundingBox(xCoord, yCoord + 1, zCoord, xCoord + 1, yCoord + extension + 1, zCoord + 1);
    List<Entity> entityList = worldObj.getEntitiesWithinAABBExcludingEntity(null, aabb);
    for(Entity entity : entityList) {
        if(entity instanceof EntityPlayer) {

        } else entity.moveEntity(0, moveBy + 0.05F, 0);
    }
}